* Parse and validate values that will be converted into mode_t (the S_* * constants). Only valid numbers and octal strings are allowed. They could be * converted to 32-bit unsigned integers or non-negative signed integers in the * C++ land, but any value higher than 0o777 will result in platform-
(value, name, def)
| 71 | * @returns {number} |
| 72 | */ |
| 73 | function parseFileMode(value, name, def) { |
| 74 | value ??= def; |
| 75 | if (typeof value === 'string') { |
| 76 | if (RegExpPrototypeExec(octalReg, value) === null) { |
| 77 | throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc); |
| 78 | } |
| 79 | value = NumberParseInt(value, 8); |
| 80 | } |
| 81 | |
| 82 | validateUint32(value, name); |
| 83 | // Coerce -0 to +0. |
| 84 | return value + 0; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @callback validateInteger |
no outgoing calls
no test coverage detected
searching dependent graphs…