(type, method)
| 79 | } |
| 80 | |
| 81 | function wrapIdSetter(type, method) { |
| 82 | return function(id) { |
| 83 | validateId(id, 'id'); |
| 84 | if (typeof id === 'number') id >>>= 0; |
| 85 | // Result is 0 on success, 1 if credential is unknown. |
| 86 | const result = method(id); |
| 87 | if (result === 1) { |
| 88 | throw new ERR_UNKNOWN_CREDENTIAL(type, id); |
| 89 | } |
| 90 | }; |
| 91 | } |
| 92 | |
| 93 | function validateId(id, name) { |
| 94 | if (typeof id === 'number') { |
no test coverage detected
searching dependent graphs…