name
stringlengths
2
31
dataset
stringclasses
4 values
size
int64
1.66k
14.8k
content
stringlengths
1.66k
14.8k
content_without_annotations
stringlengths
1.66k
14.8k
loc
int64
51
494
functions
int64
3
40
function_signatures
int64
0
0
function_parameters
int64
4
64
variable_declarations
int64
5
54
property_declarations
int64
0
0
function_usages
int64
1
21
trivial_types
int64
0
0
predefined_types
int64
0
0
type_definitions
int64
0
1
dynamism_heuristic
int64
0
34
loc_per_function
float64
5.38
57.8
estimated_tokens
int64
494
3.9k
typechecks
bool
2 classes
ansi-colors
top1k-typed-nodeps
8,320
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var ansiColors = {exports: {}}; var symbols = {exports: {}}; // FILE: symbols.js var hasRequiredSymbols; function requireSymbols () { if (hasRequiredSymbols) return symbols.exports; hasRequiredSymbols = 1; (function (module) { const isHyper = typeof process !== 'undefined' && process.env.TERM_PROGRAM === 'Hyper'; const isWindows = typeof process !== 'undefined' && process.platform === 'win32'; const isLinux = typeof process !== 'undefined' && process.platform === 'linux'; const common = { ballotDisabled: '☒', ballotOff: '☐', ballotOn: '☑', bullet: '•', bulletWhite: '◦', fullBlock: '█', heart: '❤', identicalTo: '≡', line: '─', mark: '※', middot: '·', minus: '-', multiplication: '×', obelus: '÷', pencilDownRight: '✎', pencilRight: '✏', pencilUpRight: '✐', percent: '%', pilcrow2: '❡', pilcrow: '¶', plusMinus: '±', question: '?', section: '§', starsOff: '☆', starsOn: '★', upDownArrow: '↕' }; const windows = Object.assign({}, common, { check: '√', cross: '×', ellipsisLarge: '...', ellipsis: '...', info: 'i', questionSmall: '?', pointer: '>', pointerSmall: '»', radioOff: '( )', radioOn: '(*)', warning: '‼' }); const other = Object.assign({}, common, { ballotCross: '✘', check: '✔', cross: '✖', ellipsisLarge: '⋯', ellipsis: '…', info: 'ℹ', questionFull: '?', questionSmall: '﹖', pointer: isLinux ? '▸' : '❯', pointerSmall: isLinux ? '‣' : '›', radioOff: '◯', radioOn: '◉', warning: '⚠' }); module.exports = (isWindows && !isHyper) ? windows : other; Reflect.defineProperty(module.exports, 'common', { enumerable: false, value: common }); Reflect.defineProperty(module.exports, 'windows', { enumerable: false, value: windows }); Reflect.defineProperty(module.exports, 'other', { enumerable: false, value: other }); } (symbols)); return symbols.exports; } // FILE: index.js const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); /* eslint-disable no-control-regex */ // this is a modified version of https://github.com/chalk/ansi-regex (MIT License) const ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g; const hasColor = () => { if (typeof process !== 'undefined') { return process.env.FORCE_COLOR !== '0'; } return false; }; const create = () => { const colors = { enabled: hasColor(), visible: true, styles: {}, keys: {} }; const ansi = style => { let open = style.open = `\u001b[${style.codes[0]}m`; let close = style.close = `\u001b[${style.codes[1]}m`; let regex = style.regex = new RegExp(`\\u001b\\[${style.codes[1]}m`, 'g'); style.wrap = (input, newline) => { if (input.includes(close)) input = input.replace(regex, close + open); let output = open + input + close; // see https://github.com/chalk/chalk/pull/92, thanks to the // chalk contributors for this fix. However, we've confirmed that // this issue is also present in Windows terminals return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output; }; return style; }; const wrap = (style, input, newline) => { return typeof style === 'function' ? style(input) : style.wrap(input, newline); }; const style = (input, stack) => { if (input === '' || input == null) return ''; if (colors.enabled === false) return input; if (colors.visible === false) return ''; let str = '' + input; let nl = str.includes('\n'); let n = stack.length; if (n > 0 && stack.includes('unstyle')) { stack = [...new Set(['unstyle', ...stack])].reverse(); } while (n-- > 0) str = wrap(colors.styles[stack[n]], str, nl); return str; }; const define = (name, codes, type) => { colors.styles[name] = ansi({ name, codes }); let keys = colors.keys[type] || (colors.keys[type] = []); keys.push(name); Reflect.defineProperty(colors, name, { configurable: true, enumerable: true, set(value) { colors.alias(name, value); }, get() { let color = input => style(input, color.stack); Reflect.setPrototypeOf(color, colors); color.stack = this.stack ? this.stack.concat(name) : [name]; return color; } }); }; define('reset', [0, 0], 'modifier'); define('bold', [1, 22], 'modifier'); define('dim', [2, 22], 'modifier'); define('italic', [3, 23], 'modifier'); define('underline', [4, 24], 'modifier'); define('inverse', [7, 27], 'modifier'); define('hidden', [8, 28], 'modifier'); define('strikethrough', [9, 29], 'modifier'); define('black', [30, 39], 'color'); define('red', [31, 39], 'color'); define('green', [32, 39], 'color'); define('yellow', [33, 39], 'color'); define('blue', [34, 39], 'color'); define('magenta', [35, 39], 'color'); define('cyan', [36, 39], 'color'); define('white', [37, 39], 'color'); define('gray', [90, 39], 'color'); define('grey', [90, 39], 'color'); define('bgBlack', [40, 49], 'bg'); define('bgRed', [41, 49], 'bg'); define('bgGreen', [42, 49], 'bg'); define('bgYellow', [43, 49], 'bg'); define('bgBlue', [44, 49], 'bg'); define('bgMagenta', [45, 49], 'bg'); define('bgCyan', [46, 49], 'bg'); define('bgWhite', [47, 49], 'bg'); define('blackBright', [90, 39], 'bright'); define('redBright', [91, 39], 'bright'); define('greenBright', [92, 39], 'bright'); define('yellowBright', [93, 39], 'bright'); define('blueBright', [94, 39], 'bright'); define('magentaBright', [95, 39], 'bright'); define('cyanBright', [96, 39], 'bright'); define('whiteBright', [97, 39], 'bright'); define('bgBlackBright', [100, 49], 'bgBright'); define('bgRedBright', [101, 49], 'bgBright'); define('bgGreenBright', [102, 49], 'bgBright'); define('bgYellowBright', [103, 49], 'bgBright'); define('bgBlueBright', [104, 49], 'bgBright'); define('bgMagentaBright', [105, 49], 'bgBright'); define('bgCyanBright', [106, 49], 'bgBright'); define('bgWhiteBright', [107, 49], 'bgBright'); colors.ansiRegex = ANSI_REGEX; colors.hasColor = colors.hasAnsi = str => { colors.ansiRegex.lastIndex = 0; return typeof str === 'string' && str !== '' && colors.ansiRegex.test(str); }; colors.alias = (name, color) => { let fn = typeof color === 'string' ? colors[color] : color; if (typeof fn !== 'function') { throw new TypeError('Expected alias to be the name of an existing color (string) or a function'); } if (!fn.stack) { Reflect.defineProperty(fn, 'name', { value: name }); colors.styles[name] = fn; fn.stack = [name]; } Reflect.defineProperty(colors, name, { configurable: true, enumerable: true, set(value) { colors.alias(name, value); }, get() { let color = input => style(input, color.stack); Reflect.setPrototypeOf(color, colors); color.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack; return color; } }); }; colors.theme = custom => { if (!isObject(custom)) throw new TypeError('Expected theme to be an object'); for (let name of Object.keys(custom)) { colors.alias(name, custom[name]); } return colors; }; colors.alias('unstyle', str => { if (typeof str === 'string' && str !== '') { colors.ansiRegex.lastIndex = 0; return str.replace(colors.ansiRegex, ''); } return ''; }); colors.alias('noop', str => str); colors.none = colors.clear = colors.noop; colors.stripColor = colors.unstyle; colors.symbols = requireSymbols(); colors.define = define; return colors; }; ansiColors.exports = create(); var create_1 = ansiColors.exports.create = create; var ansiColorsExports = ansiColors.exports; var index = /*@__PURE__*/getDefaultExportFromCjs(ansiColorsExports); export { create_1 as create, index as default };
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var ansiColors = {exports: {}}; var symbols = {exports: {}}; // FILE: symbols.js var hasRequiredSymbols; function requireSymbols () { if (hasRequiredSymbols) return symbols.exports; hasRequiredSymbols = 1; (function (module) { const isHyper = typeof process !== 'undefined' && process.env.TERM_PROGRAM === 'Hyper'; const isWindows = typeof process !== 'undefined' && process.platform === 'win32'; const isLinux = typeof process !== 'undefined' && process.platform === 'linux'; const common = { ballotDisabled: '☒', ballotOff: '☐', ballotOn: '☑', bullet: '•', bulletWhite: '◦', fullBlock: '█', heart: '❤', identicalTo: '≡', line: '─', mark: '※', middot: '·', minus: '-', multiplication: '×', obelus: '÷', pencilDownRight: '✎', pencilRight: '✏', pencilUpRight: '✐', percent: '%', pilcrow2: '❡', pilcrow: '¶', plusMinus: '±', question: '?', section: '§', starsOff: '☆', starsOn: '★', upDownArrow: '↕' }; const windows = Object.assign({}, common, { check: '√', cross: '×', ellipsisLarge: '...', ellipsis: '...', info: 'i', questionSmall: '?', pointer: '>', pointerSmall: '»', radioOff: '( )', radioOn: '(*)', warning: '‼' }); const other = Object.assign({}, common, { ballotCross: '✘', check: '✔', cross: '✖', ellipsisLarge: '⋯', ellipsis: '…', info: 'ℹ', questionFull: '?', questionSmall: '﹖', pointer: isLinux ? '▸' : '❯', pointerSmall: isLinux ? '‣' : '›', radioOff: '◯', radioOn: '◉', warning: '⚠' }); module.exports = (isWindows && !isHyper) ? windows : other; Reflect.defineProperty(module.exports, 'common', { enumerable: false, value: common }); Reflect.defineProperty(module.exports, 'windows', { enumerable: false, value: windows }); Reflect.defineProperty(module.exports, 'other', { enumerable: false, value: other }); } (symbols)); return symbols.exports; } // FILE: index.js const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); /* eslint-disable no-control-regex */ // this is a modified version of https://github.com/chalk/ansi-regex (MIT License) const ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g; const hasColor = () => { if (typeof process !== 'undefined') { return process.env.FORCE_COLOR !== '0'; } return false; }; const create = () => { const colors = { enabled: hasColor(), visible: true, styles: {}, keys: {} }; const ansi = style => { let open = style.open = `\u001b[${style.codes[0]}m`; let close = style.close = `\u001b[${style.codes[1]}m`; let regex = style.regex = new RegExp(`\\u001b\\[${style.codes[1]}m`, 'g'); style.wrap = (input, newline) => { if (input.includes(close)) input = input.replace(regex, close + open); let output = open + input + close; // see https://github.com/chalk/chalk/pull/92, thanks to the // chalk contributors for this fix. However, we've confirmed that // this issue is also present in Windows terminals return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output; }; return style; }; const wrap = (style, input, newline) => { return typeof style === 'function' ? style(input) : style.wrap(input, newline); }; const style = (input, stack) => { if (input === '' || input == null) return ''; if (colors.enabled === false) return input; if (colors.visible === false) return ''; let str = '' + input; let nl = str.includes('\n'); let n = stack.length; if (n > 0 && stack.includes('unstyle')) { stack = [...new Set(['unstyle', ...stack])].reverse(); } while (n-- > 0) str = wrap(colors.styles[stack[n]], str, nl); return str; }; const define = (name, codes, type) => { colors.styles[name] = ansi({ name, codes }); let keys = colors.keys[type] || (colors.keys[type] = []); keys.push(name); Reflect.defineProperty(colors, name, { configurable: true, enumerable: true, set(value) { colors.alias(name, value); }, get() { let color = input => style(input, color.stack); Reflect.setPrototypeOf(color, colors); color.stack = this.stack ? this.stack.concat(name) : [name]; return color; } }); }; define('reset', [0, 0], 'modifier'); define('bold', [1, 22], 'modifier'); define('dim', [2, 22], 'modifier'); define('italic', [3, 23], 'modifier'); define('underline', [4, 24], 'modifier'); define('inverse', [7, 27], 'modifier'); define('hidden', [8, 28], 'modifier'); define('strikethrough', [9, 29], 'modifier'); define('black', [30, 39], 'color'); define('red', [31, 39], 'color'); define('green', [32, 39], 'color'); define('yellow', [33, 39], 'color'); define('blue', [34, 39], 'color'); define('magenta', [35, 39], 'color'); define('cyan', [36, 39], 'color'); define('white', [37, 39], 'color'); define('gray', [90, 39], 'color'); define('grey', [90, 39], 'color'); define('bgBlack', [40, 49], 'bg'); define('bgRed', [41, 49], 'bg'); define('bgGreen', [42, 49], 'bg'); define('bgYellow', [43, 49], 'bg'); define('bgBlue', [44, 49], 'bg'); define('bgMagenta', [45, 49], 'bg'); define('bgCyan', [46, 49], 'bg'); define('bgWhite', [47, 49], 'bg'); define('blackBright', [90, 39], 'bright'); define('redBright', [91, 39], 'bright'); define('greenBright', [92, 39], 'bright'); define('yellowBright', [93, 39], 'bright'); define('blueBright', [94, 39], 'bright'); define('magentaBright', [95, 39], 'bright'); define('cyanBright', [96, 39], 'bright'); define('whiteBright', [97, 39], 'bright'); define('bgBlackBright', [100, 49], 'bgBright'); define('bgRedBright', [101, 49], 'bgBright'); define('bgGreenBright', [102, 49], 'bgBright'); define('bgYellowBright', [103, 49], 'bgBright'); define('bgBlueBright', [104, 49], 'bgBright'); define('bgMagentaBright', [105, 49], 'bgBright'); define('bgCyanBright', [106, 49], 'bgBright'); define('bgWhiteBright', [107, 49], 'bgBright'); colors.ansiRegex = ANSI_REGEX; colors.hasColor = colors.hasAnsi = str => { colors.ansiRegex.lastIndex = 0; return typeof str === 'string' && str !== '' && colors.ansiRegex.test(str); }; colors.alias = (name, color) => { let fn = typeof color === 'string' ? colors[color] : color; if (typeof fn !== 'function') { throw new TypeError('Expected alias to be the name of an existing color (string) or a function'); } if (!fn.stack) { Reflect.defineProperty(fn, 'name', { value: name }); colors.styles[name] = fn; fn.stack = [name]; } Reflect.defineProperty(colors, name, { configurable: true, enumerable: true, set(value) { colors.alias(name, value); }, get() { let color = input => style(input, color.stack); Reflect.setPrototypeOf(color, colors); color.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack; return color; } }); }; colors.theme = custom => { if (!isObject(custom)) throw new TypeError('Expected theme to be an object'); for (let name of Object.keys(custom)) { colors.alias(name, custom[name]); } return colors; }; colors.alias('unstyle', str => { if (typeof str === 'string' && str !== '') { colors.ansiRegex.lastIndex = 0; return str.replace(colors.ansiRegex, ''); } return ''; }); colors.alias('noop', str => str); colors.none = colors.clear = colors.noop; colors.stripColor = colors.unstyle; colors.symbols = requireSymbols(); colors.define = define; return colors; }; ansiColors.exports = create(); var create_1 = ansiColors.exports.create = create; var ansiColorsExports = ansiColors.exports; var index = /*@__PURE__*/getDefaultExportFromCjs(ansiColorsExports); export { create_1 as create, index as default };
233
22
0
24
32
0
10
0
0
0
10
16.636364
2,698
false
setimmediate
top1k-typed-nodeps
6,768
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var setImmediate = {}; // FILE: setImmediate.js (function (global, undefined$1) { if (global.setImmediate) { return; } var nextHandle = 1; // Spec says greater than zero var tasksByHandle = {}; var currentlyRunningATask = false; var doc = global.document; var registerImmediate; function setImmediate(callback) { // Callback can either be a function or a string if (typeof callback !== "function") { callback = new Function("" + callback); } // Copy function arguments var args = new Array(arguments.length - 1); for (var i = 0; i < args.length; i++) { args[i] = arguments[i + 1]; } // Store and register the task var task = { callback: callback, args: args }; tasksByHandle[nextHandle] = task; registerImmediate(nextHandle); return nextHandle++; } function clearImmediate(handle) { delete tasksByHandle[handle]; } function run(task) { var callback = task.callback; var args = task.args; switch (args.length) { case 0: callback(); break; case 1: callback(args[0]); break; case 2: callback(args[0], args[1]); break; case 3: callback(args[0], args[1], args[2]); break; default: callback.apply(undefined$1, args); break; } } function runIfPresent(handle) { // From the spec: "Wait until any invocations of this algorithm started before this one have completed." // So if we're currently running a task, we'll need to delay this invocation. if (currentlyRunningATask) { // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a // "too much recursion" error. setTimeout(runIfPresent, 0, handle); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunningATask = true; try { run(task); } finally { clearImmediate(handle); currentlyRunningATask = false; } } } } function installNextTickImplementation() { registerImmediate = function(handle) { process.nextTick(function () { runIfPresent(handle); }); }; } function canUsePostMessage() { // The test against `importScripts` prevents this implementation from being installed inside a web worker, // where `global.postMessage` means something completely different and can't be used for this purpose. if (global.postMessage && !global.importScripts) { var postMessageIsAsynchronous = true; var oldOnMessage = global.onmessage; global.onmessage = function() { postMessageIsAsynchronous = false; }; global.postMessage("", "*"); global.onmessage = oldOnMessage; return postMessageIsAsynchronous; } } function installPostMessageImplementation() { // Installs an event handler on `global` for the `message` event: see // * https://developer.mozilla.org/en/DOM/window.postMessage // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages var messagePrefix = "setImmediate$" + Math.random() + "$"; var onGlobalMessage = function(event) { if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { runIfPresent(+event.data.slice(messagePrefix.length)); } }; if (global.addEventListener) { global.addEventListener("message", onGlobalMessage, false); } else { global.attachEvent("onmessage", onGlobalMessage); } registerImmediate = function(handle) { global.postMessage(messagePrefix + handle, "*"); }; } function installMessageChannelImplementation() { var channel = new MessageChannel(); channel.port1.onmessage = function(event) { var handle = event.data; runIfPresent(handle); }; registerImmediate = function(handle) { channel.port2.postMessage(handle); }; } function installReadyStateChangeImplementation() { var html = doc.documentElement; registerImmediate = function(handle) { // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. var script = doc.createElement("script"); script.onreadystatechange = function () { runIfPresent(handle); script.onreadystatechange = null; html.removeChild(script); script = null; }; html.appendChild(script); }; } function installSetTimeoutImplementation() { registerImmediate = function(handle) { setTimeout(runIfPresent, 0, handle); }; } // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments. if ({}.toString.call(global.process) === "[object process]") { // For Node.js before 0.9 installNextTickImplementation(); } else if (canUsePostMessage()) { // For non-IE10 modern browsers installPostMessageImplementation(); } else if (global.MessageChannel) { // For web workers, where supported installMessageChannelImplementation(); } else if (doc && "onreadystatechange" in doc.createElement("script")) { // For IE 6–8 installReadyStateChangeImplementation(); } else { // For older browsers installSetTimeoutImplementation(); } attachTo.setImmediate = setImmediate; attachTo.clearImmediate = clearImmediate; }(typeof self === "undefined" ? typeof commonjsGlobal === "undefined" ? commonjsGlobal : commonjsGlobal : self)); export { setImmediate as default };
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var setImmediate = {}; // FILE: setImmediate.js (function (global, undefined$1) { if (global.setImmediate) { return; } var nextHandle = 1; // Spec says greater than zero var tasksByHandle = {}; var currentlyRunningATask = false; var doc = global.document; var registerImmediate; function setImmediate(callback) { // Callback can either be a function or a string if (typeof callback !== "function") { callback = new Function("" + callback); } // Copy function arguments var args = new Array(arguments.length - 1); for (var i = 0; i < args.length; i++) { args[i] = arguments[i + 1]; } // Store and register the task var task = { callback: callback, args: args }; tasksByHandle[nextHandle] = task; registerImmediate(nextHandle); return nextHandle++; } function clearImmediate(handle) { delete tasksByHandle[handle]; } function run(task) { var callback = task.callback; var args = task.args; switch (args.length) { case 0: callback(); break; case 1: callback(args[0]); break; case 2: callback(args[0], args[1]); break; case 3: callback(args[0], args[1], args[2]); break; default: callback.apply(undefined$1, args); break; } } function runIfPresent(handle) { // From the spec: "Wait until any invocations of this algorithm started before this one have completed." // So if we're currently running a task, we'll need to delay this invocation. if (currentlyRunningATask) { // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a // "too much recursion" error. setTimeout(runIfPresent, 0, handle); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunningATask = true; try { run(task); } finally { clearImmediate(handle); currentlyRunningATask = false; } } } } function installNextTickImplementation() { registerImmediate = function(handle) { process.nextTick(function () { runIfPresent(handle); }); }; } function canUsePostMessage() { // The test against `importScripts` prevents this implementation from being installed inside a web worker, // where `global.postMessage` means something completely different and can't be used for this purpose. if (global.postMessage && !global.importScripts) { var postMessageIsAsynchronous = true; var oldOnMessage = global.onmessage; global.onmessage = function() { postMessageIsAsynchronous = false; }; global.postMessage("", "*"); global.onmessage = oldOnMessage; return postMessageIsAsynchronous; } } function installPostMessageImplementation() { // Installs an event handler on `global` for the `message` event: see // * https://developer.mozilla.org/en/DOM/window.postMessage // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages var messagePrefix = "setImmediate$" + Math.random() + "$"; var onGlobalMessage = function(event) { if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { runIfPresent(+event.data.slice(messagePrefix.length)); } }; if (global.addEventListener) { global.addEventListener("message", onGlobalMessage, false); } else { global.attachEvent("onmessage", onGlobalMessage); } registerImmediate = function(handle) { global.postMessage(messagePrefix + handle, "*"); }; } function installMessageChannelImplementation() { var channel = new MessageChannel(); channel.port1.onmessage = function(event) { var handle = event.data; runIfPresent(handle); }; registerImmediate = function(handle) { channel.port2.postMessage(handle); }; } function installReadyStateChangeImplementation() { var html = doc.documentElement; registerImmediate = function(handle) { // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. var script = doc.createElement("script"); script.onreadystatechange = function () { runIfPresent(handle); script.onreadystatechange = null; html.removeChild(script); script = null; }; html.appendChild(script); }; } function installSetTimeoutImplementation() { registerImmediate = function(handle) { setTimeout(runIfPresent, 0, handle); }; } // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments. if ({}.toString.call(global.process) === "[object process]") { // For Node.js before 0.9 installNextTickImplementation(); } else if (canUsePostMessage()) { // For non-IE10 modern browsers installPostMessageImplementation(); } else if (global.MessageChannel) { // For web workers, where supported installMessageChannelImplementation(); } else if (doc && "onreadystatechange" in doc.createElement("script")) { // For IE 6–8 installReadyStateChangeImplementation(); } else { // For older browsers installSetTimeoutImplementation(); } attachTo.setImmediate = setImmediate; attachTo.clearImmediate = clearImmediate; }(typeof self === "undefined" ? typeof commonjsGlobal === "undefined" ? commonjsGlobal : commonjsGlobal : self)); export { setImmediate as default };
144
21
0
13
22
0
10
0
0
0
8
12.380952
1,446
false
source-map-url
top1k-untyped-nodeps
1,713
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var sourceMapUrl$1 = {exports: {}}; // FILE: source-map-url.js (function (module, exports) { // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) void (function(root, factory) { { module.exports = factory(); } }(commonjsGlobal, function() { var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/; var regex = RegExp( "(?:" + "/\\*" + "(?:\\s*\r?\n(?://)?)?" + "(?:" + innerRegex.source + ")" + "\\s*" + "\\*/" + "|" + "//(?:" + innerRegex.source + ")" + ")" + "\\s*" ); return { regex: regex, _innerRegex: innerRegex, getFrom: function(code) { var match = code.match(regex); return (match ? match[1] || match[2] || "" : null) }, existsIn: function(code) { return regex.test(code) }, removeFrom: function(code) { return code.replace(regex, "") }, insertBefore: function(code, string) { var match = code.match(regex); if (match) { return code.slice(0, match.index) + string + code.slice(match.index) } else { return code + string } } } })); } (sourceMapUrl$1)); var sourceMapUrlExports = sourceMapUrl$1.exports; var sourceMapUrl = /*@__PURE__*/getDefaultExportFromCjs(sourceMapUrlExports); export { sourceMapUrl as default };
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var sourceMapUrl$1 = {exports: {}}; // FILE: source-map-url.js (function (module, exports) { // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) void (function(root, factory) { { module.exports = factory(); } }(commonjsGlobal, function() { var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/; var regex = RegExp( "(?:" + "/\\*" + "(?:\\s*\r?\n(?://)?)?" + "(?:" + innerRegex.source + ")" + "\\s*" + "\\*/" + "|" + "//(?:" + innerRegex.source + ")" + ")" + "\\s*" ); return { regex: regex, _innerRegex: innerRegex, getFrom: function(code) { var match = code.match(regex); return (match ? match[1] || match[2] || "" : null) }, existsIn: function(code) { return regex.test(code) }, removeFrom: function(code) { return code.replace(regex, "") }, insertBefore: function(code, string) { var match = code.match(regex); if (match) { return code.slice(0, match.index) + string + code.slice(match.index) } else { return code + string } } } })); } (sourceMapUrl$1)); var sourceMapUrlExports = sourceMapUrl$1.exports; var sourceMapUrl = /*@__PURE__*/getDefaultExportFromCjs(sourceMapUrlExports); export { sourceMapUrl as default };
51
8
0
10
8
0
1
0
0
0
4
11.25
494
true
which
top1k-typed-with-typed-deps
3,508
import require$$0 from 'path'; import require$$1 from 'isexe'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: which.js const isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys'; const path = require$$0; const COLON = isWindows ? ';' : ':'; const isexe = require$$1; const getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }); const getPathInfo = (cmd, opt) => { const colon = opt.colon || COLON; // If it has a slash, then we don't bother searching the pathenv. // just check the file itself, and that's it. const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] : ( [ // windows always checks the cwd first ...(isWindows ? [process.cwd()] : []), ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */ '').split(colon), ] ); const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : ''; const pathExt = isWindows ? pathExtExe.split(colon) : ['']; if (isWindows) { if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift(''); } return { pathEnv, pathExt, pathExtExe, } }; const which = (cmd, opt, cb) => { if (typeof opt === 'function') { cb = opt; opt = {}; } if (!opt) opt = {}; const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); const found = []; const step = i => new Promise((resolve, reject) => { if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd)) const ppRaw = pathEnv[i]; const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; const pCmd = path.join(pathPart, cmd); const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; resolve(subStep(p, i, 0)); }); const subStep = (p, i, ii) => new Promise((resolve, reject) => { if (ii === pathExt.length) return resolve(step(i + 1)) const ext = pathExt[ii]; isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { if (!er && is) { if (opt.all) found.push(p + ext); else return resolve(p + ext) } return resolve(subStep(p, i, ii + 1)) }); }); return cb ? step(0).then(res => cb(null, res), cb) : step(0) }; const whichSync = (cmd, opt) => { opt = opt || {}; const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); const found = []; for (let i = 0; i < pathEnv.length; i ++) { const ppRaw = pathEnv[i]; const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; const pCmd = path.join(pathPart, cmd); const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; for (let j = 0; j < pathExt.length; j ++) { const cur = p + pathExt[j]; try { const is = isexe.sync(cur, { pathExt: pathExtExe }); if (is) { if (opt.all) found.push(cur); else return cur } } catch (ex) {} } } if (opt.all && found.length) return found if (opt.nothrow) return null throw getNotFoundError(cmd) }; var which_1 = which; which.sync = whichSync; var which$1 = /*@__PURE__*/getDefaultExportFromCjs(which_1); export { which$1 as default };
import require$$0 from 'path'; import require$$1 from 'isexe'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: which.js const isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys'; const path = require$$0; const COLON = isWindows ? ';' : ':'; const isexe = require$$1; const getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }); const getPathInfo = (cmd, opt) => { const colon = opt.colon || COLON; // If it has a slash, then we don't bother searching the pathenv. // just check the file itself, and that's it. const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] : ( [ // windows always checks the cwd first ...(isWindows ? [process.cwd()] : []), ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */ '').split(colon), ] ); const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : ''; const pathExt = isWindows ? pathExtExe.split(colon) : ['']; if (isWindows) { if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift(''); } return { pathEnv, pathExt, pathExtExe, } }; const which = (cmd, opt, cb) => { if (typeof opt === 'function') { cb = opt; opt = {}; } if (!opt) opt = {}; const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); const found = []; const step = i => new Promise((resolve, reject) => { if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd)) const ppRaw = pathEnv[i]; const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; const pCmd = path.join(pathPart, cmd); const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; resolve(subStep(p, i, 0)); }); const subStep = (p, i, ii) => new Promise((resolve, reject) => { if (ii === pathExt.length) return resolve(step(i + 1)) const ext = pathExt[ii]; isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { if (!er && is) { if (opt.all) found.push(p + ext); else return resolve(p + ext) } return resolve(subStep(p, i, ii + 1)) }); }); return cb ? step(0).then(res => cb(null, res), cb) : step(0) }; const whichSync = (cmd, opt) => { opt = opt || {}; const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); const found = []; for (let i = 0; i < pathEnv.length; i ++) { const ppRaw = pathEnv[i]; const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; const pCmd = path.join(pathPart, cmd); const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; for (let j = 0; j < pathExt.length; j ++) { const cur = p + pathExt[j]; try { const is = isexe.sync(cur, { pathExt: pathExtExe }); if (is) { if (opt.all) found.push(cur); else return cur } } catch (ex) {} } } if (opt.all && found.length) return found if (opt.nothrow) return null throw getNotFoundError(cmd) }; var which_1 = which; which.sync = whichSync; var which$1 = /*@__PURE__*/getDefaultExportFromCjs(which_1); export { which$1 as default };
106
11
0
20
33
0
5
0
0
0
1
12.636364
1,135
true
acorn-import-assertions
top1k-untyped-nodeps
7,561
import * as _acorn from 'acorn'; // FILE: src/index.js const leftCurlyBrace = "{".charCodeAt(0); const space = " ".charCodeAt(0); const keyword = "assert"; const FUNC_STATEMENT = 1, FUNC_NULLABLE_ID = 4; function importAssertions(Parser) { // Use supplied version acorn version if present, to avoid // reference mismatches due to different acorn versions. This // allows this plugin to be used with Rollup which supplies // its own internal version of acorn and thereby sidesteps // the package manager. const acorn = Parser.acorn || _acorn; const { tokTypes: tt, TokenType } = acorn; return class extends Parser { constructor(...args) { super(...args); this.assertToken = new TokenType(keyword); } _codeAt(i) { return this.input.charCodeAt(i); } _eat(t) { if (this.type !== t) { this.unexpected(); } this.next(); } readToken(code) { let i = 0; for (; i < keyword.length; i++) { if (this._codeAt(this.pos + i) !== keyword.charCodeAt(i)) { return super.readToken(code); } } // ensure that the keyword is at the correct location // ie `assert{...` or `assert {...` for (;; i++) { if (this._codeAt(this.pos + i) === leftCurlyBrace) { // Found '{' break; } else if (this._codeAt(this.pos + i) === space) { // white space is allowed between `assert` and `{`, so continue. continue; } else { return super.readToken(code); } } // If we're inside a dynamic import expression we'll parse // the `assert` keyword as a standard object property name // ie `import(""./foo.json", { assert: { type: "json" } })` if (this.type.label === "{") { return super.readToken(code); } this.pos += keyword.length; return this.finishToken(this.assertToken); } parseDynamicImport(node) { this.next(); // skip `(` // Parse node.source. node.source = this.parseMaybeAssign(); if (this.eat(tt.comma)) { const obj = this.parseObj(false); node.arguments = [obj]; } this._eat(tt.parenR); return this.finishNode(node, "ImportExpression"); } // ported from acorn/src/statement.js pp.parseExport parseExport(node, exports) { this.next(); // export * from '...' if (this.eat(tt.star)) { if (this.options.ecmaVersion >= 11) { if (this.eatContextual("as")) { node.exported = this.parseIdent(true); this.checkExport(exports, node.exported.name, this.lastTokStart); } else { node.exported = null; } } this.expectContextual("from"); if (this.type !== tt.string) { this.unexpected(); } node.source = this.parseExprAtom(); if (this.type === this.assertToken) { this.next(); const assertions = this.parseImportAssertions(); if (assertions) { node.assertions = assertions; } } this.semicolon(); return this.finishNode(node, "ExportAllDeclaration") } if (this.eat(tt._default)) { // export default ... this.checkExport(exports, "default", this.lastTokStart); var isAsync; if (this.type === tt._function || (isAsync = this.isAsyncFunction())) { var fNode = this.startNode(); this.next(); if (isAsync) { this.next(); } node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); } else if (this.type === tt._class) { var cNode = this.startNode(); node.declaration = this.parseClass(cNode, "nullableID"); } else { node.declaration = this.parseMaybeAssign(); this.semicolon(); } return this.finishNode(node, "ExportDefaultDeclaration") } // export var|const|let|function|class ... if (this.shouldParseExportStatement()) { node.declaration = this.parseStatement(null); if (node.declaration.type === "VariableDeclaration") { this.checkVariableExport(exports, node.declaration.declarations); } else { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); } node.specifiers = []; node.source = null; } else { // export { x, y as z } [from '...'] node.declaration = null; node.specifiers = this.parseExportSpecifiers(exports); if (this.eatContextual("from")) { if (this.type !== tt.string) { this.unexpected(); } node.source = this.parseExprAtom(); if (this.type === this.assertToken) { this.next(); const assertions = this.parseImportAssertions(); if (assertions) { node.assertions = assertions; } } } else { for (var i = 0, list = node.specifiers; i < list.length; i += 1) { // check for keywords used as local names var spec = list[i]; this.checkUnreserved(spec.local); // check if export is defined this.checkLocalExport(spec.local); } node.source = null; } this.semicolon(); } return this.finishNode(node, "ExportNamedDeclaration") } parseImport(node) { this.next(); // import '...' if (this.type === tt.string) { node.specifiers = []; node.source = this.parseExprAtom(); } else { node.specifiers = this.parseImportSpecifiers(); this.expectContextual("from"); node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected(); } if (this.type === this.assertToken) { this.next(); const assertions = this.parseImportAssertions(); if (assertions) { node.assertions = assertions; } } this.semicolon(); return this.finishNode(node, "ImportDeclaration"); } parseImportAssertions() { this._eat(tt.braceL); const attrs = this.parseAssertEntries(); this._eat(tt.braceR); return attrs; } parseAssertEntries() { const attrs = []; const attrNames = new Set(); do { if (this.type === tt.braceR) { break; } const node = this.startNode(); // parse AssertionKey : IdentifierName, StringLiteral let assertionKeyNode; if (this.type === tt.string) { assertionKeyNode = this.parseLiteral(this.value); } else { assertionKeyNode = this.parseIdent(true); } this.next(); node.key = assertionKeyNode; // check if we already have an entry for an attribute // if a duplicate entry is found, throw an error // for now this logic will come into play only when someone declares `type` twice if (attrNames.has(node.key.name)) { this.raise(this.pos, "Duplicated key in assertions"); } attrNames.add(node.key.name); if (this.type !== tt.string) { this.raise( this.pos, "Only string is supported as an assertion value" ); } node.value = this.parseLiteral(this.value); attrs.push(this.finishNode(node, "ImportAttribute")); } while (this.eat(tt.comma)); return attrs; } }; } export { importAssertions };
import * as _acorn from 'acorn'; // FILE: src/index.js const leftCurlyBrace = "{".charCodeAt(0); const space = " ".charCodeAt(0); const keyword = "assert"; const FUNC_STATEMENT = 1, FUNC_NULLABLE_ID = 4; function importAssertions(Parser) { // Use supplied version acorn version if present, to avoid // reference mismatches due to different acorn versions. This // allows this plugin to be used with Rollup which supplies // its own internal version of acorn and thereby sidesteps // the package manager. const acorn = Parser.acorn || _acorn; const { tokTypes: tt, TokenType } = acorn; return class extends Parser { constructor(...args) { super(...args); this.assertToken = new TokenType(keyword); } _codeAt(i) { return this.input.charCodeAt(i); } _eat(t) { if (this.type !== t) { this.unexpected(); } this.next(); } readToken(code) { let i = 0; for (; i < keyword.length; i++) { if (this._codeAt(this.pos + i) !== keyword.charCodeAt(i)) { return super.readToken(code); } } // ensure that the keyword is at the correct location // ie `assert{...` or `assert {...` for (;; i++) { if (this._codeAt(this.pos + i) === leftCurlyBrace) { // Found '{' break; } else if (this._codeAt(this.pos + i) === space) { // white space is allowed between `assert` and `{`, so continue. continue; } else { return super.readToken(code); } } // If we're inside a dynamic import expression we'll parse // the `assert` keyword as a standard object property name // ie `import(""./foo.json", { assert: { type: "json" } })` if (this.type.label === "{") { return super.readToken(code); } this.pos += keyword.length; return this.finishToken(this.assertToken); } parseDynamicImport(node) { this.next(); // skip `(` // Parse node.source. node.source = this.parseMaybeAssign(); if (this.eat(tt.comma)) { const obj = this.parseObj(false); node.arguments = [obj]; } this._eat(tt.parenR); return this.finishNode(node, "ImportExpression"); } // ported from acorn/src/statement.js pp.parseExport parseExport(node, exports) { this.next(); // export * from '...' if (this.eat(tt.star)) { if (this.options.ecmaVersion >= 11) { if (this.eatContextual("as")) { node.exported = this.parseIdent(true); this.checkExport(exports, node.exported.name, this.lastTokStart); } else { node.exported = null; } } this.expectContextual("from"); if (this.type !== tt.string) { this.unexpected(); } node.source = this.parseExprAtom(); if (this.type === this.assertToken) { this.next(); const assertions = this.parseImportAssertions(); if (assertions) { node.assertions = assertions; } } this.semicolon(); return this.finishNode(node, "ExportAllDeclaration") } if (this.eat(tt._default)) { // export default ... this.checkExport(exports, "default", this.lastTokStart); var isAsync; if (this.type === tt._function || (isAsync = this.isAsyncFunction())) { var fNode = this.startNode(); this.next(); if (isAsync) { this.next(); } node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); } else if (this.type === tt._class) { var cNode = this.startNode(); node.declaration = this.parseClass(cNode, "nullableID"); } else { node.declaration = this.parseMaybeAssign(); this.semicolon(); } return this.finishNode(node, "ExportDefaultDeclaration") } // export var|const|let|function|class ... if (this.shouldParseExportStatement()) { node.declaration = this.parseStatement(null); if (node.declaration.type === "VariableDeclaration") { this.checkVariableExport(exports, node.declaration.declarations); } else { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); } node.specifiers = []; node.source = null; } else { // export { x, y as z } [from '...'] node.declaration = null; node.specifiers = this.parseExportSpecifiers(exports); if (this.eatContextual("from")) { if (this.type !== tt.string) { this.unexpected(); } node.source = this.parseExprAtom(); if (this.type === this.assertToken) { this.next(); const assertions = this.parseImportAssertions(); if (assertions) { node.assertions = assertions; } } } else { for (var i = 0, list = node.specifiers; i < list.length; i += 1) { // check for keywords used as local names var spec = list[i]; this.checkUnreserved(spec.local); // check if export is defined this.checkLocalExport(spec.local); } node.source = null; } this.semicolon(); } return this.finishNode(node, "ExportNamedDeclaration") } parseImport(node) { this.next(); // import '...' if (this.type === tt.string) { node.specifiers = []; node.source = this.parseExprAtom(); } else { node.specifiers = this.parseImportSpecifiers(); this.expectContextual("from"); node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected(); } if (this.type === this.assertToken) { this.next(); const assertions = this.parseImportAssertions(); if (assertions) { node.assertions = assertions; } } this.semicolon(); return this.finishNode(node, "ImportDeclaration"); } parseImportAssertions() { this._eat(tt.braceL); const attrs = this.parseAssertEntries(); this._eat(tt.braceR); return attrs; } parseAssertEntries() { const attrs = []; const attrNames = new Set(); do { if (this.type === tt.braceR) { break; } const node = this.startNode(); // parse AssertionKey : IdentifierName, StringLiteral let assertionKeyNode; if (this.type === tt.string) { assertionKeyNode = this.parseLiteral(this.value); } else { assertionKeyNode = this.parseIdent(true); } this.next(); node.key = assertionKeyNode; // check if we already have an entry for an attribute // if a duplicate entry is found, throw an error // for now this logic will come into play only when someone declares `type` twice if (attrNames.has(node.key.name)) { this.raise(this.pos, "Duplicated key in assertions"); } attrNames.add(node.key.name); if (this.type !== tt.string) { this.raise( this.pos, "Only string is supported as an assertion value" ); } node.value = this.parseLiteral(this.value); attrs.push(this.finishNode(node, "ImportAttribute")); } while (this.eat(tt.comma)); return attrs; } }; } export { importAssertions };
189
10
0
9
23
0
5
0
0
0
0
34
1,898
false
through2
top1k-typed-with-typed-deps
2,318
import require$$0 from 'readable-stream'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var through2$2 = {exports: {}}; // FILE: through2.js const { Transform } = require$$0; function inherits (fn, sup) { fn.super_ = sup; fn.prototype = Object.create(sup.prototype, { constructor: { value: fn, enumerable: false, writable: true, configurable: true } }); } // create a new export function, used by both the main export and // the .ctor export, contains common logic for dealing with arguments function through2 (construct) { return (options, transform, flush) => { if (typeof options === 'function') { flush = transform; transform = options; options = {}; } if (typeof transform !== 'function') { // noop transform = (chunk, enc, cb) => cb(null, chunk); } if (typeof flush !== 'function') { flush = null; } return construct(options, transform, flush) } } // main export, just make me a transform stream! const make = through2((options, transform, flush) => { const t2 = new Transform(options); t2._transform = transform; if (flush) { t2._flush = flush; } return t2 }); // make me a reusable prototype that I can `new`, or implicitly `new` // with a constructor call const ctor = through2((options, transform, flush) => { function Through2 (override) { if (!(this instanceof Through2)) { return new Through2(override) } this.options = Object.assign({}, options, override); Transform.call(this, this.options); this._transform = transform; if (flush) { this._flush = flush; } } inherits(Through2, Transform); return Through2 }); const obj = through2(function (options, transform, flush) { const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options)); t2._transform = transform; if (flush) { t2._flush = flush; } return t2 }); through2$2.exports = make; var ctor_1 = through2$2.exports.ctor = ctor; var obj_1 = through2$2.exports.obj = obj; var through2Exports = through2$2.exports; var through2$1 = /*@__PURE__*/getDefaultExportFromCjs(through2Exports); export { ctor_1 as ctor, through2$1 as default, obj_1 as obj };
import require$$0 from 'readable-stream'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var through2$2 = {exports: {}}; // FILE: through2.js const { Transform } = require$$0; function inherits (fn, sup) { fn.super_ = sup; fn.prototype = Object.create(sup.prototype, { constructor: { value: fn, enumerable: false, writable: true, configurable: true } }); } // create a new export function, used by both the main export and // the .ctor export, contains common logic for dealing with arguments function through2 (construct) { return (options, transform, flush) => { if (typeof options === 'function') { flush = transform; transform = options; options = {}; } if (typeof transform !== 'function') { // noop transform = (chunk, enc, cb) => cb(null, chunk); } if (typeof flush !== 'function') { flush = null; } return construct(options, transform, flush) } } // main export, just make me a transform stream! const make = through2((options, transform, flush) => { const t2 = new Transform(options); t2._transform = transform; if (flush) { t2._flush = flush; } return t2 }); // make me a reusable prototype that I can `new`, or implicitly `new` // with a constructor call const ctor = through2((options, transform, flush) => { function Through2 (override) { if (!(this instanceof Through2)) { return new Through2(override) } this.options = Object.assign({}, options, override); Transform.call(this, this.options); this._transform = transform; if (flush) { this._flush = flush; } } inherits(Through2, Transform); return Through2 }); const obj = through2(function (options, transform, flush) { const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options)); t2._transform = transform; if (flush) { t2._flush = flush; } return t2 }); through2$2.exports = make; var ctor_1 = through2$2.exports.ctor = ctor; var obj_1 = through2$2.exports.obj = obj; var through2Exports = through2$2.exports; var through2$1 = /*@__PURE__*/getDefaultExportFromCjs(through2Exports); export { ctor_1 as ctor, through2$1 as default, obj_1 as obj };
65
9
0
20
11
0
3
0
0
0
4
7.333333
662
false
asynckit
top1k-untyped-nodeps
8,630
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/defer.js var defer_1 = defer$1; /** * Runs provided function on next iteration of the event loop * * @param {function} fn - function to run */ function defer$1(fn) { var nextTick = typeof setImmediate == 'function' ? setImmediate : ( typeof process == 'object' && typeof process.nextTick == 'function' ? process.nextTick : null ); if (nextTick) { nextTick(fn); } else { setTimeout(fn, 0); } } // FILE: lib/async.js var defer = defer_1; // API var async_1 = async$2; /** * Runs provided callback asynchronously * even if callback itself is not * * @param {function} callback - callback to invoke * @returns {function} - augmented callback */ function async$2(callback) { var isAsync = false; // check if async happened defer(function() { isAsync = true; }); return function async_callback(err, result) { if (isAsync) { callback(err, result); } else { defer(function nextTick_callback() { callback(err, result); }); } }; } // FILE: lib/abort.js // API var abort_1 = abort$2; /** * Aborts leftover active jobs * * @param {object} state - current state object */ function abort$2(state) { Object.keys(state.jobs).forEach(clean.bind(state)); // reset leftover jobs state.jobs = {}; } /** * Cleans up leftover job by invoking abort function for the provided job id * * @this state * @param {string|number} key - job id to abort */ function clean(key) { if (typeof this.jobs[key] == 'function') { this.jobs[key](); } } // FILE: lib/iterate.js var async$1 = async_1 , abort$1 = abort_1 ; // API var iterate_1 = iterate$2; /** * Iterates over each job object * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {object} state - current job status * @param {function} callback - invoked when all elements processed */ function iterate$2(list, iterator, state, callback) { // store current index var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; state.jobs[key] = runJob(iterator, key, list[key], function(error, output) { // don't repeat yourself // skip secondary callbacks if (!(key in state.jobs)) { return; } // clean up jobs delete state.jobs[key]; if (error) { // don't process rest of the results // stop still active jobs // and reset the list abort$1(state); } else { state.results[key] = output; } // return salvaged results callback(error, state.results); }); } /** * Runs iterator over provided job element * * @param {function} iterator - iterator to invoke * @param {string|number} key - key/index of the element in the list of jobs * @param {mixed} item - job description * @param {function} callback - invoked after iterator is done with the job * @returns {function|mixed} - job abort function or something else */ function runJob(iterator, key, item, callback) { var aborter; // allow shortcut if iterator expects only two arguments if (iterator.length == 2) { aborter = iterator(item, async$1(callback)); } // otherwise go with full three arguments else { aborter = iterator(item, key, async$1(callback)); } return aborter; } // FILE: lib/state.js // API var state_1 = state; /** * Creates initial state object * for iteration over list * * @param {array|object} list - list to iterate over * @param {function|null} sortMethod - function to use for keys sort, * or `null` to keep them as is * @returns {object} - initial state object */ function state(list, sortMethod) { var isNamedList = !Array.isArray(list) , initState = { index : 0, keyedList: isNamedList || sortMethod ? Object.keys(list) : null, jobs : {}, results : isNamedList ? {} : [], size : isNamedList ? Object.keys(list).length : list.length } ; if (sortMethod) { // sort array keys based on it's values // sort object's keys just on own merit initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) { return sortMethod(list[a], list[b]); }); } return initState; } // FILE: lib/terminator.js var abort = abort_1 , async = async_1 ; // API var terminator_1 = terminator$2; /** * Terminates jobs in the attached state context * * @this AsyncKitState# * @param {function} callback - final callback to invoke after termination */ function terminator$2(callback) { if (!Object.keys(this.jobs).length) { return; } // fast forward iteration index this.index = this.size; // abort jobs abort(this); // send back results we have so far async(callback)(null, this.results); } // FILE: parallel.js var iterate$1 = iterate_1 , initState$1 = state_1 , terminator$1 = terminator_1 ; // Public API var parallel_1 = parallel; /** * Runs iterator over provided array elements in parallel * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {function} callback - invoked when all elements processed * @returns {function} - jobs terminator */ function parallel(list, iterator, callback) { var state = initState$1(list); while (state.index < (state['keyedList'] || list).length) { iterate$1(list, iterator, state, function(error, result) { if (error) { callback(error, result); return; } // looks like it's the last one if (Object.keys(state.jobs).length === 0) { callback(null, state.results); return; } }); state.index++; } return terminator$1.bind(state, callback); } var serialOrdered$2 = {exports: {}}; // FILE: serialOrdered.js var iterate = iterate_1 , initState = state_1 , terminator = terminator_1 ; // Public API serialOrdered$2.exports = serialOrdered$1; // sorting helpers serialOrdered$2.exports.ascending = ascending; serialOrdered$2.exports.descending = descending; /** * Runs iterator over provided sorted array elements in series * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {function} sortMethod - custom sort function * @param {function} callback - invoked when all elements processed * @returns {function} - jobs terminator */ function serialOrdered$1(list, iterator, sortMethod, callback) { var state = initState(list, sortMethod); iterate(list, iterator, state, function iteratorHandler(error, result) { if (error) { callback(error, result); return; } state.index++; // are we there yet? if (state.index < (state['keyedList'] || list).length) { iterate(list, iterator, state, iteratorHandler); return; } // done here callback(null, state.results); }); return terminator.bind(state, callback); } /* * -- Sort methods */ /** * sort helper to sort array elements in ascending order * * @param {mixed} a - an item to compare * @param {mixed} b - an item to compare * @returns {number} - comparison result */ function ascending(a, b) { return a < b ? -1 : a > b ? 1 : 0; } /** * sort helper to sort array elements in descending order * * @param {mixed} a - an item to compare * @param {mixed} b - an item to compare * @returns {number} - comparison result */ function descending(a, b) { return -1 * ascending(a, b); } var serialOrderedExports = serialOrdered$2.exports; // FILE: serial.js var serialOrdered = serialOrderedExports; // Public API var serial_1 = serial; /** * Runs iterator over provided array elements in series * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {function} callback - invoked when all elements processed * @returns {function} - jobs terminator */ function serial(list, iterator, callback) { return serialOrdered(list, iterator, null, callback); } // FILE: index.js var asynckit = { parallel : parallel_1, serial : serial_1, serialOrdered : serialOrderedExports }; var index = /*@__PURE__*/getDefaultExportFromCjs(asynckit); export { index as default };
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/defer.js var defer_1 = defer$1; /** * Runs provided function on next iteration of the event loop * * @param {function} fn - function to run */ function defer$1(fn) { var nextTick = typeof setImmediate == 'function' ? setImmediate : ( typeof process == 'object' && typeof process.nextTick == 'function' ? process.nextTick : null ); if (nextTick) { nextTick(fn); } else { setTimeout(fn, 0); } } // FILE: lib/async.js var defer = defer_1; // API var async_1 = async$2; /** * Runs provided callback asynchronously * even if callback itself is not * * @param {function} callback - callback to invoke * @returns {function} - augmented callback */ function async$2(callback) { var isAsync = false; // check if async happened defer(function() { isAsync = true; }); return function async_callback(err, result) { if (isAsync) { callback(err, result); } else { defer(function nextTick_callback() { callback(err, result); }); } }; } // FILE: lib/abort.js // API var abort_1 = abort$2; /** * Aborts leftover active jobs * * @param {object} state - current state object */ function abort$2(state) { Object.keys(state.jobs).forEach(clean.bind(state)); // reset leftover jobs state.jobs = {}; } /** * Cleans up leftover job by invoking abort function for the provided job id * * @this state * @param {string|number} key - job id to abort */ function clean(key) { if (typeof this.jobs[key] == 'function') { this.jobs[key](); } } // FILE: lib/iterate.js var async$1 = async_1 , abort$1 = abort_1 ; // API var iterate_1 = iterate$2; /** * Iterates over each job object * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {object} state - current job status * @param {function} callback - invoked when all elements processed */ function iterate$2(list, iterator, state, callback) { // store current index var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; state.jobs[key] = runJob(iterator, key, list[key], function(error, output) { // don't repeat yourself // skip secondary callbacks if (!(key in state.jobs)) { return; } // clean up jobs delete state.jobs[key]; if (error) { // don't process rest of the results // stop still active jobs // and reset the list abort$1(state); } else { state.results[key] = output; } // return salvaged results callback(error, state.results); }); } /** * Runs iterator over provided job element * * @param {function} iterator - iterator to invoke * @param {string|number} key - key/index of the element in the list of jobs * @param {mixed} item - job description * @param {function} callback - invoked after iterator is done with the job * @returns {function|mixed} - job abort function or something else */ function runJob(iterator, key, item, callback) { var aborter; // allow shortcut if iterator expects only two arguments if (iterator.length == 2) { aborter = iterator(item, async$1(callback)); } // otherwise go with full three arguments else { aborter = iterator(item, key, async$1(callback)); } return aborter; } // FILE: lib/state.js // API var state_1 = state; /** * Creates initial state object * for iteration over list * * @param {array|object} list - list to iterate over * @param {function|null} sortMethod - function to use for keys sort, * or `null` to keep them as is * @returns {object} - initial state object */ function state(list, sortMethod) { var isNamedList = !Array.isArray(list) , initState = { index : 0, keyedList: isNamedList || sortMethod ? Object.keys(list) : null, jobs : {}, results : isNamedList ? {} : [], size : isNamedList ? Object.keys(list).length : list.length } ; if (sortMethod) { // sort array keys based on it's values // sort object's keys just on own merit initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) { return sortMethod(list[a], list[b]); }); } return initState; } // FILE: lib/terminator.js var abort = abort_1 , async = async_1 ; // API var terminator_1 = terminator$2; /** * Terminates jobs in the attached state context * * @this AsyncKitState# * @param {function} callback - final callback to invoke after termination */ function terminator$2(callback) { if (!Object.keys(this.jobs).length) { return; } // fast forward iteration index this.index = this.size; // abort jobs abort(this); // send back results we have so far async(callback)(null, this.results); } // FILE: parallel.js var iterate$1 = iterate_1 , initState$1 = state_1 , terminator$1 = terminator_1 ; // Public API var parallel_1 = parallel; /** * Runs iterator over provided array elements in parallel * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {function} callback - invoked when all elements processed * @returns {function} - jobs terminator */ function parallel(list, iterator, callback) { var state = initState$1(list); while (state.index < (state['keyedList'] || list).length) { iterate$1(list, iterator, state, function(error, result) { if (error) { callback(error, result); return; } // looks like it's the last one if (Object.keys(state.jobs).length === 0) { callback(null, state.results); return; } }); state.index++; } return terminator$1.bind(state, callback); } var serialOrdered$2 = {exports: {}}; // FILE: serialOrdered.js var iterate = iterate_1 , initState = state_1 , terminator = terminator_1 ; // Public API serialOrdered$2.exports = serialOrdered$1; // sorting helpers serialOrdered$2.exports.ascending = ascending; serialOrdered$2.exports.descending = descending; /** * Runs iterator over provided sorted array elements in series * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {function} sortMethod - custom sort function * @param {function} callback - invoked when all elements processed * @returns {function} - jobs terminator */ function serialOrdered$1(list, iterator, sortMethod, callback) { var state = initState(list, sortMethod); iterate(list, iterator, state, function iteratorHandler(error, result) { if (error) { callback(error, result); return; } state.index++; // are we there yet? if (state.index < (state['keyedList'] || list).length) { iterate(list, iterator, state, iteratorHandler); return; } // done here callback(null, state.results); }); return terminator.bind(state, callback); } /* * -- Sort methods */ /** * sort helper to sort array elements in ascending order * * @param {mixed} a - an item to compare * @param {mixed} b - an item to compare * @returns {number} - comparison result */ function ascending(a, b) { return a < b ? -1 : a > b ? 1 : 0; } /** * sort helper to sort array elements in descending order * * @param {mixed} a - an item to compare * @param {mixed} b - an item to compare * @returns {number} - comparison result */ function descending(a, b) { return -1 * ascending(a, b); } var serialOrderedExports = serialOrdered$2.exports; // FILE: serial.js var serialOrdered = serialOrderedExports; // Public API var serial_1 = serial; /** * Runs iterator over provided array elements in series * * @param {array|object} list - array or object (named list) to iterate over * @param {function} iterator - iterator to run * @param {function} callback - invoked when all elements processed * @returns {function} - jobs terminator */ function serial(list, iterator, callback) { return serialOrdered(list, iterator, null, callback); } // FILE: index.js var asynckit = { parallel : parallel_1, serial : serial_1, serialOrdered : serialOrderedExports }; var index = /*@__PURE__*/getDefaultExportFromCjs(asynckit); export { index as default };
208
21
0
40
32
0
3
0
0
0
4
8.571429
2,474
false
glob-parent
top1k-typed-with-typed-deps
1,932
import require$$0 from 'is-glob'; import require$$1 from 'path'; import require$$2 from 'os'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: index.js var isGlob = require$$0; var pathPosixDirname = require$$1.posix.dirname; var isWin32 = require$$2.platform() === 'win32'; var slash = '/'; var backslash = /\\/g; var escaped = /\\([!*?|[\](){}])/g; /** * @param {string} str * @param {Object} opts * @param {boolean} [opts.flipBackslashes=true] */ var globParent = function globParent(str, opts) { var options = Object.assign({ flipBackslashes: true }, opts); // flip windows path separators if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { str = str.replace(backslash, slash); } // special case for strings ending in enclosure containing path separator if (isEnclosure(str)) { str += slash; } // preserves full path in case of trailing path separator str += 'a'; // remove path parts that are globby do { str = pathPosixDirname(str); } while (isGlobby(str)); // remove escape chars and return result return str.replace(escaped, '$1'); }; function isEnclosure(str) { var lastChar = str.slice(-1); var enclosureStart; switch (lastChar) { case '}': enclosureStart = '{'; break; case ']': enclosureStart = '['; break; default: return false; } var foundIndex = str.indexOf(enclosureStart); if (foundIndex < 0) { return false; } return str.slice(foundIndex + 1, -1).includes(slash); } function isGlobby(str) { if (/\([^()]+$/.test(str)) { return true; } if (str[0] === '{' || str[0] === '[') { return true; } if (/[^\\][{[]/.test(str)) { return true; } return isGlob(str); } var index = /*@__PURE__*/getDefaultExportFromCjs(globParent); export { index as default };
import require$$0 from 'is-glob'; import require$$1 from 'path'; import require$$2 from 'os'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: index.js var isGlob = require$$0; var pathPosixDirname = require$$1.posix.dirname; var isWin32 = require$$2.platform() === 'win32'; var slash = '/'; var backslash = /\\/g; var escaped = /\\([!*?|[\](){}])/g; /** * @param {string} str * @param {Object} opts * @param {boolean} [opts.flipBackslashes=true] */ var globParent = function globParent(str, opts) { var options = Object.assign({ flipBackslashes: true }, opts); // flip windows path separators if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { str = str.replace(backslash, slash); } // special case for strings ending in enclosure containing path separator if (isEnclosure(str)) { str += slash; } // preserves full path in case of trailing path separator str += 'a'; // remove path parts that are globby do { str = pathPosixDirname(str); } while (isGlobby(str)); // remove escape chars and return result return str.replace(escaped, '$1'); }; function isEnclosure(str) { var lastChar = str.slice(-1); var enclosureStart; switch (lastChar) { case '}': enclosureStart = '{'; break; case ']': enclosureStart = '['; break; default: return false; } var foundIndex = str.indexOf(enclosureStart); if (foundIndex < 0) { return false; } return str.slice(foundIndex + 1, -1).includes(slash); } function isGlobby(str) { if (/\([^()]+$/.test(str)) { return true; } if (str[0] === '{' || str[0] === '[') { return true; } if (/[^\\][{[]/.test(str)) { return true; } return isGlob(str); } var index = /*@__PURE__*/getDefaultExportFromCjs(globParent); export { index as default };
59
4
0
5
12
0
3
0
0
0
0
10
604
true
figgy-pudding
top1k-untyped-nodeps
4,970
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: index.js class FiggyPudding { constructor (specs, opts, providers) { this.__specs = specs || {}; Object.keys(this.__specs).forEach(alias => { if (typeof this.__specs[alias] === 'string') { const key = this.__specs[alias]; const realSpec = this.__specs[key]; if (realSpec) { const aliasArr = realSpec.aliases || []; aliasArr.push(alias, key); realSpec.aliases = [...(new Set(aliasArr))]; this.__specs[alias] = realSpec; } else { throw new Error(`Alias refers to invalid key: ${key} -> ${alias}`) } } }); this.__opts = opts || {}; this.__providers = reverse((providers).filter( x => x != null && typeof x === 'object' )); this.__isFiggyPudding = true; } get (key) { return pudGet(this, key, true) } get [Symbol.toStringTag] () { return 'FiggyPudding' } forEach (fn, thisArg = this) { for (let [key, value] of this.entries()) { fn.call(thisArg, value, key, this); } } toJSON () { const obj = {}; this.forEach((val, key) => { obj[key] = val; }); return obj } * entries (_matcher) { for (let key of Object.keys(this.__specs)) { yield [key, this.get(key)]; } const matcher = _matcher || this.__opts.other; if (matcher) { const seen = new Set(); for (let p of this.__providers) { const iter = p.entries ? p.entries(matcher) : entries(p); for (let [key, val] of iter) { if (matcher(key) && !seen.has(key)) { seen.add(key); yield [key, val]; } } } } } * [Symbol.iterator] () { for (let [key, value] of this.entries()) { yield [key, value]; } } * keys () { for (let [key] of this.entries()) { yield key; } } * values () { for (let [, value] of this.entries()) { yield value; } } concat (...moreConfig) { return new Proxy(new FiggyPudding( this.__specs, this.__opts, reverse(this.__providers).concat(moreConfig) ), proxyHandler) } } try { const util = require('util'); FiggyPudding.prototype[util.inspect.custom] = function (depth, opts) { return ( this[Symbol.toStringTag] + ' ' ) + util.inspect(this.toJSON(), opts) }; } catch (e) {} function BadKeyError (key) { throw Object.assign(new Error( `invalid config key requested: ${key}` ), {code: 'EBADKEY'}) } function pudGet (pud, key, validate) { let spec = pud.__specs[key]; if (validate && !spec && (!pud.__opts.other || !pud.__opts.other(key))) { BadKeyError(key); } else { if (!spec) { spec = {}; } let ret; for (let p of pud.__providers) { ret = tryGet(key, p); if (ret === undefined && spec.aliases && spec.aliases.length) { for (let alias of spec.aliases) { if (alias === key) { continue } ret = tryGet(alias, p); if (ret !== undefined) { break } } } if (ret !== undefined) { break } } if (ret === undefined && spec.default !== undefined) { if (typeof spec.default === 'function') { return spec.default(pud) } else { return spec.default } } else { return ret } } } function tryGet (key, p) { let ret; if (p.__isFiggyPudding) { ret = pudGet(p, key, false); } else if (typeof p.get === 'function') { ret = p.get(key); } else { ret = p[key]; } return ret } const proxyHandler = { has (obj, prop) { return prop in obj.__specs && pudGet(obj, prop, false) !== undefined }, ownKeys (obj) { return Object.keys(obj.__specs) }, get (obj, prop) { if ( typeof prop === 'symbol' || prop.slice(0, 2) === '__' || prop in FiggyPudding.prototype ) { return obj[prop] } return obj.get(prop) }, set (obj, prop, value) { if ( typeof prop === 'symbol' || prop.slice(0, 2) === '__' ) { obj[prop] = value; return true } else { throw new Error('figgyPudding options cannot be modified. Use .concat() instead.') } }, deleteProperty () { throw new Error('figgyPudding options cannot be deleted. Use .concat() and shadow them instead.') } }; var figgyPudding_1 = figgyPudding; function figgyPudding (specs, opts) { function factory (...providers) { return new Proxy(new FiggyPudding( specs, opts, providers ), proxyHandler) } return factory } function reverse (arr) { const ret = []; arr.forEach(x => ret.unshift(x)); return ret } function entries (obj) { return Object.keys(obj).map(k => [k, obj[k]]) } var index = /*@__PURE__*/getDefaultExportFromCjs(figgyPudding_1); export { index as default };
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: index.js class FiggyPudding { constructor (specs, opts, providers) { this.__specs = specs || {}; Object.keys(this.__specs).forEach(alias => { if (typeof this.__specs[alias] === 'string') { const key = this.__specs[alias]; const realSpec = this.__specs[key]; if (realSpec) { const aliasArr = realSpec.aliases || []; aliasArr.push(alias, key); realSpec.aliases = [...(new Set(aliasArr))]; this.__specs[alias] = realSpec; } else { throw new Error(`Alias refers to invalid key: ${key} -> ${alias}`) } } }); this.__opts = opts || {}; this.__providers = reverse((providers).filter( x => x != null && typeof x === 'object' )); this.__isFiggyPudding = true; } get (key) { return pudGet(this, key, true) } get [Symbol.toStringTag] () { return 'FiggyPudding' } forEach (fn, thisArg = this) { for (let [key, value] of this.entries()) { fn.call(thisArg, value, key, this); } } toJSON () { const obj = {}; this.forEach((val, key) => { obj[key] = val; }); return obj } * entries (_matcher) { for (let key of Object.keys(this.__specs)) { yield [key, this.get(key)]; } const matcher = _matcher || this.__opts.other; if (matcher) { const seen = new Set(); for (let p of this.__providers) { const iter = p.entries ? p.entries(matcher) : entries(p); for (let [key, val] of iter) { if (matcher(key) && !seen.has(key)) { seen.add(key); yield [key, val]; } } } } } * [Symbol.iterator] () { for (let [key, value] of this.entries()) { yield [key, value]; } } * keys () { for (let [key] of this.entries()) { yield key; } } * values () { for (let [, value] of this.entries()) { yield value; } } concat (...moreConfig) { return new Proxy(new FiggyPudding( this.__specs, this.__opts, reverse(this.__providers).concat(moreConfig) ), proxyHandler) } } try { const util = require('util'); FiggyPudding.prototype[util.inspect.custom] = function (depth, opts) { return ( this[Symbol.toStringTag] + ' ' ) + util.inspect(this.toJSON(), opts) }; } catch (e) {} function BadKeyError (key) { throw Object.assign(new Error( `invalid config key requested: ${key}` ), {code: 'EBADKEY'}) } function pudGet (pud, key, validate) { let spec = pud.__specs[key]; if (validate && !spec && (!pud.__opts.other || !pud.__opts.other(key))) { BadKeyError(key); } else { if (!spec) { spec = {}; } let ret; for (let p of pud.__providers) { ret = tryGet(key, p); if (ret === undefined && spec.aliases && spec.aliases.length) { for (let alias of spec.aliases) { if (alias === key) { continue } ret = tryGet(alias, p); if (ret !== undefined) { break } } } if (ret !== undefined) { break } } if (ret === undefined && spec.default !== undefined) { if (typeof spec.default === 'function') { return spec.default(pud) } else { return spec.default } } else { return ret } } } function tryGet (key, p) { let ret; if (p.__isFiggyPudding) { ret = pudGet(p, key, false); } else if (typeof p.get === 'function') { ret = p.get(key); } else { ret = p[key]; } return ret } const proxyHandler = { has (obj, prop) { return prop in obj.__specs && pudGet(obj, prop, false) !== undefined }, ownKeys (obj) { return Object.keys(obj.__specs) }, get (obj, prop) { if ( typeof prop === 'symbol' || prop.slice(0, 2) === '__' || prop in FiggyPudding.prototype ) { return obj[prop] } return obj.get(prop) }, set (obj, prop, value) { if ( typeof prop === 'symbol' || prop.slice(0, 2) === '__' ) { obj[prop] = value; return true } else { throw new Error('figgyPudding options cannot be modified. Use .concat() instead.') } }, deleteProperty () { throw new Error('figgyPudding options cannot be deleted. Use .concat() and shadow them instead.') } }; var figgyPudding_1 = figgyPudding; function figgyPudding (specs, opts) { function factory (...providers) { return new Proxy(new FiggyPudding( specs, opts, providers ), proxyHandler) } return factory } function reverse (arr) { const ret = []; arr.forEach(x => ret.unshift(x)); return ret } function entries (obj) { return Object.keys(obj).map(k => [k, obj[k]]) } var index = /*@__PURE__*/getDefaultExportFromCjs(figgyPudding_1); export { index as default };
193
29
0
36
15
0
12
0
0
1
6
5.517241
1,477
false
pumpify
top1k-typed-with-typed-deps
2,231
import require$$0 from 'pump'; import require$$1 from 'inherits'; import require$$2 from 'duplexify'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var pumpify = {exports: {}}; // FILE: index.js var pump = require$$0; var inherits = require$$1; var Duplexify = require$$2; var toArray = function(args) { if (!args.length) return [] return Array.isArray(args[0]) ? args[0] : Array.prototype.slice.call(args) }; var define = function(opts) { var Pumpify = function() { var streams = toArray(arguments); if (!(this instanceof Pumpify)) return new Pumpify(streams) Duplexify.call(this, null, null, opts); if (streams.length) this.setPipeline(streams); }; inherits(Pumpify, Duplexify); Pumpify.prototype.setPipeline = function() { var streams = toArray(arguments); var self = this; var ended = false; var w = streams[0]; var r = streams[streams.length-1]; r = r.readable ? r : null; w = w.writable ? w : null; var onclose = function() { streams[0].emit('error', new Error('stream was destroyed')); }; this.on('close', onclose); this.on('prefinish', function() { if (!ended) self.cork(); }); pump(streams, function(err) { self.removeListener('close', onclose); if (err) return self.destroy(err.message === 'premature close' ? null : err) ended = true; // pump ends after the last stream is not writable *but* // pumpify still forwards the readable part so we need to catch errors // still, so reenable autoDestroy in this case if (self._autoDestroy === false) self._autoDestroy = true; self.uncork(); }); if (this.destroyed) return onclose() this.setWritable(w); this.setReadable(r); }; return Pumpify }; pumpify.exports = define({autoDestroy:false, destroy:false}); var obj = pumpify.exports.obj = define({autoDestroy: false, destroy:false, objectMode:true, highWaterMark:16}); var ctor = pumpify.exports.ctor = define; var pumpifyExports = pumpify.exports; var index = /*@__PURE__*/getDefaultExportFromCjs(pumpifyExports); export { ctor, index as default, obj };
import require$$0 from 'pump'; import require$$1 from 'inherits'; import require$$2 from 'duplexify'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var pumpify = {exports: {}}; // FILE: index.js var pump = require$$0; var inherits = require$$1; var Duplexify = require$$2; var toArray = function(args) { if (!args.length) return [] return Array.isArray(args[0]) ? args[0] : Array.prototype.slice.call(args) }; var define = function(opts) { var Pumpify = function() { var streams = toArray(arguments); if (!(this instanceof Pumpify)) return new Pumpify(streams) Duplexify.call(this, null, null, opts); if (streams.length) this.setPipeline(streams); }; inherits(Pumpify, Duplexify); Pumpify.prototype.setPipeline = function() { var streams = toArray(arguments); var self = this; var ended = false; var w = streams[0]; var r = streams[streams.length-1]; r = r.readable ? r : null; w = w.writable ? w : null; var onclose = function() { streams[0].emit('error', new Error('stream was destroyed')); }; this.on('close', onclose); this.on('prefinish', function() { if (!ended) self.cork(); }); pump(streams, function(err) { self.removeListener('close', onclose); if (err) return self.destroy(err.message === 'premature close' ? null : err) ended = true; // pump ends after the last stream is not writable *but* // pumpify still forwards the readable part so we need to catch errors // still, so reenable autoDestroy in this case if (self._autoDestroy === false) self._autoDestroy = true; self.uncork(); }); if (this.destroyed) return onclose() this.setWritable(w); this.setReadable(r); }; return Pumpify }; pumpify.exports = define({autoDestroy:false, destroy:false}); var obj = pumpify.exports.obj = define({autoDestroy: false, destroy:false, objectMode:true, highWaterMark:16}); var ctor = pumpify.exports.ctor = define; var pumpifyExports = pumpify.exports; var index = /*@__PURE__*/getDefaultExportFromCjs(pumpifyExports); export { ctor, index as default, obj };
56
8
0
4
18
0
5
0
0
0
1
9
645
false
pop-iterate
top1k-untyped-nodeps
2,479
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: iteration.js var iteration = Iteration$2; function Iteration$2(value, done, index) { this.value = value; this.done = done; this.index = index; } Iteration$2.prototype.equals = function (other) { return ( typeof other == 'object' && other.value === this.value && other.done === this.done && other.index === this.index ); }; // FILE: array-iterator.js var Iteration$1 = iteration; var arrayIterator = ArrayIterator$2; function ArrayIterator$2(iterable, start, stop, step) { this.array = iterable; this.start = start || 0; this.stop = stop || Infinity; this.step = step || 1; } ArrayIterator$2.prototype.next = function () { var iteration; if (this.start < Math.min(this.array.length, this.stop)) { iteration = new Iteration$1(this.array[this.start], false, this.start); this.start += this.step; } else { iteration = new Iteration$1(undefined, true); } return iteration; }; // FILE: object-iterator.js var Iteration = iteration; var ArrayIterator$1 = arrayIterator; var objectIterator = ObjectIterator$1; function ObjectIterator$1(iterable, start, stop, step) { this.object = iterable; this.keysIterator = new ArrayIterator$1(Object.keys(iterable), start, stop, step); } ObjectIterator$1.prototype.next = function () { var iteration = this.keysIterator.next(); if (iteration.done) { return iteration; } var key = iteration.value; return new Iteration(this.object[key], false, key); }; // FILE: pop-iterate.js var ArrayIterator = arrayIterator; var ObjectIterator = objectIterator; var popIterate = iterate; function iterate(iterable, start, stop, step) { if (!iterable) { return empty; } else if (Array.isArray(iterable)) { return new ArrayIterator(iterable, start, stop, step); } else if (typeof iterable.next === "function") { return iterable; } else if (typeof iterable.iterate === "function") { return iterable.iterate(start, stop, step); } else if (typeof iterable === "object") { return new ObjectIterator(iterable); } else { throw new TypeError("Can't iterate " + iterable); } } var popIterate$1 = /*@__PURE__*/getDefaultExportFromCjs(popIterate); export { popIterate$1 as default };
function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: iteration.js var iteration = Iteration$2; function Iteration$2(value, done, index) { this.value = value; this.done = done; this.index = index; } Iteration$2.prototype.equals = function (other) { return ( typeof other == 'object' && other.value === this.value && other.done === this.done && other.index === this.index ); }; // FILE: array-iterator.js var Iteration$1 = iteration; var arrayIterator = ArrayIterator$2; function ArrayIterator$2(iterable, start, stop, step) { this.array = iterable; this.start = start || 0; this.stop = stop || Infinity; this.step = step || 1; } ArrayIterator$2.prototype.next = function () { var iteration; if (this.start < Math.min(this.array.length, this.stop)) { iteration = new Iteration$1(this.array[this.start], false, this.start); this.start += this.step; } else { iteration = new Iteration$1(undefined, true); } return iteration; }; // FILE: object-iterator.js var Iteration = iteration; var ArrayIterator$1 = arrayIterator; var objectIterator = ObjectIterator$1; function ObjectIterator$1(iterable, start, stop, step) { this.object = iterable; this.keysIterator = new ArrayIterator$1(Object.keys(iterable), start, stop, step); } ObjectIterator$1.prototype.next = function () { var iteration = this.keysIterator.next(); if (iteration.done) { return iteration; } var key = iteration.value; return new Iteration(this.object[key], false, key); }; // FILE: pop-iterate.js var ArrayIterator = arrayIterator; var ObjectIterator = objectIterator; var popIterate = iterate; function iterate(iterable, start, stop, step) { if (!iterable) { return empty; } else if (Array.isArray(iterable)) { return new ArrayIterator(iterable, start, stop, step); } else if (typeof iterable.next === "function") { return iterable; } else if (typeof iterable.iterate === "function") { return iterable.iterate(start, stop, step); } else if (typeof iterable === "object") { return new ObjectIterator(iterable); } else { throw new TypeError("Can't iterate " + iterable); } } var popIterate$1 = /*@__PURE__*/getDefaultExportFromCjs(popIterate); export { popIterate$1 as default };
70
8
0
17
13
0
3
0
0
0
4
5.375
684
false
miller-rabin
top1k-untyped-with-typed-deps
2,780
import require$$0 from 'bn.js'; import require$$1 from 'brorand'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/mr.js var bn = require$$0; var brorand = require$$1; function MillerRabin(rand) { this.rand = rand || new brorand.Rand(); } var mr = MillerRabin; MillerRabin.create = function create(rand) { return new MillerRabin(rand); }; MillerRabin.prototype._randbelow = function _randbelow(n) { var len = n.bitLength(); var min_bytes = Math.ceil(len / 8); // Generage random bytes until a number less than n is found. // This ensures that 0..n-1 have an equal probability of being selected. do var a = new bn(this.rand.generate(min_bytes)); while (a.cmp(n) >= 0); return a; }; MillerRabin.prototype._randrange = function _randrange(start, stop) { // Generate a random number greater than or equal to start and less than stop. var size = stop.sub(start); return start.add(this._randbelow(size)); }; MillerRabin.prototype.test = function test(n, k, cb) { var len = n.bitLength(); var red = bn.mont(n); var rone = new bn(1).toRed(red); if (!k) k = Math.max(1, (len / 48) | 0); // Find d and s, (n - 1) = (2 ^ s) * d; var n1 = n.subn(1); for (var s = 0; !n1.testn(s); s++) {} var d = n.shrn(s); var rn1 = n1.toRed(red); var prime = true; for (; k > 0; k--) { var a = this._randrange(new bn(2), n1); if (cb) cb(a); var x = a.toRed(red).redPow(d); if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue; for (var i = 1; i < s; i++) { x = x.redSqr(); if (x.cmp(rone) === 0) return false; if (x.cmp(rn1) === 0) break; } if (i === s) return false; } return prime; }; MillerRabin.prototype.getDivisor = function getDivisor(n, k) { var len = n.bitLength(); var red = bn.mont(n); var rone = new bn(1).toRed(red); if (!k) k = Math.max(1, (len / 48) | 0); // Find d and s, (n - 1) = (2 ^ s) * d; var n1 = n.subn(1); for (var s = 0; !n1.testn(s); s++) {} var d = n.shrn(s); var rn1 = n1.toRed(red); for (; k > 0; k--) { var a = this._randrange(new bn(2), n1); var g = n.gcd(a); if (g.cmpn(1) !== 0) return g; var x = a.toRed(red).redPow(d); if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue; for (var i = 1; i < s; i++) { x = x.redSqr(); if (x.cmp(rone) === 0) return x.fromRed().subn(1).gcd(n); if (x.cmp(rn1) === 0) break; } if (i === s) { x = x.redSqr(); return x.fromRed().subn(1).gcd(n); } } return false; }; var mr$1 = /*@__PURE__*/getDefaultExportFromCjs(mr); export { mr$1 as default };
import require$$0 from 'bn.js'; import require$$1 from 'brorand'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/mr.js var bn = require$$0; var brorand = require$$1; function MillerRabin(rand) { this.rand = rand || new brorand.Rand(); } var mr = MillerRabin; MillerRabin.create = function create(rand) { return new MillerRabin(rand); }; MillerRabin.prototype._randbelow = function _randbelow(n) { var len = n.bitLength(); var min_bytes = Math.ceil(len / 8); // Generage random bytes until a number less than n is found. // This ensures that 0..n-1 have an equal probability of being selected. do var a = new bn(this.rand.generate(min_bytes)); while (a.cmp(n) >= 0); return a; }; MillerRabin.prototype._randrange = function _randrange(start, stop) { // Generate a random number greater than or equal to start and less than stop. var size = stop.sub(start); return start.add(this._randbelow(size)); }; MillerRabin.prototype.test = function test(n, k, cb) { var len = n.bitLength(); var red = bn.mont(n); var rone = new bn(1).toRed(red); if (!k) k = Math.max(1, (len / 48) | 0); // Find d and s, (n - 1) = (2 ^ s) * d; var n1 = n.subn(1); for (var s = 0; !n1.testn(s); s++) {} var d = n.shrn(s); var rn1 = n1.toRed(red); var prime = true; for (; k > 0; k--) { var a = this._randrange(new bn(2), n1); if (cb) cb(a); var x = a.toRed(red).redPow(d); if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue; for (var i = 1; i < s; i++) { x = x.redSqr(); if (x.cmp(rone) === 0) return false; if (x.cmp(rn1) === 0) break; } if (i === s) return false; } return prime; }; MillerRabin.prototype.getDivisor = function getDivisor(n, k) { var len = n.bitLength(); var red = bn.mont(n); var rone = new bn(1).toRed(red); if (!k) k = Math.max(1, (len / 48) | 0); // Find d and s, (n - 1) = (2 ^ s) * d; var n1 = n.subn(1); for (var s = 0; !n1.testn(s); s++) {} var d = n.shrn(s); var rn1 = n1.toRed(red); for (; k > 0; k--) { var a = this._randrange(new bn(2), n1); var g = n.gcd(a); if (g.cmpn(1) !== 0) return g; var x = a.toRed(red).redPow(d); if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue; for (var i = 1; i < s; i++) { x = x.redSqr(); if (x.cmp(rone) === 0) return x.fromRed().subn(1).gcd(n); if (x.cmp(rn1) === 0) break; } if (i === s) { x = x.redSqr(); return x.fromRed().subn(1).gcd(n); } } return false; }; var mr$1 = /*@__PURE__*/getDefaultExportFromCjs(mr); export { mr$1 as default };
90
7
0
11
30
0
3
0
0
0
0
9.857143
1,078
false
@sinonjs_commons
top1k-typed-with-typed-deps
9,663
import require$$0 from 'type-detect'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/global.js /** * A reference to the global object * * @type {object} globalObject */ var globalObject; /* istanbul ignore else */ if (typeof commonjsGlobal !== "undefined") { // Node globalObject = commonjsGlobal; } else if (typeof window !== "undefined") { // Browser globalObject = window; } else { // WebWorker globalObject = self; } var global$1 = globalObject; // FILE: lib/prototypes/copy-prototype.js var call = Function.call; var copyPrototype$6 = function copyPrototypeMethods(prototype) { // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods return Object.getOwnPropertyNames(prototype).reduce(function(result, name) { // ignore size because it throws from Map if ( name !== "size" && name !== "caller" && name !== "callee" && name !== "arguments" && typeof prototype[name] === "function" ) { result[name] = call.bind(prototype[name]); } return result; }, Object.create(null)); }; // FILE: lib/prototypes/array.js var copyPrototype$5 = copyPrototype$6; var array = copyPrototype$5(Array.prototype); // FILE: lib/called-in-order.js var every$1 = array.every; /** * @private */ function hasCallsLeft(callMap, spy) { if (callMap[spy.id] === undefined) { callMap[spy.id] = 0; } return callMap[spy.id] < spy.callCount; } /** * @private */ function checkAdjacentCalls(callMap, spy, index, spies) { var calledBeforeNext = true; if (index !== spies.length - 1) { calledBeforeNext = spy.calledBefore(spies[index + 1]); } if (hasCallsLeft(callMap, spy) && calledBeforeNext) { callMap[spy.id] += 1; return true; } return false; } /** * A Sinon proxy object (fake, spy, stub) * * @typedef {object} SinonProxy * @property {Function} calledBefore - A method that determines if this proxy was called before another one * @property {string} id - Some id * @property {number} callCount - Number of times this proxy has been called */ /** * Returns true when the spies have been called in the order they were supplied in * * @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments * @returns {boolean} true when spies are called in order, false otherwise */ function calledInOrder(spies) { var callMap = {}; // eslint-disable-next-line no-underscore-dangle var _spies = arguments.length > 1 ? arguments : spies; return every$1(_spies, checkAdjacentCalls.bind(null, callMap)); } var calledInOrder_1 = calledInOrder; // FILE: lib/function-name.js /** * Returns a display name for a function * * @param {Function} func * @returns {string} */ var functionName$1 = function functionName(func) { if (!func) { return ""; } try { return ( func.displayName || func.name || // Use function decomposition as a last resort to get function // name. Does not rely on function decomposition to work - if it // doesn't debugging will be slightly less informative // (i.e. toString will say 'spy' rather than 'myFunc'). (String(func).match(/function ([^\s(]+)/) || [])[1] ); } catch (e) { // Stringify may fail and we might get an exception, as a last-last // resort fall back to empty string. return ""; } }; // FILE: lib/class-name.js var functionName = functionName$1; /** * Returns a display name for a value from a constructor * * @param {object} value A value to examine * @returns {(string|null)} A string or null */ function className(value) { return ( (value.constructor && value.constructor.name) || // The next branch is for IE11 support only: // Because the name property is not set on the prototype // of the Function object, we finally try to grab the // name from its definition. This will never be reached // in node, so we are not able to test this properly. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name (typeof value.constructor === "function" && /* istanbul ignore next */ functionName(value.constructor)) || null ); } var className_1 = className; var deprecated = {}; // FILE: lib/deprecated.js /* eslint-disable no-console */ (function (exports) { /** * Returns a function that will invoke the supplied function and print a * deprecation warning to the console each time it is called. * * @param {Function} func * @param {string} msg * @returns {Function} */ exports.wrap = function(func, msg) { var wrapped = function() { exports.printWarning(msg); return func.apply(this, arguments); }; if (func.prototype) { wrapped.prototype = func.prototype; } return wrapped; }; /** * Returns a string which can be supplied to `wrap()` to notify the user that a * particular part of the sinon API has been deprecated. * * @param {string} packageName * @param {string} funcName * @returns {string} */ exports.defaultMsg = function(packageName, funcName) { return ( packageName + "." + funcName + " is deprecated and will be removed from the public API in a future version of " + packageName + "." ); }; /** * Prints a warning on the console, when it exists * * @param {string} msg * @returns {undefined} */ exports.printWarning = function(msg) { /* istanbul ignore next */ if (typeof process === "object" && process.emitWarning) { // Emit Warnings in Node process.emitWarning(msg); } else if (console.info) { console.info(msg); } else { console.log(msg); } }; } (deprecated)); // FILE: lib/every.js /** * Returns true when fn returns true for all members of obj. * This is an every implementation that works for all iterables * * @param {object} obj * @param {Function} fn * @returns {boolean} */ var every = function every(obj, fn) { var pass = true; try { // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods obj.forEach(function() { if (!fn.apply(this, arguments)) { // Throwing an error is the only way to break `forEach` throw new Error(); } }); } catch (e) { pass = false; } return pass; }; // FILE: lib/order-by-first-call.js var sort = array.sort; var slice = array.slice; /** * @private */ function comparator(a, b) { // uuid, won't ever be equal var aCall = a.getCall(0); var bCall = b.getCall(0); var aId = (aCall && aCall.callId) || -1; var bId = (bCall && bCall.callId) || -1; return aId < bId ? -1 : 1; } /** * A Sinon proxy object (fake, spy, stub) * * @typedef {object} SinonProxy * @property {Function} getCall - A method that can return the first call */ /** * Sorts an array of SinonProxy instances (fake, spy, stub) by their first call * * @param {SinonProxy[] | SinonProxy} spies * @returns {SinonProxy[]} */ function orderByFirstCall(spies) { return sort(slice(spies), comparator); } var orderByFirstCall_1 = orderByFirstCall; // FILE: lib/prototypes/function.js var copyPrototype$4 = copyPrototype$6; var _function = copyPrototype$4(Function.prototype); // FILE: lib/prototypes/map.js var copyPrototype$3 = copyPrototype$6; var map = copyPrototype$3(Map.prototype); // FILE: lib/prototypes/object.js var copyPrototype$2 = copyPrototype$6; var object = copyPrototype$2(Object.prototype); // FILE: lib/prototypes/set.js var copyPrototype$1 = copyPrototype$6; var set = copyPrototype$1(Set.prototype); // FILE: lib/prototypes/string.js var copyPrototype = copyPrototype$6; var string = copyPrototype(String.prototype); // FILE: lib/prototypes/index.js var prototypes = { array: array, function: _function, map: map, object: object, set: set, string: string }; // FILE: lib/type-of.js var type = require$$0; /** * Returns the lower-case result of running type from type-detect on the value * * @param {*} value * @returns {string} */ var typeOf = function typeOf(value) { return type(value).toLowerCase(); }; // FILE: lib/value-to-string.js /** * Returns a string representation of the value * * @param {*} value * @returns {string} */ function valueToString(value) { if (value && value.toString) { // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods return value.toString(); } return String(value); } var valueToString_1 = valueToString; // FILE: lib/index.js var lib = { global: global$1, calledInOrder: calledInOrder_1, className: className_1, deprecated: deprecated, every: every, functionName: functionName$1, orderByFirstCall: orderByFirstCall_1, prototypes: prototypes, typeOf: typeOf, valueToString: valueToString_1 }; var index = /*@__PURE__*/getDefaultExportFromCjs(lib); export { index as default };
import require$$0 from 'type-detect'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/global.js /** * A reference to the global object * * @type {object} globalObject */ var globalObject; /* istanbul ignore else */ if (typeof commonjsGlobal !== "undefined") { // Node globalObject = commonjsGlobal; } else if (typeof window !== "undefined") { // Browser globalObject = window; } else { // WebWorker globalObject = self; } var global$1 = globalObject; // FILE: lib/prototypes/copy-prototype.js var call = Function.call; var copyPrototype$6 = function copyPrototypeMethods(prototype) { // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods return Object.getOwnPropertyNames(prototype).reduce(function(result, name) { // ignore size because it throws from Map if ( name !== "size" && name !== "caller" && name !== "callee" && name !== "arguments" && typeof prototype[name] === "function" ) { result[name] = call.bind(prototype[name]); } return result; }, Object.create(null)); }; // FILE: lib/prototypes/array.js var copyPrototype$5 = copyPrototype$6; var array = copyPrototype$5(Array.prototype); // FILE: lib/called-in-order.js var every$1 = array.every; /** * @private */ function hasCallsLeft(callMap, spy) { if (callMap[spy.id] === undefined) { callMap[spy.id] = 0; } return callMap[spy.id] < spy.callCount; } /** * @private */ function checkAdjacentCalls(callMap, spy, index, spies) { var calledBeforeNext = true; if (index !== spies.length - 1) { calledBeforeNext = spy.calledBefore(spies[index + 1]); } if (hasCallsLeft(callMap, spy) && calledBeforeNext) { callMap[spy.id] += 1; return true; } return false; } /** * A Sinon proxy object (fake, spy, stub) * * @typedef {object} SinonProxy * @property {Function} calledBefore - A method that determines if this proxy was called before another one * @property {string} id - Some id * @property {number} callCount - Number of times this proxy has been called */ /** * Returns true when the spies have been called in the order they were supplied in * * @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments * @returns {boolean} true when spies are called in order, false otherwise */ function calledInOrder(spies) { var callMap = {}; // eslint-disable-next-line no-underscore-dangle var _spies = arguments.length > 1 ? arguments : spies; return every$1(_spies, checkAdjacentCalls.bind(null, callMap)); } var calledInOrder_1 = calledInOrder; // FILE: lib/function-name.js /** * Returns a display name for a function * * @param {Function} func * @returns {string} */ var functionName$1 = function functionName(func) { if (!func) { return ""; } try { return ( func.displayName || func.name || // Use function decomposition as a last resort to get function // name. Does not rely on function decomposition to work - if it // doesn't debugging will be slightly less informative // (i.e. toString will say 'spy' rather than 'myFunc'). (String(func).match(/function ([^\s(]+)/) || [])[1] ); } catch (e) { // Stringify may fail and we might get an exception, as a last-last // resort fall back to empty string. return ""; } }; // FILE: lib/class-name.js var functionName = functionName$1; /** * Returns a display name for a value from a constructor * * @param {object} value A value to examine * @returns {(string|null)} A string or null */ function className(value) { return ( (value.constructor && value.constructor.name) || // The next branch is for IE11 support only: // Because the name property is not set on the prototype // of the Function object, we finally try to grab the // name from its definition. This will never be reached // in node, so we are not able to test this properly. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name (typeof value.constructor === "function" && /* istanbul ignore next */ functionName(value.constructor)) || null ); } var className_1 = className; var deprecated = {}; // FILE: lib/deprecated.js /* eslint-disable no-console */ (function (exports) { /** * Returns a function that will invoke the supplied function and print a * deprecation warning to the console each time it is called. * * @param {Function} func * @param {string} msg * @returns {Function} */ exports.wrap = function(func, msg) { var wrapped = function() { exports.printWarning(msg); return func.apply(this, arguments); }; if (func.prototype) { wrapped.prototype = func.prototype; } return wrapped; }; /** * Returns a string which can be supplied to `wrap()` to notify the user that a * particular part of the sinon API has been deprecated. * * @param {string} packageName * @param {string} funcName * @returns {string} */ exports.defaultMsg = function(packageName, funcName) { return ( packageName + "." + funcName + " is deprecated and will be removed from the public API in a future version of " + packageName + "." ); }; /** * Prints a warning on the console, when it exists * * @param {string} msg * @returns {undefined} */ exports.printWarning = function(msg) { /* istanbul ignore next */ if (typeof process === "object" && process.emitWarning) { // Emit Warnings in Node process.emitWarning(msg); } else if (console.info) { console.info(msg); } else { console.log(msg); } }; } (deprecated)); // FILE: lib/every.js /** * Returns true when fn returns true for all members of obj. * This is an every implementation that works for all iterables * * @param {object} obj * @param {Function} fn * @returns {boolean} */ var every = function every(obj, fn) { var pass = true; try { // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods obj.forEach(function() { if (!fn.apply(this, arguments)) { // Throwing an error is the only way to break `forEach` throw new Error(); } }); } catch (e) { pass = false; } return pass; }; // FILE: lib/order-by-first-call.js var sort = array.sort; var slice = array.slice; /** * @private */ function comparator(a, b) { // uuid, won't ever be equal var aCall = a.getCall(0); var bCall = b.getCall(0); var aId = (aCall && aCall.callId) || -1; var bId = (bCall && bCall.callId) || -1; return aId < bId ? -1 : 1; } /** * A Sinon proxy object (fake, spy, stub) * * @typedef {object} SinonProxy * @property {Function} getCall - A method that can return the first call */ /** * Sorts an array of SinonProxy instances (fake, spy, stub) by their first call * * @param {SinonProxy[] | SinonProxy} spies * @returns {SinonProxy[]} */ function orderByFirstCall(spies) { return sort(slice(spies), comparator); } var orderByFirstCall_1 = orderByFirstCall; // FILE: lib/prototypes/function.js var copyPrototype$4 = copyPrototype$6; var _function = copyPrototype$4(Function.prototype); // FILE: lib/prototypes/map.js var copyPrototype$3 = copyPrototype$6; var map = copyPrototype$3(Map.prototype); // FILE: lib/prototypes/object.js var copyPrototype$2 = copyPrototype$6; var object = copyPrototype$2(Object.prototype); // FILE: lib/prototypes/set.js var copyPrototype$1 = copyPrototype$6; var set = copyPrototype$1(Set.prototype); // FILE: lib/prototypes/string.js var copyPrototype = copyPrototype$6; var string = copyPrototype(String.prototype); // FILE: lib/prototypes/index.js var prototypes = { array: array, function: _function, map: map, object: object, set: set, string: string }; // FILE: lib/type-of.js var type = require$$0; /** * Returns the lower-case result of running type from type-detect on the value * * @param {*} value * @returns {string} */ var typeOf = function typeOf(value) { return type(value).toLowerCase(); }; // FILE: lib/value-to-string.js /** * Returns a string representation of the value * * @param {*} value * @returns {string} */ function valueToString(value) { if (value && value.toString) { // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods return value.toString(); } return String(value); } var valueToString_1 = valueToString; // FILE: lib/index.js var lib = { global: global$1, calledInOrder: calledInOrder_1, className: className_1, deprecated: deprecated, every: every, functionName: functionName$1, orderByFirstCall: orderByFirstCall_1, prototypes: prototypes, typeOf: typeOf, valueToString: valueToString_1 }; var index = /*@__PURE__*/getDefaultExportFromCjs(lib); export { index as default };
180
19
0
26
42
0
4
0
0
0
9
7.157895
2,685
false
etag
top1k-typed-nodeps
2,774
import require$$0 from 'crypto'; import require$$1 from 'fs'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: index.js /*! * etag * Copyright(c) 2014-2016 Douglas Christopher Wilson * MIT Licensed */ /** * Module exports. * @public */ var etag_1 = etag; /** * Module dependencies. * @private */ var crypto = require$$0; var Stats = require$$1.Stats; /** * Module variables. * @private */ var toString = Object.prototype.toString; /** * Generate an entity tag. * * @param {Buffer|string} entity * @return {string} * @private */ function entitytag (entity) { if (entity.length === 0) { // fast-path empty return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"' } // compute hash of entity var hash = crypto .createHash('sha1') .update(entity, 'utf8') .digest('base64') .substring(0, 27); // compute length of entity var len = typeof entity === 'string' ? Buffer.byteLength(entity, 'utf8') : entity.length; return '"' + len.toString(16) + '-' + hash + '"' } /** * Create a simple ETag. * * @param {string|Buffer|Stats} entity * @param {object} [options] * @param {boolean} [options.weak] * @return {String} * @public */ function etag (entity, options) { if (entity == null) { throw new TypeError('argument entity is required') } // support fs.Stats object var isStats = isstats(entity); var weak = options && typeof options.weak === 'boolean' ? options.weak : isStats; // validate argument if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) { throw new TypeError('argument entity must be string, Buffer, or fs.Stats') } // generate entity tag var tag = isStats ? stattag(entity) : entitytag(entity); return weak ? 'W/' + tag : tag } /** * Determine if object is a Stats object. * * @param {object} obj * @return {boolean} * @api private */ function isstats (obj) { // genuine fs.Stats if (typeof Stats === 'function' && obj instanceof Stats) { return true } // quack quack return obj && typeof obj === 'object' && 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' && 'mtime' in obj && toString.call(obj.mtime) === '[object Date]' && 'ino' in obj && typeof obj.ino === 'number' && 'size' in obj && typeof obj.size === 'number' } /** * Generate a tag for a stat. * * @param {object} stat * @return {string} * @private */ function stattag (stat) { var mtime = stat.mtime.getTime().toString(16); var size = stat.size.toString(16); return '"' + size + '-' + mtime + '"' } var index = /*@__PURE__*/getDefaultExportFromCjs(etag_1); export { index as default };
import require$$0 from 'crypto'; import require$$1 from 'fs'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: index.js /*! * etag * Copyright(c) 2014-2016 Douglas Christopher Wilson * MIT Licensed */ /** * Module exports. * @public */ var etag_1 = etag; /** * Module dependencies. * @private */ var crypto = require$$0; var Stats = require$$1.Stats; /** * Module variables. * @private */ var toString = Object.prototype.toString; /** * Generate an entity tag. * * @param {Buffer|string} entity * @return {string} * @private */ function entitytag (entity) { if (entity.length === 0) { // fast-path empty return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"' } // compute hash of entity var hash = crypto .createHash('sha1') .update(entity, 'utf8') .digest('base64') .substring(0, 27); // compute length of entity var len = typeof entity === 'string' ? Buffer.byteLength(entity, 'utf8') : entity.length; return '"' + len.toString(16) + '-' + hash + '"' } /** * Create a simple ETag. * * @param {string|Buffer|Stats} entity * @param {object} [options] * @param {boolean} [options.weak] * @return {String} * @public */ function etag (entity, options) { if (entity == null) { throw new TypeError('argument entity is required') } // support fs.Stats object var isStats = isstats(entity); var weak = options && typeof options.weak === 'boolean' ? options.weak : isStats; // validate argument if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) { throw new TypeError('argument entity must be string, Buffer, or fs.Stats') } // generate entity tag var tag = isStats ? stattag(entity) : entitytag(entity); return weak ? 'W/' + tag : tag } /** * Determine if object is a Stats object. * * @param {object} obj * @return {boolean} * @api private */ function isstats (obj) { // genuine fs.Stats if (typeof Stats === 'function' && obj instanceof Stats) { return true } // quack quack return obj && typeof obj === 'object' && 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' && 'mtime' in obj && toString.call(obj.mtime) === '[object Date]' && 'ino' in obj && typeof obj.ino === 'number' && 'size' in obj && typeof obj.size === 'number' } /** * Generate a tag for a stat. * * @param {object} stat * @return {string} * @private */ function stattag (stat) { var mtime = stat.mtime.getTime().toString(16); var size = stat.size.toString(16); return '"' + size + '-' + mtime + '"' } var index = /*@__PURE__*/getDefaultExportFromCjs(etag_1); export { index as default };
58
5
0
6
12
0
4
0
0
0
8
8
871
true
quick-lru
top1k-typed-nodeps
5,901
// FILE: index.js class QuickLRU extends Map { constructor(options = {}) { super(); if (!(options.maxSize && options.maxSize > 0)) { throw new TypeError('`maxSize` must be a number greater than 0'); } if (typeof options.maxAge === 'number' && options.maxAge === 0) { throw new TypeError('`maxAge` must be a number greater than 0'); } // TODO: Use private class fields when ESLint supports them. this.maxSize = options.maxSize; this.maxAge = options.maxAge || Number.POSITIVE_INFINITY; this.onEviction = options.onEviction; this.cache = new Map(); this.oldCache = new Map(); this._size = 0; } // TODO: Use private class methods when targeting Node.js 16. _emitEvictions(cache) { if (typeof this.onEviction !== 'function') { return; } for (const [key, item] of cache) { this.onEviction(key, item.value); } } _deleteIfExpired(key, item) { if (typeof item.expiry === 'number' && item.expiry <= Date.now()) { if (typeof this.onEviction === 'function') { this.onEviction(key, item.value); } return this.delete(key); } return false; } _getOrDeleteIfExpired(key, item) { const deleted = this._deleteIfExpired(key, item); if (deleted === false) { return item.value; } } _getItemValue(key, item) { return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value; } _peek(key, cache) { const item = cache.get(key); return this._getItemValue(key, item); } _set(key, value) { this.cache.set(key, value); this._size++; if (this._size >= this.maxSize) { this._size = 0; this._emitEvictions(this.oldCache); this.oldCache = this.cache; this.cache = new Map(); } } _moveToRecent(key, item) { this.oldCache.delete(key); this._set(key, item); } * _entriesAscending() { for (const item of this.oldCache) { const [key, value] = item; if (!this.cache.has(key)) { const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield item; } } } for (const item of this.cache) { const [key, value] = item; const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield item; } } } get(key) { if (this.cache.has(key)) { const item = this.cache.get(key); return this._getItemValue(key, item); } if (this.oldCache.has(key)) { const item = this.oldCache.get(key); if (this._deleteIfExpired(key, item) === false) { this._moveToRecent(key, item); return item.value; } } } set(key, value, {maxAge = this.maxAge} = {}) { const expiry = typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : undefined; if (this.cache.has(key)) { this.cache.set(key, { value, expiry }); } else { this._set(key, {value, expiry}); } } has(key) { if (this.cache.has(key)) { return !this._deleteIfExpired(key, this.cache.get(key)); } if (this.oldCache.has(key)) { return !this._deleteIfExpired(key, this.oldCache.get(key)); } return false; } peek(key) { if (this.cache.has(key)) { return this._peek(key, this.cache); } if (this.oldCache.has(key)) { return this._peek(key, this.oldCache); } } delete(key) { const deleted = this.cache.delete(key); if (deleted) { this._size--; } return this.oldCache.delete(key) || deleted; } clear() { this.cache.clear(); this.oldCache.clear(); this._size = 0; } resize(newSize) { if (!(newSize && newSize > 0)) { throw new TypeError('`maxSize` must be a number greater than 0'); } const items = [...this._entriesAscending()]; const removeCount = items.length - newSize; if (removeCount < 0) { this.cache = new Map(items); this.oldCache = new Map(); this._size = items.length; } else { if (removeCount > 0) { this._emitEvictions(items.slice(0, removeCount)); } this.oldCache = new Map(items.slice(removeCount)); this.cache = new Map(); this._size = 0; } this.maxSize = newSize; } * keys() { for (const [key] of this) { yield key; } } * values() { for (const [, value] of this) { yield value; } } * [Symbol.iterator]() { for (const item of this.cache) { const [key, value] = item; const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } for (const item of this.oldCache) { const [key, value] = item; if (!this.cache.has(key)) { const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } } } * entriesDescending() { let items = [...this.cache]; for (let i = items.length - 1; i >= 0; --i) { const item = items[i]; const [key, value] = item; const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } items = [...this.oldCache]; for (let i = items.length - 1; i >= 0; --i) { const item = items[i]; const [key, value] = item; if (!this.cache.has(key)) { const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } } } * entriesAscending() { for (const [key, value] of this._entriesAscending()) { yield [key, value.value]; } } get size() { if (!this._size) { return this.oldCache.size; } let oldCacheSize = 0; for (const key of this.oldCache.keys()) { if (!this.cache.has(key)) { oldCacheSize++; } } return Math.min(this._size + oldCacheSize, this.maxSize); } entries() { return this.entriesAscending(); } forEach(callbackFunction, thisArgument = this) { for (const [key, value] of this.entriesAscending()) { callbackFunction.call(thisArgument, value, key, this); } } get [Symbol.toStringTag]() { return JSON.stringify([...this.entriesAscending()]); } } export { QuickLRU as default };
// FILE: index.js class QuickLRU extends Map { constructor(options = {}) { super(); if (!(options.maxSize && options.maxSize > 0)) { throw new TypeError('`maxSize` must be a number greater than 0'); } if (typeof options.maxAge === 'number' && options.maxAge === 0) { throw new TypeError('`maxAge` must be a number greater than 0'); } // TODO: Use private class fields when ESLint supports them. this.maxSize = options.maxSize; this.maxAge = options.maxAge || Number.POSITIVE_INFINITY; this.onEviction = options.onEviction; this.cache = new Map(); this.oldCache = new Map(); this._size = 0; } // TODO: Use private class methods when targeting Node.js 16. _emitEvictions(cache) { if (typeof this.onEviction !== 'function') { return; } for (const [key, item] of cache) { this.onEviction(key, item.value); } } _deleteIfExpired(key, item) { if (typeof item.expiry === 'number' && item.expiry <= Date.now()) { if (typeof this.onEviction === 'function') { this.onEviction(key, item.value); } return this.delete(key); } return false; } _getOrDeleteIfExpired(key, item) { const deleted = this._deleteIfExpired(key, item); if (deleted === false) { return item.value; } } _getItemValue(key, item) { return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value; } _peek(key, cache) { const item = cache.get(key); return this._getItemValue(key, item); } _set(key, value) { this.cache.set(key, value); this._size++; if (this._size >= this.maxSize) { this._size = 0; this._emitEvictions(this.oldCache); this.oldCache = this.cache; this.cache = new Map(); } } _moveToRecent(key, item) { this.oldCache.delete(key); this._set(key, item); } * _entriesAscending() { for (const item of this.oldCache) { const [key, value] = item; if (!this.cache.has(key)) { const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield item; } } } for (const item of this.cache) { const [key, value] = item; const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield item; } } } get(key) { if (this.cache.has(key)) { const item = this.cache.get(key); return this._getItemValue(key, item); } if (this.oldCache.has(key)) { const item = this.oldCache.get(key); if (this._deleteIfExpired(key, item) === false) { this._moveToRecent(key, item); return item.value; } } } set(key, value, {maxAge = this.maxAge} = {}) { const expiry = typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : undefined; if (this.cache.has(key)) { this.cache.set(key, { value, expiry }); } else { this._set(key, {value, expiry}); } } has(key) { if (this.cache.has(key)) { return !this._deleteIfExpired(key, this.cache.get(key)); } if (this.oldCache.has(key)) { return !this._deleteIfExpired(key, this.oldCache.get(key)); } return false; } peek(key) { if (this.cache.has(key)) { return this._peek(key, this.cache); } if (this.oldCache.has(key)) { return this._peek(key, this.oldCache); } } delete(key) { const deleted = this.cache.delete(key); if (deleted) { this._size--; } return this.oldCache.delete(key) || deleted; } clear() { this.cache.clear(); this.oldCache.clear(); this._size = 0; } resize(newSize) { if (!(newSize && newSize > 0)) { throw new TypeError('`maxSize` must be a number greater than 0'); } const items = [...this._entriesAscending()]; const removeCount = items.length - newSize; if (removeCount < 0) { this.cache = new Map(items); this.oldCache = new Map(); this._size = items.length; } else { if (removeCount > 0) { this._emitEvictions(items.slice(0, removeCount)); } this.oldCache = new Map(items.slice(removeCount)); this.cache = new Map(); this._size = 0; } this.maxSize = newSize; } * keys() { for (const [key] of this) { yield key; } } * values() { for (const [, value] of this) { yield value; } } * [Symbol.iterator]() { for (const item of this.cache) { const [key, value] = item; const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } for (const item of this.oldCache) { const [key, value] = item; if (!this.cache.has(key)) { const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } } } * entriesDescending() { let items = [...this.cache]; for (let i = items.length - 1; i >= 0; --i) { const item = items[i]; const [key, value] = item; const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } items = [...this.oldCache]; for (let i = items.length - 1; i >= 0; --i) { const item = items[i]; const [key, value] = item; if (!this.cache.has(key)) { const deleted = this._deleteIfExpired(key, value); if (deleted === false) { yield [key, value.value]; } } } } * entriesAscending() { for (const [key, value] of this._entriesAscending()) { yield [key, value.value]; } } get size() { if (!this._size) { return this.oldCache.size; } let oldCacheSize = 0; for (const key of this.oldCache.keys()) { if (!this.cache.has(key)) { oldCacheSize++; } } return Math.min(this._size + oldCacheSize, this.maxSize); } entries() { return this.entriesAscending(); } forEach(callbackFunction, thisArgument = this) { for (const [key, value] of this.entriesAscending()) { callbackFunction.call(thisArgument, value, key, this); } } get [Symbol.toStringTag]() { return JSON.stringify([...this.entriesAscending()]); } } export { QuickLRU as default };
234
25
0
24
26
0
15
0
0
1
5
7.24
2,093
false
@humanwhocodes_object-schema
top1k-untyped-nodeps
12,889
var src = {}; var objectSchema = {}; var mergeStrategy = {}; // FILE: src/merge-strategy.js /** * @filedescription Merge Strategy */ //----------------------------------------------------------------------------- // Class //----------------------------------------------------------------------------- /** * Container class for several different merge strategies. */ let MergeStrategy$2 = class MergeStrategy { /** * Merges two keys by overwriting the first with the second. * @param {*} value1 The value from the first object key. * @param {*} value2 The value from the second object key. * @returns {*} The second value. */ static overwrite(value1, value2) { return value2; } /** * Merges two keys by replacing the first with the second only if the * second is defined. * @param {*} value1 The value from the first object key. * @param {*} value2 The value from the second object key. * @returns {*} The second value if it is defined. */ static replace(value1, value2) { if (typeof value2 !== "undefined") { return value2; } return value1; } /** * Merges two properties by assigning properties from the second to the first. * @param {*} value1 The value from the first object key. * @param {*} value2 The value from the second object key. * @returns {*} A new object containing properties from both value1 and * value2. */ static assign(value1, value2) { return Object.assign({}, value1, value2); } }; mergeStrategy.MergeStrategy = MergeStrategy$2; var validationStrategy = {}; // FILE: src/validation-strategy.js /** * @filedescription Validation Strategy */ //----------------------------------------------------------------------------- // Class //----------------------------------------------------------------------------- /** * Container class for several different validation strategies. */ let ValidationStrategy$2 = class ValidationStrategy { /** * Validates that a value is an array. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static array(value) { if (!Array.isArray(value)) { throw new TypeError("Expected an array."); } } /** * Validates that a value is a boolean. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static boolean(value) { if (typeof value !== "boolean") { throw new TypeError("Expected a Boolean."); } } /** * Validates that a value is a number. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static number(value) { if (typeof value !== "number") { throw new TypeError("Expected a number."); } } /** * Validates that a value is a object. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static object(value) { if (!value || typeof value !== "object") { throw new TypeError("Expected an object."); } } /** * Validates that a value is a object or null. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static "object?"(value) { if (typeof value !== "object") { throw new TypeError("Expected an object or null."); } } /** * Validates that a value is a string. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static string(value) { if (typeof value !== "string") { throw new TypeError("Expected a string."); } } /** * Validates that a value is a non-empty string. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static "string!"(value) { if (typeof value !== "string" || value.length === 0) { throw new TypeError("Expected a non-empty string."); } } }; validationStrategy.ValidationStrategy = ValidationStrategy$2; // FILE: src/object-schema.js /** * @filedescription Object Schema */ //----------------------------------------------------------------------------- // Requirements //----------------------------------------------------------------------------- const { MergeStrategy: MergeStrategy$1 } = mergeStrategy; const { ValidationStrategy: ValidationStrategy$1 } = validationStrategy; //----------------------------------------------------------------------------- // Private //----------------------------------------------------------------------------- const strategies = Symbol("strategies"); const requiredKeys = Symbol("requiredKeys"); /** * Validates a schema strategy. * @param {string} name The name of the key this strategy is for. * @param {Object} strategy The strategy for the object key. * @param {boolean} [strategy.required=true] Whether the key is required. * @param {string[]} [strategy.requires] Other keys that are required when * this key is present. * @param {Function} strategy.merge A method to call when merging two objects * with the same key. * @param {Function} strategy.validate A method to call when validating an * object with the key. * @returns {void} * @throws {Error} When the strategy is missing a name. * @throws {Error} When the strategy is missing a merge() method. * @throws {Error} When the strategy is missing a validate() method. */ function validateDefinition(name, strategy) { let hasSchema = false; if (strategy.schema) { if (typeof strategy.schema === "object") { hasSchema = true; } else { throw new TypeError("Schema must be an object."); } } if (typeof strategy.merge === "string") { if (!(strategy.merge in MergeStrategy$1)) { throw new TypeError(`Definition for key "${name}" missing valid merge strategy.`); } } else if (!hasSchema && typeof strategy.merge !== "function") { throw new TypeError(`Definition for key "${name}" must have a merge property.`); } if (typeof strategy.validate === "string") { if (!(strategy.validate in ValidationStrategy$1)) { throw new TypeError(`Definition for key "${name}" missing valid validation strategy.`); } } else if (!hasSchema && typeof strategy.validate !== "function") { throw new TypeError(`Definition for key "${name}" must have a validate() method.`); } } //----------------------------------------------------------------------------- // Class //----------------------------------------------------------------------------- /** * Represents an object validation/merging schema. */ let ObjectSchema$1 = class ObjectSchema { /** * Creates a new instance. */ constructor(definitions) { if (!definitions) { throw new Error("Schema definitions missing."); } /** * Track all strategies in the schema by key. * @type {Map} * @property strategies */ this[strategies] = new Map(); /** * Separately track any keys that are required for faster validation. * @type {Map} * @property requiredKeys */ this[requiredKeys] = new Map(); // add in all strategies for (const key of Object.keys(definitions)) { validateDefinition(key, definitions[key]); // normalize merge and validate methods if subschema is present if (typeof definitions[key].schema === "object") { const schema = new ObjectSchema(definitions[key].schema); definitions[key] = { ...definitions[key], merge(first = {}, second = {}) { return schema.merge(first, second); }, validate(value) { ValidationStrategy$1.object(value); schema.validate(value); } }; } // normalize the merge method in case there's a string if (typeof definitions[key].merge === "string") { definitions[key] = { ...definitions[key], merge: MergeStrategy$1[definitions[key].merge] }; } // normalize the validate method in case there's a string if (typeof definitions[key].validate === "string") { definitions[key] = { ...definitions[key], validate: ValidationStrategy$1[definitions[key].validate] }; } this[strategies].set(key, definitions[key]); if (definitions[key].required) { this[requiredKeys].set(key, definitions[key]); } } } /** * Determines if a strategy has been registered for the given object key. * @param {string} key The object key to find a strategy for. * @returns {boolean} True if the key has a strategy registered, false if not. */ hasKey(key) { return this[strategies].has(key); } /** * Merges objects together to create a new object comprised of the keys * of the all objects. Keys are merged based on the each key's merge * strategy. * @param {...Object} objects The objects to merge. * @returns {Object} A new object with a mix of all objects' keys. * @throws {Error} If any object is invalid. */ merge(...objects) { // double check arguments if (objects.length < 2) { throw new Error("merge() requires at least two arguments."); } if (objects.some(object => (object == null || typeof object !== "object"))) { throw new Error("All arguments must be objects."); } return objects.reduce((result, object) => { this.validate(object); for (const [key, strategy] of this[strategies]) { try { if (key in result || key in object) { const value = strategy.merge.call(this, result[key], object[key]); if (value !== undefined) { result[key] = value; } } } catch (ex) { ex.message = `Key "${key}": ` + ex.message; throw ex; } } return result; }, {}); } /** * Validates an object's keys based on the validate strategy for each key. * @param {Object} object The object to validate. * @returns {void} * @throws {Error} When the object is invalid. */ validate(object) { // check existing keys first for (const key of Object.keys(object)) { // check to see if the key is defined if (!this.hasKey(key)) { throw new Error(`Unexpected key "${key}" found.`); } // validate existing keys const strategy = this[strategies].get(key); // first check to see if any other keys are required if (Array.isArray(strategy.requires)) { if (!strategy.requires.every(otherKey => otherKey in object)) { throw new Error(`Key "${key}" requires keys "${strategy.requires.join("\", \"")}".`); } } // now apply remaining validation strategy try { strategy.validate.call(strategy, object[key]); } catch (ex) { ex.message = `Key "${key}": ` + ex.message; throw ex; } } // ensure required keys aren't missing for (const [key] of this[requiredKeys]) { if (!(key in object)) { throw new Error(`Missing required key "${key}".`); } } } }; objectSchema.ObjectSchema = ObjectSchema$1; // FILE: src/index.js /** * @filedescription Object Schema Package */ var ObjectSchema = src.ObjectSchema = objectSchema.ObjectSchema; var MergeStrategy = src.MergeStrategy = mergeStrategy.MergeStrategy; var ValidationStrategy = src.ValidationStrategy = validationStrategy.ValidationStrategy; export { MergeStrategy, ObjectSchema, ValidationStrategy, src as default };
var src = {}; var objectSchema = {}; var mergeStrategy = {}; // FILE: src/merge-strategy.js /** * @filedescription Merge Strategy */ //----------------------------------------------------------------------------- // Class //----------------------------------------------------------------------------- /** * Container class for several different merge strategies. */ let MergeStrategy$2 = class MergeStrategy { /** * Merges two keys by overwriting the first with the second. * @param {*} value1 The value from the first object key. * @param {*} value2 The value from the second object key. * @returns {*} The second value. */ static overwrite(value1, value2) { return value2; } /** * Merges two keys by replacing the first with the second only if the * second is defined. * @param {*} value1 The value from the first object key. * @param {*} value2 The value from the second object key. * @returns {*} The second value if it is defined. */ static replace(value1, value2) { if (typeof value2 !== "undefined") { return value2; } return value1; } /** * Merges two properties by assigning properties from the second to the first. * @param {*} value1 The value from the first object key. * @param {*} value2 The value from the second object key. * @returns {*} A new object containing properties from both value1 and * value2. */ static assign(value1, value2) { return Object.assign({}, value1, value2); } }; mergeStrategy.MergeStrategy = MergeStrategy$2; var validationStrategy = {}; // FILE: src/validation-strategy.js /** * @filedescription Validation Strategy */ //----------------------------------------------------------------------------- // Class //----------------------------------------------------------------------------- /** * Container class for several different validation strategies. */ let ValidationStrategy$2 = class ValidationStrategy { /** * Validates that a value is an array. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static array(value) { if (!Array.isArray(value)) { throw new TypeError("Expected an array."); } } /** * Validates that a value is a boolean. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static boolean(value) { if (typeof value !== "boolean") { throw new TypeError("Expected a Boolean."); } } /** * Validates that a value is a number. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static number(value) { if (typeof value !== "number") { throw new TypeError("Expected a number."); } } /** * Validates that a value is a object. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static object(value) { if (!value || typeof value !== "object") { throw new TypeError("Expected an object."); } } /** * Validates that a value is a object or null. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static "object?"(value) { if (typeof value !== "object") { throw new TypeError("Expected an object or null."); } } /** * Validates that a value is a string. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static string(value) { if (typeof value !== "string") { throw new TypeError("Expected a string."); } } /** * Validates that a value is a non-empty string. * @param {*} value The value to validate. * @returns {void} * @throws {TypeError} If the value is invalid. */ static "string!"(value) { if (typeof value !== "string" || value.length === 0) { throw new TypeError("Expected a non-empty string."); } } }; validationStrategy.ValidationStrategy = ValidationStrategy$2; // FILE: src/object-schema.js /** * @filedescription Object Schema */ //----------------------------------------------------------------------------- // Requirements //----------------------------------------------------------------------------- const { MergeStrategy: MergeStrategy$1 } = mergeStrategy; const { ValidationStrategy: ValidationStrategy$1 } = validationStrategy; //----------------------------------------------------------------------------- // Private //----------------------------------------------------------------------------- const strategies = Symbol("strategies"); const requiredKeys = Symbol("requiredKeys"); /** * Validates a schema strategy. * @param {string} name The name of the key this strategy is for. * @param {Object} strategy The strategy for the object key. * @param {boolean} [strategy.required=true] Whether the key is required. * @param {string[]} [strategy.requires] Other keys that are required when * this key is present. * @param {Function} strategy.merge A method to call when merging two objects * with the same key. * @param {Function} strategy.validate A method to call when validating an * object with the key. * @returns {void} * @throws {Error} When the strategy is missing a name. * @throws {Error} When the strategy is missing a merge() method. * @throws {Error} When the strategy is missing a validate() method. */ function validateDefinition(name, strategy) { let hasSchema = false; if (strategy.schema) { if (typeof strategy.schema === "object") { hasSchema = true; } else { throw new TypeError("Schema must be an object."); } } if (typeof strategy.merge === "string") { if (!(strategy.merge in MergeStrategy$1)) { throw new TypeError(`Definition for key "${name}" missing valid merge strategy.`); } } else if (!hasSchema && typeof strategy.merge !== "function") { throw new TypeError(`Definition for key "${name}" must have a merge property.`); } if (typeof strategy.validate === "string") { if (!(strategy.validate in ValidationStrategy$1)) { throw new TypeError(`Definition for key "${name}" missing valid validation strategy.`); } } else if (!hasSchema && typeof strategy.validate !== "function") { throw new TypeError(`Definition for key "${name}" must have a validate() method.`); } } //----------------------------------------------------------------------------- // Class //----------------------------------------------------------------------------- /** * Represents an object validation/merging schema. */ let ObjectSchema$1 = class ObjectSchema { /** * Creates a new instance. */ constructor(definitions) { if (!definitions) { throw new Error("Schema definitions missing."); } /** * Track all strategies in the schema by key. * @type {Map} * @property strategies */ this[strategies] = new Map(); /** * Separately track any keys that are required for faster validation. * @type {Map} * @property requiredKeys */ this[requiredKeys] = new Map(); // add in all strategies for (const key of Object.keys(definitions)) { validateDefinition(key, definitions[key]); // normalize merge and validate methods if subschema is present if (typeof definitions[key].schema === "object") { const schema = new ObjectSchema(definitions[key].schema); definitions[key] = { ...definitions[key], merge(first = {}, second = {}) { return schema.merge(first, second); }, validate(value) { ValidationStrategy$1.object(value); schema.validate(value); } }; } // normalize the merge method in case there's a string if (typeof definitions[key].merge === "string") { definitions[key] = { ...definitions[key], merge: MergeStrategy$1[definitions[key].merge] }; } // normalize the validate method in case there's a string if (typeof definitions[key].validate === "string") { definitions[key] = { ...definitions[key], validate: ValidationStrategy$1[definitions[key].validate] }; } this[strategies].set(key, definitions[key]); if (definitions[key].required) { this[requiredKeys].set(key, definitions[key]); } } } /** * Determines if a strategy has been registered for the given object key. * @param {string} key The object key to find a strategy for. * @returns {boolean} True if the key has a strategy registered, false if not. */ hasKey(key) { return this[strategies].has(key); } /** * Merges objects together to create a new object comprised of the keys * of the all objects. Keys are merged based on the each key's merge * strategy. * @param {...Object} objects The objects to merge. * @returns {Object} A new object with a mix of all objects' keys. * @throws {Error} If any object is invalid. */ merge(...objects) { // double check arguments if (objects.length < 2) { throw new Error("merge() requires at least two arguments."); } if (objects.some(object => (object == null || typeof object !== "object"))) { throw new Error("All arguments must be objects."); } return objects.reduce((result, object) => { this.validate(object); for (const [key, strategy] of this[strategies]) { try { if (key in result || key in object) { const value = strategy.merge.call(this, result[key], object[key]); if (value !== undefined) { result[key] = value; } } } catch (ex) { ex.message = `Key "${key}": ` + ex.message; throw ex; } } return result; }, {}); } /** * Validates an object's keys based on the validate strategy for each key. * @param {Object} object The object to validate. * @returns {void} * @throws {Error} When the object is invalid. */ validate(object) { // check existing keys first for (const key of Object.keys(object)) { // check to see if the key is defined if (!this.hasKey(key)) { throw new Error(`Unexpected key "${key}" found.`); } // validate existing keys const strategy = this[strategies].get(key); // first check to see if any other keys are required if (Array.isArray(strategy.requires)) { if (!strategy.requires.every(otherKey => otherKey in object)) { throw new Error(`Key "${key}" requires keys "${strategy.requires.join("\", \"")}".`); } } // now apply remaining validation strategy try { strategy.validate.call(strategy, object[key]); } catch (ex) { ex.message = `Key "${key}": ` + ex.message; throw ex; } } // ensure required keys aren't missing for (const [key] of this[requiredKeys]) { if (!(key in object)) { throw new Error(`Missing required key "${key}".`); } } } }; objectSchema.ObjectSchema = ObjectSchema$1; // FILE: src/index.js /** * @filedescription Object Schema Package */ var ObjectSchema = src.ObjectSchema = objectSchema.ObjectSchema; var MergeStrategy = src.MergeStrategy = mergeStrategy.MergeStrategy; var ValidationStrategy = src.ValidationStrategy = validationStrategy.ValidationStrategy; export { MergeStrategy, ObjectSchema, ValidationStrategy, src as default };
183
20
0
26
18
0
6
0
0
0
16
7.6
2,720
false
makeerror
top1k-untyped-with-typed-deps
2,772
import require$$0 from 'tmpl'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/makeerror.js var tmpl = require$$0; var makeerror = makeError; function BaseError() {} BaseError.prototype = new Error(); BaseError.prototype.toString = function() { return this.message }; /** * Makes an Error function with the signature: * * function(message, data) * * You'll typically do something like: * * var UnknownFileTypeError = makeError( * 'UnknownFileTypeError', * 'The specified type is not known.' * ) * var er = UnknownFileTypeError() * * `er` will have a prototype chain that ensures: * * er instanceof Error * er instanceof UnknownFileTypeError * * You can also do `var er = new UnknownFileTypeError()` if you really like the * `new` keyword. * * @param String The name of the error. * @param String The default message string. * @param Object The default data object, merged with per instance data. */ function makeError(name, defaultMessage, defaultData) { defaultMessage = tmpl(defaultMessage || ''); defaultData = defaultData || {}; if (defaultData.proto && !(defaultData.proto instanceof BaseError)) throw new Error('The custom "proto" must be an Error created via makeError') var CustomError = function(message, data) { if (!(this instanceof CustomError)) return new CustomError(message, data) if (typeof message !== 'string' && !data) { data = message; message = null; } this.name = name; this.data = data || defaultData; if (typeof message === 'string') { this.message = tmpl(message, this.data); } else { this.message = defaultMessage(this.data); } var er = new Error(); this.stack = er.stack; if (this.stack) { // remove TWO stack level: if (typeof Components !== 'undefined') { // Mozilla: this.stack = this.stack.substring(this.stack.indexOf('\n') + 2); } else if (typeof chrome !== 'undefined' || typeof process !== 'undefined') { // Google Chrome/Node.js: this.stack = this.stack.replace(/\n[^\n]*/, ''); this.stack = this.stack.replace(/\n[^\n]*/, ''); this.stack = ( this.name + (this.message ? (': ' + this.message) : '') + this.stack.substring(5) ); } } if ('fileName' in er) this.fileName = er.fileName; if ('lineNumber' in er) this.lineNumber = er.lineNumber; }; CustomError.prototype = defaultData.proto || new BaseError(); delete defaultData.proto; return CustomError } var makeerror$1 = /*@__PURE__*/getDefaultExportFromCjs(makeerror); export { makeerror$1 as default };
import require$$0 from 'tmpl'; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } // FILE: lib/makeerror.js var tmpl = require$$0; var makeerror = makeError; function BaseError() {} BaseError.prototype = new Error(); BaseError.prototype.toString = function() { return this.message }; /** * Makes an Error function with the signature: * * function(message, data) * * You'll typically do something like: * * var UnknownFileTypeError = makeError( * 'UnknownFileTypeError', * 'The specified type is not known.' * ) * var er = UnknownFileTypeError() * * `er` will have a prototype chain that ensures: * * er instanceof Error * er instanceof UnknownFileTypeError * * You can also do `var er = new UnknownFileTypeError()` if you really like the * `new` keyword. * * @param String The name of the error. * @param String The default message string. * @param Object The default data object, merged with per instance data. */ function makeError(name, defaultMessage, defaultData) { defaultMessage = tmpl(defaultMessage || ''); defaultData = defaultData || {}; if (defaultData.proto && !(defaultData.proto instanceof BaseError)) throw new Error('The custom "proto" must be an Error created via makeError') var CustomError = function(message, data) { if (!(this instanceof CustomError)) return new CustomError(message, data) if (typeof message !== 'string' && !data) { data = message; message = null; } this.name = name; this.data = data || defaultData; if (typeof message === 'string') { this.message = tmpl(message, this.data); } else { this.message = defaultMessage(this.data); } var er = new Error(); this.stack = er.stack; if (this.stack) { // remove TWO stack level: if (typeof Components !== 'undefined') { // Mozilla: this.stack = this.stack.substring(this.stack.indexOf('\n') + 2); } else if (typeof chrome !== 'undefined' || typeof process !== 'undefined') { // Google Chrome/Node.js: this.stack = this.stack.replace(/\n[^\n]*/, ''); this.stack = this.stack.replace(/\n[^\n]*/, ''); this.stack = ( this.name + (this.message ? (': ' + this.message) : '') + this.stack.substring(5) ); } } if ('fileName' in er) this.fileName = er.fileName; if ('lineNumber' in er) this.lineNumber = er.lineNumber; }; CustomError.prototype = defaultData.proto || new BaseError(); delete defaultData.proto; return CustomError } var makeerror$1 = /*@__PURE__*/getDefaultExportFromCjs(makeerror); export { makeerror$1 as default };
53
5
0
6
5
0
1
0
0
0
7
13.8
749
false

Dataset Card for "stenotype-eval-js"

This is one of the datasets used to evaluate StenoType (model, GitHub). This dataset is called typeweaver-bundle-filtered-subset in the code and JS-Sourced in the dissertation.

The dataset is derived from the TypeWeaver benchmarks, with multi-file projects bundled into single files, and filtered. For more details, see the StenoType GitHub repository and the linked dissertation.

To type check this dataset, a tarball containing the type declaration (.d.ts) files is included in type_declarations.tar.gz.

Versions

The evaluation dataset is a sample of 50 files from the "filtered" dataset, which can be found in the branch filtered.

The filtered dataset is derived from the full dataset, which can be found in the branch full.

Downloads last month
0
Edit dataset card

Collection including nuprl/stenotype-eval-js