REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.91 KB
Close
/lib/node_modules/npm/node_modules/util-promisify/index.js
Text
Base64
'use strict'; const ObjectGetOwnPropertyDescriptors = require('object.getownpropertydescriptors'); const util = require('util'); const timers = require('timers'); const kCustomPromisifiedSymbol = util.promisify && util.promisify.custom || Symbol('util.promisify.custom'); //const kCustomPromisifyArgsSymbol = Symbol('customPromisifyArgs'); function promisify(orig) { if (typeof orig !== 'function') { //const errors = require('internal/errors'); //throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function'); var err = TypeError(`The "original" argument must be of type function`); err.code = 'ERR_INVALID_ARG_TYPE'; err.name = `TypeError [${err.code}]`; throw err } if (orig === timers.setTimeout || orig === timers.setImmediate) { const _orig = orig orig = function () { var args = []; for (var i = 0; i < arguments.length; i ++) args.push(arguments[i]); const _cb = args.pop() const cb = function () { var args = []; for (var i = 0; i < arguments.length; i ++) args.push(arguments[i]); _cb.apply(null, [null].concat(args)) } _orig.apply(timers, [cb].concat(args)) } } if (orig[kCustomPromisifiedSymbol]) { const fn = orig[kCustomPromisifiedSymbol]; if (typeof fn !== 'function') { throw new TypeError('The [util.promisify.custom] property must be ' + 'a function'); } Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }); return fn; } // Names to create an object from in case the callback receives multiple // arguments, e.g. ['stdout', 'stderr'] for child_process.exec. //const argumentNames = orig[kCustomPromisifyArgsSymbol]; function fn() { var args = []; for (var i = 0; i < arguments.length; i ++) args.push(arguments[i]); let resolve, reject; const promise = new Promise(function (_resolve, _reject) { resolve = _resolve; reject = _reject; }); try { orig.apply(this, args.concat(function (err) { var values = []; for (var i = 1; i < arguments.length; i++) values.push(arguments[i]); if (err) { reject(err); //} else if (argumentNames !== undefined && values.length > 1) { // const obj = {}; // for (var i = 0; i < argumentNames.length; i++) // obj[argumentNames[i]] = values[i]; // resolve(obj); } else { resolve(values[0]); } })); } catch (err) { reject(err); } return promise; } Object.setPrototypeOf(fn, Object.getPrototypeOf(orig)); Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }); return Object.defineProperties(fn, ObjectGetOwnPropertyDescriptors(orig)); } promisify.custom = kCustomPromisifiedSymbol; module.exports = promisify;
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 6
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.npmignore
13 B
lrw-r--r--
2021-03-10 14:36:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
.travis.yml
69 B
lrw-r--r--
2021-03-10 14:36:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.js
2.91 KB
lrw-r--r--
2021-03-10 14:36:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LICENSE
52.76 KB
lrw-r--r--
2021-03-10 14:36:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
package.json
1.29 KB
lrw-r--r--
2021-03-10 14:36:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
README.md
1.06 KB
lrw-r--r--
2021-03-10 14:36:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).