Comparing version 0.0.1 to 1.0.0
1628
loupe.js
@@ -1,621 +0,1193 @@ | ||
;(function(){ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.loupe = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
/** | ||
* Require the given path. | ||
* | ||
* @param {String} path | ||
* @return {Object} exports | ||
* @api public | ||
*/ | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function require(path, parent, orig) { | ||
var resolved = require.resolve(path); | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
// lookup failed | ||
if (null == resolved) { | ||
orig = orig || path; | ||
parent = parent || 'root'; | ||
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); | ||
err.path = orig; | ||
err.parent = parent; | ||
err.require = true; | ||
throw err; | ||
} | ||
var typeDetect = createCommonjsModule(function (module, exports) { | ||
(function (global, factory) { | ||
module.exports = factory() ; | ||
}(commonjsGlobal, (function () { | ||
/* ! | ||
* type-detect | ||
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
var promiseExists = typeof Promise === 'function'; | ||
var module = require.modules[resolved]; | ||
/* eslint-disable no-undef */ | ||
var globalObject = typeof self === 'object' ? self : commonjsGlobal; // eslint-disable-line id-blacklist | ||
// perform real require() | ||
// by invoking the module's | ||
// registered function | ||
if (!module._resolving && !module.exports) { | ||
var mod = {}; | ||
mod.exports = {}; | ||
mod.client = mod.component = true; | ||
module._resolving = true; | ||
module.call(this, mod.exports, require.relative(resolved), mod); | ||
delete module._resolving; | ||
module.exports = mod.exports; | ||
} | ||
var symbolExists = typeof Symbol !== 'undefined'; | ||
var mapExists = typeof Map !== 'undefined'; | ||
var setExists = typeof Set !== 'undefined'; | ||
var weakMapExists = typeof WeakMap !== 'undefined'; | ||
var weakSetExists = typeof WeakSet !== 'undefined'; | ||
var dataViewExists = typeof DataView !== 'undefined'; | ||
var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined'; | ||
var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined'; | ||
var setEntriesExists = setExists && typeof Set.prototype.entries === 'function'; | ||
var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function'; | ||
var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries()); | ||
var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries()); | ||
var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function'; | ||
var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]()); | ||
var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function'; | ||
var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]()); | ||
var toStringLeftSliceLength = 8; | ||
var toStringRightSliceLength = -1; | ||
/** | ||
* ### typeOf (obj) | ||
* | ||
* Uses `Object.prototype.toString` to determine the type of an object, | ||
* normalising behaviour across engine versions & well optimised. | ||
* | ||
* @param {Mixed} object | ||
* @return {String} object type | ||
* @api public | ||
*/ | ||
function typeDetect(obj) { | ||
/* ! Speed optimisation | ||
* Pre: | ||
* string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled) | ||
* boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled) | ||
* number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled) | ||
* undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled) | ||
* function x 2,556,769 ops/sec ±1.73% (77 runs sampled) | ||
* Post: | ||
* string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled) | ||
* boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled) | ||
* number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled) | ||
* undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled) | ||
* function x 31,296,870 ops/sec ±0.96% (83 runs sampled) | ||
*/ | ||
var typeofObj = typeof obj; | ||
if (typeofObj !== 'object') { | ||
return typeofObj; | ||
} | ||
return module.exports; | ||
} | ||
/* ! Speed optimisation | ||
* Pre: | ||
* null x 28,645,765 ops/sec ±1.17% (82 runs sampled) | ||
* Post: | ||
* null x 36,428,962 ops/sec ±1.37% (84 runs sampled) | ||
*/ | ||
if (obj === null) { | ||
return 'null'; | ||
} | ||
/** | ||
* Registered modules. | ||
*/ | ||
/* ! Spec Conformance | ||
* Test: `Object.prototype.toString.call(window)`` | ||
* - Node === "[object global]" | ||
* - Chrome === "[object global]" | ||
* - Firefox === "[object Window]" | ||
* - PhantomJS === "[object Window]" | ||
* - Safari === "[object Window]" | ||
* - IE 11 === "[object Window]" | ||
* - IE Edge === "[object Window]" | ||
* Test: `Object.prototype.toString.call(this)`` | ||
* - Chrome Worker === "[object global]" | ||
* - Firefox Worker === "[object DedicatedWorkerGlobalScope]" | ||
* - Safari Worker === "[object DedicatedWorkerGlobalScope]" | ||
* - IE 11 Worker === "[object WorkerGlobalScope]" | ||
* - IE Edge Worker === "[object WorkerGlobalScope]" | ||
*/ | ||
if (obj === globalObject) { | ||
return 'global'; | ||
} | ||
require.modules = {}; | ||
/* ! Speed optimisation | ||
* Pre: | ||
* array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled) | ||
* Post: | ||
* array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled) | ||
*/ | ||
if ( | ||
Array.isArray(obj) && | ||
(symbolToStringTagExists === false || !(Symbol.toStringTag in obj)) | ||
) { | ||
return 'Array'; | ||
} | ||
/** | ||
* Registered aliases. | ||
*/ | ||
// Not caching existence of `window` and related properties due to potential | ||
// for `window` to be unset before tests in quasi-browser environments. | ||
if (typeof window === 'object' && window !== null) { | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/browsers.html#location) | ||
* WhatWG HTML$7.7.3 - The `Location` interface | ||
* Test: `Object.prototype.toString.call(window.location)`` | ||
* - IE <=11 === "[object Object]" | ||
* - IE Edge <=13 === "[object Object]" | ||
*/ | ||
if (typeof window.location === 'object' && obj === window.location) { | ||
return 'Location'; | ||
} | ||
require.aliases = {}; | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/#document) | ||
* WhatWG HTML$3.1.1 - The `Document` object | ||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec | ||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268) | ||
* which suggests that browsers should use HTMLTableCellElement for | ||
* both TD and TH elements. WhatWG separates these. | ||
* WhatWG HTML states: | ||
* > For historical reasons, Window objects must also have a | ||
* > writable, configurable, non-enumerable property named | ||
* > HTMLDocument whose value is the Document interface object. | ||
* Test: `Object.prototype.toString.call(document)`` | ||
* - Chrome === "[object HTMLDocument]" | ||
* - Firefox === "[object HTMLDocument]" | ||
* - Safari === "[object HTMLDocument]" | ||
* - IE <=10 === "[object Document]" | ||
* - IE 11 === "[object HTMLDocument]" | ||
* - IE Edge <=13 === "[object HTMLDocument]" | ||
*/ | ||
if (typeof window.document === 'object' && obj === window.document) { | ||
return 'Document'; | ||
} | ||
/** | ||
* Resolve `path`. | ||
* | ||
* Lookup: | ||
* | ||
* - PATH/index.js | ||
* - PATH.js | ||
* - PATH | ||
* | ||
* @param {String} path | ||
* @return {String} path or null | ||
* @api private | ||
*/ | ||
if (typeof window.navigator === 'object') { | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray) | ||
* WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray | ||
* Test: `Object.prototype.toString.call(navigator.mimeTypes)`` | ||
* - IE <=10 === "[object MSMimeTypesCollection]" | ||
*/ | ||
if (typeof window.navigator.mimeTypes === 'object' && | ||
obj === window.navigator.mimeTypes) { | ||
return 'MimeTypeArray'; | ||
} | ||
require.resolve = function(path) { | ||
if (path.charAt(0) === '/') path = path.slice(1); | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) | ||
* WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray | ||
* Test: `Object.prototype.toString.call(navigator.plugins)`` | ||
* - IE <=10 === "[object MSPluginsCollection]" | ||
*/ | ||
if (typeof window.navigator.plugins === 'object' && | ||
obj === window.navigator.plugins) { | ||
return 'PluginArray'; | ||
} | ||
} | ||
var paths = [ | ||
path, | ||
path + '.js', | ||
path + '.json', | ||
path + '/index.js', | ||
path + '/index.json' | ||
]; | ||
if ((typeof window.HTMLElement === 'function' || | ||
typeof window.HTMLElement === 'object') && | ||
obj instanceof window.HTMLElement) { | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) | ||
* WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement` | ||
* Test: `Object.prototype.toString.call(document.createElement('blockquote'))`` | ||
* - IE <=10 === "[object HTMLBlockElement]" | ||
*/ | ||
if (obj.tagName === 'BLOCKQUOTE') { | ||
return 'HTMLQuoteElement'; | ||
} | ||
for (var i = 0; i < paths.length; i++) { | ||
var path = paths[i]; | ||
if (require.modules.hasOwnProperty(path)) return path; | ||
if (require.aliases.hasOwnProperty(path)) return require.aliases[path]; | ||
} | ||
}; | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/#htmltabledatacellelement) | ||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement` | ||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec | ||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) | ||
* which suggests that browsers should use HTMLTableCellElement for | ||
* both TD and TH elements. WhatWG separates these. | ||
* Test: Object.prototype.toString.call(document.createElement('td')) | ||
* - Chrome === "[object HTMLTableCellElement]" | ||
* - Firefox === "[object HTMLTableCellElement]" | ||
* - Safari === "[object HTMLTableCellElement]" | ||
*/ | ||
if (obj.tagName === 'TD') { | ||
return 'HTMLTableDataCellElement'; | ||
} | ||
/** | ||
* Normalize `path` relative to the current path. | ||
* | ||
* @param {String} curr | ||
* @param {String} path | ||
* @return {String} | ||
* @api private | ||
*/ | ||
/* ! Spec Conformance | ||
* (https://html.spec.whatwg.org/#htmltableheadercellelement) | ||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement` | ||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec | ||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) | ||
* which suggests that browsers should use HTMLTableCellElement for | ||
* both TD and TH elements. WhatWG separates these. | ||
* Test: Object.prototype.toString.call(document.createElement('th')) | ||
* - Chrome === "[object HTMLTableCellElement]" | ||
* - Firefox === "[object HTMLTableCellElement]" | ||
* - Safari === "[object HTMLTableCellElement]" | ||
*/ | ||
if (obj.tagName === 'TH') { | ||
return 'HTMLTableHeaderCellElement'; | ||
} | ||
} | ||
} | ||
require.normalize = function(curr, path) { | ||
var segs = []; | ||
/* ! Speed optimisation | ||
* Pre: | ||
* Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled) | ||
* Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled) | ||
* Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled) | ||
* Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled) | ||
* Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled) | ||
* Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled) | ||
* Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled) | ||
* Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled) | ||
* Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled) | ||
* Post: | ||
* Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled) | ||
* Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled) | ||
* Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled) | ||
* Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled) | ||
* Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled) | ||
* Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled) | ||
* Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled) | ||
* Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled) | ||
* Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled) | ||
*/ | ||
var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]); | ||
if (typeof stringTag === 'string') { | ||
return stringTag; | ||
} | ||
if ('.' != path.charAt(0)) return path; | ||
var objPrototype = Object.getPrototypeOf(obj); | ||
/* ! Speed optimisation | ||
* Pre: | ||
* regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled) | ||
* regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled) | ||
* Post: | ||
* regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled) | ||
* regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled) | ||
*/ | ||
if (objPrototype === RegExp.prototype) { | ||
return 'RegExp'; | ||
} | ||
curr = curr.split('/'); | ||
path = path.split('/'); | ||
/* ! Speed optimisation | ||
* Pre: | ||
* date x 2,130,074 ops/sec ±4.42% (68 runs sampled) | ||
* Post: | ||
* date x 3,953,779 ops/sec ±1.35% (77 runs sampled) | ||
*/ | ||
if (objPrototype === Date.prototype) { | ||
return 'Date'; | ||
} | ||
for (var i = 0; i < path.length; ++i) { | ||
if ('..' == path[i]) { | ||
curr.pop(); | ||
} else if ('.' != path[i] && '' != path[i]) { | ||
segs.push(path[i]); | ||
} | ||
} | ||
/* ! Spec Conformance | ||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag) | ||
* ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise": | ||
* Test: `Object.prototype.toString.call(Promise.resolve())`` | ||
* - Chrome <=47 === "[object Object]" | ||
* - Edge <=20 === "[object Object]" | ||
* - Firefox 29-Latest === "[object Promise]" | ||
* - Safari 7.1-Latest === "[object Promise]" | ||
*/ | ||
if (promiseExists && objPrototype === Promise.prototype) { | ||
return 'Promise'; | ||
} | ||
return curr.concat(segs).join('/'); | ||
}; | ||
/* ! Speed optimisation | ||
* Pre: | ||
* set x 2,222,186 ops/sec ±1.31% (82 runs sampled) | ||
* Post: | ||
* set x 4,545,879 ops/sec ±1.13% (83 runs sampled) | ||
*/ | ||
if (setExists && objPrototype === Set.prototype) { | ||
return 'Set'; | ||
} | ||
/** | ||
* Register module at `path` with callback `definition`. | ||
* | ||
* @param {String} path | ||
* @param {Function} definition | ||
* @api private | ||
*/ | ||
/* ! Speed optimisation | ||
* Pre: | ||
* map x 2,396,842 ops/sec ±1.59% (81 runs sampled) | ||
* Post: | ||
* map x 4,183,945 ops/sec ±6.59% (82 runs sampled) | ||
*/ | ||
if (mapExists && objPrototype === Map.prototype) { | ||
return 'Map'; | ||
} | ||
require.register = function(path, definition) { | ||
require.modules[path] = definition; | ||
}; | ||
/* ! Speed optimisation | ||
* Pre: | ||
* weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled) | ||
* Post: | ||
* weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled) | ||
*/ | ||
if (weakSetExists && objPrototype === WeakSet.prototype) { | ||
return 'WeakSet'; | ||
} | ||
/** | ||
* Alias a module definition. | ||
* | ||
* @param {String} from | ||
* @param {String} to | ||
* @api private | ||
*/ | ||
/* ! Speed optimisation | ||
* Pre: | ||
* weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled) | ||
* Post: | ||
* weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled) | ||
*/ | ||
if (weakMapExists && objPrototype === WeakMap.prototype) { | ||
return 'WeakMap'; | ||
} | ||
require.alias = function(from, to) { | ||
if (!require.modules.hasOwnProperty(from)) { | ||
throw new Error('Failed to alias "' + from + '", it does not exist'); | ||
} | ||
require.aliases[to] = from; | ||
}; | ||
/* ! Spec Conformance | ||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag) | ||
* ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView": | ||
* Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))`` | ||
* - Edge <=13 === "[object Object]" | ||
*/ | ||
if (dataViewExists && objPrototype === DataView.prototype) { | ||
return 'DataView'; | ||
} | ||
/** | ||
* Return a require function relative to the `parent` path. | ||
* | ||
* @param {String} parent | ||
* @return {Function} | ||
* @api private | ||
*/ | ||
/* ! Spec Conformance | ||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag) | ||
* ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator": | ||
* Test: `Object.prototype.toString.call(new Map().entries())`` | ||
* - Edge <=13 === "[object Object]" | ||
*/ | ||
if (mapExists && objPrototype === mapIteratorPrototype) { | ||
return 'Map Iterator'; | ||
} | ||
require.relative = function(parent) { | ||
var p = require.normalize(parent, '..'); | ||
/* ! Spec Conformance | ||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag) | ||
* ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator": | ||
* Test: `Object.prototype.toString.call(new Set().entries())`` | ||
* - Edge <=13 === "[object Object]" | ||
*/ | ||
if (setExists && objPrototype === setIteratorPrototype) { | ||
return 'Set Iterator'; | ||
} | ||
/** | ||
* lastIndexOf helper. | ||
*/ | ||
/* ! Spec Conformance | ||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag) | ||
* ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator": | ||
* Test: `Object.prototype.toString.call([][Symbol.iterator]())`` | ||
* - Edge <=13 === "[object Object]" | ||
*/ | ||
if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) { | ||
return 'Array Iterator'; | ||
} | ||
function lastIndexOf(arr, obj) { | ||
var i = arr.length; | ||
while (i--) { | ||
if (arr[i] === obj) return i; | ||
} | ||
return -1; | ||
} | ||
/* ! Spec Conformance | ||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag) | ||
* ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator": | ||
* Test: `Object.prototype.toString.call(''[Symbol.iterator]())`` | ||
* - Edge <=13 === "[object Object]" | ||
*/ | ||
if (stringIteratorExists && objPrototype === stringIteratorPrototype) { | ||
return 'String Iterator'; | ||
} | ||
/** | ||
* The relative require() itself. | ||
*/ | ||
/* ! Speed optimisation | ||
* Pre: | ||
* object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled) | ||
* Post: | ||
* object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled) | ||
*/ | ||
if (objPrototype === null) { | ||
return 'Object'; | ||
} | ||
function localRequire(path) { | ||
var resolved = localRequire.resolve(path); | ||
return require(resolved, parent, path); | ||
} | ||
return Object | ||
.prototype | ||
.toString | ||
.call(obj) | ||
.slice(toStringLeftSliceLength, toStringRightSliceLength); | ||
} | ||
/** | ||
* Resolve relative to the parent. | ||
*/ | ||
return typeDetect; | ||
localRequire.resolve = function(path) { | ||
var c = path.charAt(0); | ||
if ('/' == c) return path.slice(1); | ||
if ('.' == c) return require.normalize(p, path); | ||
}))); | ||
}); | ||
// resolve deps by returning | ||
// the dep in the nearest "deps" | ||
// directory | ||
var segs = parent.split('/'); | ||
var i = lastIndexOf(segs, 'deps') + 1; | ||
if (!i) i = 0; | ||
path = segs.slice(0, i + 1).join('/') + '/deps/' + path; | ||
return path; | ||
}; | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
/** | ||
* Check if module is defined at `path`. | ||
*/ | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
localRequire.exists = function(path) { | ||
return require.modules.hasOwnProperty(localRequire.resolve(path)); | ||
}; | ||
function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
return localRequire; | ||
}; | ||
require.register("loupe/lib/loupe.js", function(exports, require, module){ | ||
// This is (almost) directly from Node.js utils | ||
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
var getName = require('./getName'); | ||
var getProperties = require('./getProperties'); | ||
var getEnumerableProperties = require('./getEnumerableProperties'); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
module.exports = inspect; | ||
return _arr; | ||
} | ||
/** | ||
* Echos the value of a value. Trys to print the value out | ||
* in the best way possible given the different types. | ||
* | ||
* @param {Object} obj The object to print out. | ||
* @param {Boolean} showHidden Flag that shows hidden (not enumerable) | ||
* properties of objects. | ||
* @param {Number} depth Depth in which to descend in object. Default is 2. | ||
* @param {Boolean} colors Flag to turn on ANSI escape codes to color the | ||
* output. Default is false (no coloring). | ||
*/ | ||
function inspect(obj, showHidden, depth, colors) { | ||
var ctx = { | ||
showHidden: showHidden, | ||
seen: [], | ||
stylize: function (str) { return str; } | ||
}; | ||
return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth)); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
// https://gist.github.com/1044128/ | ||
var getOuterHTML = function(element) { | ||
if ('outerHTML' in element) return element.outerHTML; | ||
var ns = "http://www.w3.org/1999/xhtml"; | ||
var container = document.createElementNS(ns, '_'); | ||
var elemProto = (window.HTMLElement || window.Element).prototype; | ||
var xmlSerializer = new XMLSerializer(); | ||
var html; | ||
if (document.xmlVersion) { | ||
return xmlSerializer.serializeToString(element); | ||
} else { | ||
container.appendChild(element.cloneNode(false)); | ||
html = container.innerHTML.replace('><', '>' + element.innerHTML + '<'); | ||
container.innerHTML = ''; | ||
return html; | ||
} | ||
}; | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
// Returns true if object is a DOM element. | ||
var isDOMElement = function (object) { | ||
if (typeof HTMLElement === 'object') { | ||
return object instanceof HTMLElement; | ||
} else { | ||
return object && | ||
typeof object === 'object' && | ||
object.nodeType === 1 && | ||
typeof object.nodeName === 'string'; | ||
} | ||
}; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
function formatValue(ctx, value, recurseTimes) { | ||
// Provide a hook for user-specified inspect functions. | ||
// Check that value is an object with an inspect function on it | ||
if (value && typeof value.inspect === 'function' && | ||
// Filter out the util module, it's inspect function is special | ||
value.inspect !== exports.inspect && | ||
// Also filter out any prototype objects using the circular check. | ||
!(value.constructor && value.constructor.prototype === value)) { | ||
var ret = value.inspect(recurseTimes); | ||
if (typeof ret !== 'string') { | ||
ret = formatValue(ctx, ret, recurseTimes); | ||
} | ||
return ret; | ||
} | ||
return arr2; | ||
} | ||
// Primitive types cannot have properties | ||
var primitive = formatPrimitive(ctx, value); | ||
if (primitive) { | ||
return primitive; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
// If it's DOM elem, get outer HTML. | ||
if (isDOMElement(value)) { | ||
return getOuterHTML(value); | ||
} | ||
var ansiColors = { | ||
bold: ['1', '22'], | ||
dim: ['2', '22'], | ||
italic: ['3', '23'], | ||
underline: ['4', '24'], | ||
// 5 & 6 are blinking | ||
inverse: ['7', '27'], | ||
hidden: ['8', '28'], | ||
strike: ['9', '29'], | ||
// 10-20 are fonts | ||
// 21-29 are resets for 1-9 | ||
black: ['30', '39'], | ||
red: ['31', '39'], | ||
green: ['32', '39'], | ||
yellow: ['33', '39'], | ||
blue: ['34', '39'], | ||
magenta: ['35', '39'], | ||
cyan: ['36', '39'], | ||
white: ['37', '39'], | ||
brightblack: ['30;1', '39'], | ||
brightred: ['31;1', '39'], | ||
brightgreen: ['32;1', '39'], | ||
brightyellow: ['33;1', '39'], | ||
brightblue: ['34;1', '39'], | ||
brightmagenta: ['35;1', '39'], | ||
brightcyan: ['36;1', '39'], | ||
brightwhite: ['37;1', '39'], | ||
grey: ['90', '39'] | ||
}; | ||
var styles = { | ||
special: 'cyan', | ||
number: 'yellow', | ||
boolean: 'yellow', | ||
undefined: 'grey', | ||
null: 'bold', | ||
string: 'green', | ||
symbol: 'green', | ||
date: 'magenta', | ||
regexp: 'red' | ||
}; | ||
var truncator = '…'; | ||
// Look up the keys of the object. | ||
var visibleKeys = getEnumerableProperties(value); | ||
var keys = ctx.showHidden ? getProperties(value) : visibleKeys; | ||
function colorise(value, styleType) { | ||
var color = ansiColors[styles[styleType]] || ansiColors[styleType]; | ||
// Some type of object without properties can be shortcutted. | ||
// In IE, errors have a single `stack` property, or if they are vanilla `Error`, | ||
// a `stack` plus `description` property; ignore those for consistency. | ||
if (keys.length === 0 || (isError(value) && ( | ||
(keys.length === 1 && keys[0] === 'stack') || | ||
(keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack') | ||
))) { | ||
if (typeof value === 'function') { | ||
var name = getName(value); | ||
var nameSuffix = name ? ': ' + name : ''; | ||
return ctx.stylize('[Function' + nameSuffix + ']', 'special'); | ||
} | ||
if (isRegExp(value)) { | ||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | ||
} | ||
if (isDate(value)) { | ||
return ctx.stylize(Date.prototype.toUTCString.call(value), 'date'); | ||
} | ||
if (isError(value)) { | ||
return formatError(value); | ||
} | ||
} | ||
if (!color) { | ||
return String(value); | ||
} | ||
var base = '', array = false, braces = ['{', '}']; | ||
return "\x1B[".concat(color[0], "m").concat(String(value), "\x1B[").concat(color[1], "m"); | ||
} | ||
// Make Array say that they are Array | ||
if (isArray(value)) { | ||
array = true; | ||
braces = ['[', ']']; | ||
} | ||
function normaliseOptions() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$showHidden = _ref.showHidden, | ||
showHidden = _ref$showHidden === void 0 ? false : _ref$showHidden, | ||
_ref$depth = _ref.depth, | ||
depth = _ref$depth === void 0 ? 2 : _ref$depth, | ||
_ref$colors = _ref.colors, | ||
colors = _ref$colors === void 0 ? false : _ref$colors, | ||
_ref$customInspect = _ref.customInspect, | ||
customInspect = _ref$customInspect === void 0 ? true : _ref$customInspect, | ||
_ref$showProxy = _ref.showProxy, | ||
showProxy = _ref$showProxy === void 0 ? false : _ref$showProxy, | ||
_ref$maxArrayLength = _ref.maxArrayLength, | ||
maxArrayLength = _ref$maxArrayLength === void 0 ? Infinity : _ref$maxArrayLength, | ||
_ref$breakLength = _ref.breakLength, | ||
breakLength = _ref$breakLength === void 0 ? Infinity : _ref$breakLength, | ||
_ref$seen = _ref.seen, | ||
seen = _ref$seen === void 0 ? [] : _ref$seen, | ||
_ref$truncate = _ref.truncate, | ||
truncate = _ref$truncate === void 0 ? Infinity : _ref$truncate, | ||
_ref$stylize = _ref.stylize, | ||
stylize = _ref$stylize === void 0 ? String : _ref$stylize; | ||
// Make functions say that they are functions | ||
if (typeof value === 'function') { | ||
var name = getName(value); | ||
var nameSuffix = name ? ': ' + name : ''; | ||
base = ' [Function' + nameSuffix + ']'; | ||
} | ||
var options = { | ||
showHidden: Boolean(showHidden), | ||
depth: Number(depth), | ||
colors: Boolean(colors), | ||
customInspect: Boolean(customInspect), | ||
showProxy: Boolean(showProxy), | ||
maxArrayLength: Number(maxArrayLength), | ||
breakLength: Number(breakLength), | ||
truncate: Number(truncate), | ||
seen: seen, | ||
stylize: stylize | ||
}; | ||
// Make RegExps say that they are RegExps | ||
if (isRegExp(value)) { | ||
base = ' ' + RegExp.prototype.toString.call(value); | ||
} | ||
if (options.colors) { | ||
options.stylize = colorise; | ||
} | ||
// Make dates with properties first say the date | ||
if (isDate(value)) { | ||
base = ' ' + Date.prototype.toUTCString.call(value); | ||
} | ||
return options; | ||
} | ||
function truncate(string, length) { | ||
var tail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : truncator; | ||
string = String(string); | ||
var tailLength = tail.length; | ||
var stringLength = string.length; | ||
// Make error with message first say the error | ||
if (isError(value)) { | ||
return formatError(value); | ||
} | ||
if (tailLength > length && stringLength > tailLength) { | ||
return tail; | ||
} | ||
if (keys.length === 0 && (!array || value.length == 0)) { | ||
return braces[0] + base + braces[1]; | ||
} | ||
if (stringLength > length && stringLength > tailLength) { | ||
return "".concat(string.slice(0, length - tailLength)).concat(tail); | ||
} | ||
if (recurseTimes < 0) { | ||
if (isRegExp(value)) { | ||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | ||
} else { | ||
return ctx.stylize('[Object]', 'special'); | ||
} | ||
} | ||
return string; | ||
} // eslint-disable-next-line complexity | ||
ctx.seen.push(value); | ||
function inspectList(list, options, inspectItem) { | ||
var separator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ', '; | ||
inspectItem = inspectItem || options.inspect; | ||
var size = list.length; | ||
if (size === 0) return ''; | ||
var originalLength = options.truncate; | ||
var output = ''; | ||
var peek = ''; | ||
var truncated = ''; | ||
var output; | ||
if (array) { | ||
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); | ||
} else { | ||
output = keys.map(function(key) { | ||
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); | ||
}); | ||
} | ||
for (var i = 0; i < size; i += 1) { | ||
var last = i + 1 === list.length; | ||
var secondToLast = i + 2 === list.length; | ||
truncated = "".concat(truncator, "(").concat(list.length - i, ")"); | ||
var value = list[i]; // If there is more than one remaining we need to account for a separator of `, ` | ||
ctx.seen.pop(); | ||
options.truncate = originalLength - output.length - (last ? 0 : separator.length); | ||
var string = peek || inspectItem(value, options) + (last ? '' : separator); | ||
var nextLength = output.length + string.length; | ||
var truncatedLength = nextLength + truncated.length; // If this is the last element, and adding it would | ||
// take us over length, but adding the truncator wouldn't - then break now | ||
return reduceToSingleString(output, base, braces); | ||
} | ||
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) { | ||
break; | ||
} // If this isn't the last or second to last element to scan, | ||
// but the string is already over length then break here | ||
function formatPrimitive(ctx, value) { | ||
switch (typeof value) { | ||
case 'undefined': | ||
return ctx.stylize('undefined', 'undefined'); | ||
if (!last && !secondToLast && truncatedLength > originalLength) { | ||
break; | ||
} // Peek at the next string to determine if we should | ||
// break early before adding this item to the output | ||
case 'string': | ||
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') | ||
.replace(/'/g, "\\'") | ||
.replace(/\\"/g, '"') + '\''; | ||
return ctx.stylize(simple, 'string'); | ||
case 'number': | ||
return ctx.stylize('' + value, 'number'); | ||
peek = last ? '' : inspectItem(list[i + 1], options) + (secondToLast ? '' : separator); // If we have one element left, but this element and | ||
// the next takes over length, the break early | ||
case 'boolean': | ||
return ctx.stylize('' + value, 'boolean'); | ||
} | ||
// For some reason typeof null is "object", so special case here. | ||
if (value === null) { | ||
return ctx.stylize('null', 'null'); | ||
} | ||
} | ||
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) { | ||
break; | ||
} | ||
output += string; // If the next element takes us to length - | ||
// but there are more after that, then we should truncate now | ||
function formatError(value) { | ||
return '[' + Error.prototype.toString.call(value) + ']'; | ||
} | ||
if (!last && !secondToLast && nextLength + peek.length >= originalLength) { | ||
truncated = "".concat(truncator, "(").concat(list.length - i - 1, ")"); | ||
break; | ||
} | ||
truncated = ''; | ||
} | ||
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { | ||
var output = []; | ||
for (var i = 0, l = value.length; i < l; ++i) { | ||
if (Object.prototype.hasOwnProperty.call(value, String(i))) { | ||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | ||
String(i), true)); | ||
} else { | ||
output.push(''); | ||
} | ||
} | ||
keys.forEach(function(key) { | ||
if (!key.match(/^\d+$/)) { | ||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | ||
key, true)); | ||
} | ||
}); | ||
return output; | ||
} | ||
return "".concat(output).concat(truncated); | ||
} | ||
function inspectProperty(_ref2, options) { | ||
var _ref3 = _slicedToArray(_ref2, 2), | ||
key = _ref3[0], | ||
value = _ref3[1]; | ||
options.truncate -= 2; | ||
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | ||
var name, str; | ||
if (value.__lookupGetter__) { | ||
if (value.__lookupGetter__(key)) { | ||
if (value.__lookupSetter__(key)) { | ||
str = ctx.stylize('[Getter/Setter]', 'special'); | ||
} else { | ||
str = ctx.stylize('[Getter]', 'special'); | ||
} | ||
} else { | ||
if (value.__lookupSetter__(key)) { | ||
str = ctx.stylize('[Setter]', 'special'); | ||
} | ||
} | ||
} | ||
if (visibleKeys.indexOf(key) < 0) { | ||
name = '[' + key + ']'; | ||
} | ||
if (!str) { | ||
if (ctx.seen.indexOf(value[key]) < 0) { | ||
if (recurseTimes === null) { | ||
str = formatValue(ctx, value[key], null); | ||
} else { | ||
str = formatValue(ctx, value[key], recurseTimes - 1); | ||
} | ||
if (str.indexOf('\n') > -1) { | ||
if (array) { | ||
str = str.split('\n').map(function(line) { | ||
return ' ' + line; | ||
}).join('\n').substr(2); | ||
} else { | ||
str = '\n' + str.split('\n').map(function(line) { | ||
return ' ' + line; | ||
}).join('\n'); | ||
} | ||
} | ||
} else { | ||
str = ctx.stylize('[Circular]', 'special'); | ||
} | ||
} | ||
if (typeof name === 'undefined') { | ||
if (array && key.match(/^\d+$/)) { | ||
return str; | ||
} | ||
name = JSON.stringify('' + key); | ||
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { | ||
name = name.substr(1, name.length - 2); | ||
name = ctx.stylize(name, 'name'); | ||
} else { | ||
name = name.replace(/'/g, "\\'") | ||
.replace(/\\"/g, '"') | ||
.replace(/(^"|"$)/g, "'"); | ||
name = ctx.stylize(name, 'string'); | ||
} | ||
} | ||
if (typeof key !== 'string' && typeof key !== 'number') { | ||
key = "[".concat(options.inspect(key, options), "]"); | ||
} | ||
return name + ': ' + str; | ||
} | ||
options.truncate -= key.length; | ||
value = options.inspect(value, options); | ||
return "".concat(key, ": ").concat(value); | ||
} | ||
function inspectArray(array, options) { | ||
// Object.keys will always output the Array indices first, so we can slice by | ||
// `array.length` to get non-index properties | ||
var nonIndexProperties = Object.keys(array).slice(array.length); | ||
if (!array.length && !nonIndexProperties.length) return '[]'; | ||
options.truncate -= 4; | ||
var listContents = inspectList(array, options); | ||
options.truncate -= listContents.length; | ||
var propertyContents = ''; | ||
function reduceToSingleString(output, base, braces) { | ||
var numLinesEst = 0; | ||
var length = output.reduce(function(prev, cur) { | ||
numLinesEst++; | ||
if (cur.indexOf('\n') >= 0) numLinesEst++; | ||
return prev + cur.length + 1; | ||
}, 0); | ||
if (nonIndexProperties.length) { | ||
propertyContents = inspectList(nonIndexProperties.map(function (key) { | ||
return [key, array[key]]; | ||
}), options, inspectProperty); | ||
} | ||
if (length > 60) { | ||
return braces[0] + | ||
(base === '' ? '' : base + '\n ') + | ||
' ' + | ||
output.join(',\n ') + | ||
' ' + | ||
braces[1]; | ||
} | ||
return "[ ".concat(listContents).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]"); | ||
} | ||
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; | ||
} | ||
/* ! | ||
* Chai - getFuncName utility | ||
* Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
function isArray(ar) { | ||
return Array.isArray(ar) || | ||
(typeof ar === 'object' && objectToString(ar) === '[object Array]'); | ||
} | ||
/** | ||
* ### .getFuncName(constructorFn) | ||
* | ||
* Returns the name of a function. | ||
* When a non-function instance is passed, returns `null`. | ||
* This also includes a polyfill function if `aFunc.name` is not defined. | ||
* | ||
* @name getFuncName | ||
* @param {Function} funct | ||
* @namespace Utils | ||
* @api public | ||
*/ | ||
function isRegExp(re) { | ||
return typeof re === 'object' && objectToString(re) === '[object RegExp]'; | ||
} | ||
var toString = Function.prototype.toString; | ||
var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/; | ||
function getFuncName(aFunc) { | ||
if (typeof aFunc !== 'function') { | ||
return null; | ||
} | ||
function isDate(d) { | ||
return typeof d === 'object' && objectToString(d) === '[object Date]'; | ||
} | ||
var name = ''; | ||
if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') { | ||
// Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined | ||
var match = toString.call(aFunc).match(functionNameMatch); | ||
if (match) { | ||
name = match[1]; | ||
} | ||
} else { | ||
// If we've got a `name` property we just use it | ||
name = aFunc.name; | ||
} | ||
function isError(e) { | ||
return typeof e === 'object' && objectToString(e) === '[object Error]'; | ||
} | ||
return name; | ||
} | ||
function objectToString(o) { | ||
return Object.prototype.toString.call(o); | ||
} | ||
var getFuncName_1 = getFuncName; | ||
}); | ||
require.register("loupe/lib/getEnumerableProperties.js", function(exports, require, module){ | ||
/*! | ||
* Chai - getEnumerableProperties utility | ||
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
var toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false; | ||
/** | ||
* ### .getEnumerableProperties(object) | ||
* | ||
* This allows the retrieval of enumerable property names of an object, | ||
* inherited or not. | ||
* | ||
* @param {Object} object | ||
* @returns {Array} | ||
* @name getEnumerableProperties | ||
* @api public | ||
*/ | ||
var getArrayName = function getArrayName(array) { | ||
// We need to special case Node.js' Buffers, which report to be Uint8Array | ||
if (typeof Buffer === 'function' && array instanceof Buffer) { | ||
return 'Buffer'; | ||
} | ||
module.exports = function getEnumerableProperties(object) { | ||
var result = []; | ||
for (var name in object) { | ||
result.push(name); | ||
} | ||
return result; | ||
}; | ||
if (toStringTag && toStringTag in array) { | ||
return array[toStringTag]; | ||
} | ||
}); | ||
require.register("loupe/lib/getName.js", function(exports, require, module){ | ||
/*! | ||
* Chai - getName utility | ||
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
return getFuncName_1(array.constructor); | ||
}; | ||
/** | ||
* # getName(func) | ||
* | ||
* Gets the name of a function, in a cross-browser way. | ||
* | ||
* @param {Function} a function (usually a constructor) | ||
*/ | ||
function inspectTypedArray(array, options) { | ||
var name = getArrayName(array); | ||
options.truncate -= name.length + 4; // Object.keys will always output the Array indices first, so we can slice by | ||
// `array.length` to get non-index properties | ||
module.exports = function (func) { | ||
if (func.name) return func.name; | ||
var nonIndexProperties = Object.keys(array).slice(array.length); | ||
if (!array.length && !nonIndexProperties.length) return "".concat(name, "[]"); // As we know TypedArrays only contain Unsigned Integers, we can skip inspecting each one and simply | ||
// stylise the toString() value of them | ||
var match = /^\s?function ([^(]*)\(/.exec(func); | ||
return match && match[1] ? match[1] : ""; | ||
}; | ||
var output = ''; | ||
}); | ||
require.register("loupe/lib/getProperties.js", function(exports, require, module){ | ||
/*! | ||
* Chai - getProperties utility | ||
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
for (var i = 0; i < array.length; i++) { | ||
var string = "".concat(options.stylize(truncate(array[i], options.truncate), 'number')).concat(array[i] === array.length ? '' : ', '); | ||
options.truncate -= string.length; | ||
/** | ||
* ### .getProperties(object) | ||
* | ||
* This allows the retrieval of property names of an object, enumerable or not, | ||
* inherited or not. | ||
* | ||
* @param {Object} object | ||
* @returns {Array} | ||
* @name getProperties | ||
* @api public | ||
*/ | ||
if (array[i] !== array.length && options.truncate <= 3) { | ||
output += "".concat(truncator, "(").concat(array.length - array[i] + 1, ")"); | ||
break; | ||
} | ||
module.exports = function getProperties(object) { | ||
var result = Object.getOwnPropertyNames(subject); | ||
output += string; | ||
} | ||
function addProperty(property) { | ||
if (result.indexOf(property) === -1) { | ||
result.push(property); | ||
} | ||
} | ||
var propertyContents = ''; | ||
var proto = Object.getPrototypeOf(subject); | ||
while (proto !== null) { | ||
Object.getOwnPropertyNames(proto).forEach(addProperty); | ||
proto = Object.getPrototypeOf(proto); | ||
} | ||
if (nonIndexProperties.length) { | ||
propertyContents = inspectList(nonIndexProperties.map(function (key) { | ||
return [key, array[key]]; | ||
}), options, inspectProperty); | ||
} | ||
return result; | ||
}; | ||
return "".concat(name, "[ ").concat(output).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]"); | ||
} | ||
}); | ||
require.alias("loupe/lib/loupe.js", "loupe/index.js");if (typeof exports == "object") { | ||
module.exports = require("loupe"); | ||
} else if (typeof define == "function" && define.amd) { | ||
define(function(){ return require("loupe"); }); | ||
} else { | ||
this["loupe"] = require("loupe"); | ||
}})(); | ||
function inspectDate(dateObject, options) { | ||
// If we need to - truncate the time portion, but never the date | ||
var split = dateObject.toJSON().split('T'); | ||
var date = split[0]; | ||
return options.stylize("".concat(date, "T").concat(truncate(split[1], options.truncate - date.length - 1)), 'date'); | ||
} | ||
var toString$1 = Object.prototype.toString; | ||
var getFunctionName = function(fn) { | ||
if (toString$1.call(fn) !== '[object Function]') return null | ||
if (fn.name) return fn.name | ||
var name = /^\s*function\s*([^\(]*)/im.exec(fn.toString())[1]; | ||
return name || 'anonymous' | ||
}; | ||
function inspectFunction(func, options) { | ||
var name = getFunctionName(func); | ||
if (name === 'anonymous') { | ||
return options.stylize('[Function]', 'special'); | ||
} | ||
return options.stylize("[Function ".concat(truncate(name, options.truncate - 11), "]"), 'special'); | ||
} | ||
function inspectMapEntry(_ref, options) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
options.truncate -= 4; | ||
key = options.inspect(key, options); | ||
options.truncate -= key.length; | ||
value = options.inspect(value, options); | ||
return "".concat(key, " => ").concat(value); | ||
} // IE11 doesn't support `map.entries()` | ||
function mapToEntries(map) { | ||
var entries = []; | ||
map.forEach(function (value, key) { | ||
entries.push([key, value]); | ||
}); | ||
return entries; | ||
} | ||
function inspectMap(map, options) { | ||
var size = map.size - 1; | ||
if (size <= 0) { | ||
return 'Map{}'; | ||
} | ||
options.truncate -= 7; | ||
return "Map{ ".concat(inspectList(mapToEntries(map), options, inspectMapEntry), " }"); | ||
} | ||
var isNaN = Number.isNaN || function (i) { | ||
return i !== i; | ||
}; // eslint-disable-line no-self-compare | ||
function inspectNumber(number, options) { | ||
if (isNaN(number)) { | ||
return options.stylize('NaN', 'number'); | ||
} | ||
if (number === Infinity) { | ||
return options.stylize('Infinity', 'number'); | ||
} | ||
if (number === -Infinity) { | ||
return options.stylize('-Infinity', 'number'); | ||
} | ||
if (number === 0) { | ||
return options.stylize(1 / number === Infinity ? '+0' : '-0', 'number'); | ||
} | ||
return options.stylize(truncate(number, options.truncate), 'number'); | ||
} | ||
function inspectRegExp(value, options) { | ||
var flags = value.toString().split('/')[2]; | ||
var sourceLength = options.truncate - (2 + flags.length); | ||
var source = value.source; | ||
return options.stylize("/".concat(truncate(source, sourceLength), "/").concat(flags), 'regexp'); | ||
} | ||
function arrayFromSet(set) { | ||
var values = []; | ||
set.forEach(function (value) { | ||
values.push(value); | ||
}); | ||
return values; | ||
} | ||
function inspectSet(set, options) { | ||
if (set.size === 0) return 'Set{}'; | ||
options.truncate -= 7; | ||
return "Set{ ".concat(inspectList(arrayFromSet(set), options), " }"); | ||
} | ||
var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5" + "\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", 'g'); | ||
var escapeCharacters = { | ||
'\b': '\\b', | ||
'\t': '\\t', | ||
'\n': '\\n', | ||
'\f': '\\f', | ||
'\r': '\\r', | ||
"'": "\\'", | ||
'\\': '\\\\' | ||
}; | ||
var hex = 16; | ||
var unicodeLength = 4; | ||
function escape(char) { | ||
return escapeCharacters[char] || "\\u".concat("0000".concat(char.charCodeAt(0).toString(hex)).slice(-unicodeLength)); | ||
} | ||
function inspectString(string, options) { | ||
if (stringEscapeChars.test(string)) { | ||
string = string.replace(stringEscapeChars, escape); | ||
} | ||
return options.stylize("'".concat(truncate(string, options.truncate - 2), "'"), 'string'); | ||
} | ||
function inspectSymbol(value) { | ||
if ('description' in Symbol.prototype) { | ||
return "Symbol(".concat(value.description, ")"); | ||
} | ||
return value.toString(); | ||
} | ||
var getPromiseValue = function getPromiseValue() { | ||
return 'Promise{…}'; | ||
}; | ||
try { | ||
var _process$binding = process.binding('util'), | ||
getPromiseDetails = _process$binding.getPromiseDetails, | ||
kPending = _process$binding.kPending, | ||
kRejected = _process$binding.kRejected; | ||
getPromiseValue = function getPromiseValue(value, options) { | ||
var _getPromiseDetails = getPromiseDetails(value), | ||
_getPromiseDetails2 = _slicedToArray(_getPromiseDetails, 2), | ||
state = _getPromiseDetails2[0], | ||
innerValue = _getPromiseDetails2[1]; | ||
if (state === kPending) { | ||
return 'Promise{<pending>}'; | ||
} | ||
return "Promise".concat(state === kRejected ? '!' : '', "{").concat(options.inspect(innerValue, options), "}"); | ||
}; | ||
} catch (notNode) { | ||
/* ignore */ | ||
} | ||
var inspectPromise = getPromiseValue; | ||
function inspectObject(object, options) { | ||
var properties = Object.getOwnPropertyNames(object); | ||
var symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : []; | ||
if (properties.length === 0 && symbols.length === 0) { | ||
return '{}'; | ||
} | ||
options.truncate -= 4; | ||
var propertyContents = inspectList(properties.map(function (key) { | ||
return [key, object[key]]; | ||
}), options, inspectProperty); | ||
var symbolContents = inspectList(symbols.map(function (key) { | ||
return [key, object[key]]; | ||
}), options, inspectProperty); | ||
var sep = ''; | ||
if (propertyContents && symbolContents) { | ||
sep = ', '; | ||
} | ||
return "{ ".concat(propertyContents).concat(sep).concat(symbolContents, " }"); | ||
} | ||
var toStringTag$1 = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false; | ||
function inspectClass(value, options) { | ||
var name = ''; | ||
if (toStringTag$1 && toStringTag$1 in value) { | ||
name = value[toStringTag$1]; | ||
} | ||
name = name || getFuncName_1(value.constructor); // Babel transforms anonymous classes to the name `_class` | ||
if (!name || name === '_class') { | ||
name = '<Anonymous Class>'; | ||
} | ||
options.truncate -= name.length; | ||
return "".concat(name).concat(inspectObject(value, options)); | ||
} | ||
function inspectArguments(args, options) { | ||
if (args.length === 0) return 'Arguments[]'; | ||
options.truncate -= 13; | ||
return "Arguments[ ".concat(inspectList(args, options), " ]"); | ||
} | ||
var errorKeys = ['stack', 'line', 'column', 'name', 'message', 'fileName', 'lineNumber', 'columnNumber', 'number', 'description']; | ||
function inspectObject$1(error, options) { | ||
var properties = Object.getOwnPropertyNames(error).filter(function (key) { | ||
return errorKeys.indexOf(key) === -1; | ||
}); | ||
var name = error.name; | ||
options.truncate -= name.length; | ||
var message = ''; | ||
if (typeof error.message === 'string') { | ||
message = truncate(error.message, options.truncate); | ||
} else { | ||
properties.unshift('message'); | ||
} | ||
message = message ? ": ".concat(message) : ''; | ||
options.truncate -= message.length + 5; | ||
var propertyContents = inspectList(properties.map(function (key) { | ||
return [key, error[key]]; | ||
}), options, inspectProperty); | ||
return "".concat(name).concat(message).concat(propertyContents ? " { ".concat(propertyContents, " }") : ''); | ||
} | ||
function inspectHTMLCollection(collection, options) { | ||
return inspectList(collection, options, inspectHTML, '\n'); | ||
} | ||
function inspectAttribute(_ref, options) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
options.truncate -= 3; | ||
if (!value) { | ||
return "".concat(options.stylize(key, 'yellow')); | ||
} | ||
return "".concat(options.stylize(key, 'yellow'), "=").concat(options.stylize("\"".concat(value, "\""), 'string')); | ||
} | ||
function inspectHTML(element, options) { | ||
var properties = element.getAttributeNames(); | ||
var name = element.tagName.toLowerCase(); | ||
var head = options.stylize("<".concat(name), 'special'); | ||
var headClose = options.stylize(">", 'special'); | ||
var tail = options.stylize("</".concat(name, ">"), 'special'); | ||
options.truncate -= name.length * 2 + 5; | ||
var propertyContents = ''; | ||
if (properties.length > 0) { | ||
propertyContents += ' '; | ||
propertyContents += inspectList(properties.map(function (key) { | ||
return [key, element.getAttribute(key)]; | ||
}), options, inspectAttribute, ' '); | ||
} | ||
options.truncate -= propertyContents.length; | ||
var truncate = options.truncate; | ||
var children = inspectHTMLCollection(element.children, options); | ||
if (children && children.length > truncate) { | ||
children = "".concat(truncator, "(").concat(element.children.length, ")"); | ||
} | ||
return "".concat(head).concat(propertyContents).concat(headClose).concat(children).concat(tail); | ||
} | ||
/* ! | ||
* loupe | ||
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
var symbolsSupported = typeof Symbol === 'function' && typeof Symbol.for === 'function'; | ||
var chaiInspect = symbolsSupported ? Symbol.for('chai/inspect') : '@@chai/inspect'; | ||
var nodeInspect = false; | ||
try { | ||
// eslint-disable-next-line global-require | ||
nodeInspect = require('util').inspect.custom; | ||
} catch (noNodeInspect) { | ||
nodeInspect = false; | ||
} | ||
var constructorMap = new WeakMap(); | ||
var stringTagMap = {}; | ||
var baseTypesMap = { | ||
undefined: function undefined$1(value, options) { | ||
return options.stylize('undefined', 'undefined'); | ||
}, | ||
null: function _null(value, options) { | ||
return options.stylize(null, 'null'); | ||
}, | ||
boolean: function boolean(value, options) { | ||
return options.stylize(value, 'boolean'); | ||
}, | ||
Boolean: function Boolean(value, options) { | ||
return options.stylize(value, 'boolean'); | ||
}, | ||
number: inspectNumber, | ||
Number: inspectNumber, | ||
string: inspectString, | ||
String: inspectString, | ||
function: inspectFunction, | ||
Function: inspectFunction, | ||
symbol: inspectSymbol, | ||
// A Symbol polyfill will return `Symbol` not `symbol` from typedetect | ||
Symbol: inspectSymbol, | ||
Array: inspectArray, | ||
Date: inspectDate, | ||
Map: inspectMap, | ||
Set: inspectSet, | ||
RegExp: inspectRegExp, | ||
Promise: inspectPromise, | ||
// WeakSet, WeakMap are totally opaque to us | ||
WeakSet: function WeakSet(value, options) { | ||
return options.stylize('WeakSet{…}', 'special'); | ||
}, | ||
WeakMap: function WeakMap(value, options) { | ||
return options.stylize('WeakMap{…}', 'special'); | ||
}, | ||
Arguments: inspectArguments, | ||
Int8Array: inspectTypedArray, | ||
Uint8Array: inspectTypedArray, | ||
Uint8ClampedArray: inspectTypedArray, | ||
Int16Array: inspectTypedArray, | ||
Uint16Array: inspectTypedArray, | ||
Int32Array: inspectTypedArray, | ||
Uint32Array: inspectTypedArray, | ||
Float32Array: inspectTypedArray, | ||
Float64Array: inspectTypedArray, | ||
Generator: function Generator() { | ||
return ''; | ||
}, | ||
DataView: function DataView() { | ||
return ''; | ||
}, | ||
ArrayBuffer: function ArrayBuffer() { | ||
return ''; | ||
}, | ||
Error: inspectObject$1, | ||
HTMLCollection: inspectHTMLCollection, | ||
NodeList: inspectHTMLCollection | ||
}; // eslint-disable-next-line complexity | ||
var inspectCustom = function inspectCustom(value, options, type) { | ||
if (chaiInspect in value && typeof value[chaiInspect] === 'function') { | ||
return value[chaiInspect](options); | ||
} | ||
if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === 'function') { | ||
return value[nodeInspect](options.depth, options); | ||
} | ||
if ('inspect' in value && typeof value.inspect === 'function') { | ||
return value.inspect(options.depth, options); | ||
} | ||
if ('constructor' in value && constructorMap.has(value.constructor)) { | ||
return constructorMap.get(value.constructor)(value, options); | ||
} | ||
if (stringTagMap[type]) { | ||
return stringTagMap[type](value, options); | ||
} | ||
return ''; | ||
}; // eslint-disable-next-line complexity | ||
function inspect(value, options) { | ||
options = normaliseOptions(options); | ||
options.inspect = inspect; | ||
var _options = options, | ||
customInspect = _options.customInspect; | ||
var type = typeDetect(value); // If it is a base value that we already support, then use Loupe's inspector | ||
if (baseTypesMap[type]) { | ||
return baseTypesMap[type](value, options); | ||
} | ||
var proto = value ? Object.getPrototypeOf(value) : false; // If it's a plain Object then use Loupe's inspector | ||
if (proto === Object.prototype || proto === null) { | ||
return inspectObject(value, options); | ||
} // Specifically account for HTMLElements | ||
// eslint-disable-next-line no-undef | ||
if (value && typeof HTMLElement === 'function' && value instanceof HTMLElement) { | ||
return inspectHTML(value, options); | ||
} // If `options.customInspect` is set to true then try to use the custom inspector | ||
if (customInspect && value) { | ||
var output = inspectCustom(value, options, type); | ||
if (output) return output; | ||
} // If it is a class, inspect it like an object but add the constructor name | ||
if ('constructor' in value && value.constructor !== Object) { | ||
return inspectClass(value, options); | ||
} // We have run out of options! Just stringify the value | ||
return options.stylize(String(value), type); | ||
} | ||
function registerConstructor(constructor, inspector) { | ||
if (constructorMap.has(constructor)) { | ||
return false; | ||
} | ||
constructorMap.add(constructor, inspector); | ||
return true; | ||
} | ||
function registerStringTag(stringTag, inspector) { | ||
if (stringTag in stringTagMap) { | ||
return false; | ||
} | ||
stringTagMap[stringTag] = inspector; | ||
return true; | ||
} | ||
var custom = chaiInspect; | ||
exports.custom = custom; | ||
exports.default = inspect; | ||
exports.registerConstructor = registerConstructor; | ||
exports.registerStringTag = registerStringTag; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); |
137
package.json
{ | ||
"name": "loupe", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Inspect utility for Node.js and browsers", | ||
"main": "./lib/loupe.js", | ||
"homepage": "https://github.com/chaijs/loupe", | ||
"scripts": { | ||
"test": "hydro", | ||
"readme": "jsmd README.md", | ||
"coverage": "istanbul cover _hydro" | ||
}, | ||
"license": "MIT", | ||
"author": "Veselin Todorov <hi@vesln.com>", | ||
"contributors": [ | ||
"Keith Cirkel (https://github.com/keithamus)" | ||
], | ||
"main": "./loupe.js", | ||
"module": "./index.js", | ||
"repository": { | ||
@@ -16,14 +17,114 @@ "type": "git", | ||
}, | ||
"scripts": { | ||
"bench": "node -r esm bench", | ||
"commit-msg": "commitlint -x angular", | ||
"lint": "eslint --ignore-path .gitignore .", | ||
"prepare": "rollup -c rollup.conf.js", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post", | ||
"test": "npm run test:node && npm run test:browser", | ||
"pretest:browser": "npm run prepare", | ||
"test:browser": "karma start --singleRun=true", | ||
"posttest:browser": "npm run upload-coverage", | ||
"test:node": "nyc mocha -r esm", | ||
"posttest:node": "nyc report --report-dir \"coverage/node-$(node --version)\" --reporter=lcovonly && npm run upload-coverage", | ||
"upload-coverage": "codecov" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"env": { | ||
"es6": true | ||
}, | ||
"plugins": [ | ||
"filenames", | ||
"prettier" | ||
], | ||
"extends": [ | ||
"strict/es6" | ||
], | ||
"rules": { | ||
"func-style": "off", | ||
"no-magic-numbers": "off", | ||
"class-methods-use-this": "off", | ||
"array-bracket-spacing": "off", | ||
"array-element-newline": "off", | ||
"space-before-function-paren": "off", | ||
"arrow-parens": "off", | ||
"template-curly-spacing": "off", | ||
"quotes": "off", | ||
"generator-star-spacing": "off", | ||
"prefer-destructuring": "off", | ||
"no-mixed-operators": "off", | ||
"id-blacklist": "off", | ||
"curly": "off", | ||
"semi": [ | ||
"error", | ||
"never" | ||
], | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"arrowParens": "avoid", | ||
"bracketSpacing": true | ||
} | ||
] | ||
} | ||
}, | ||
"prettier": { | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"arrowParens": "avoid", | ||
"bracketSpacing": true | ||
}, | ||
"dependencies": { | ||
"get-function-name": "0.0.1", | ||
"type-detect": "^4.0.8" | ||
}, | ||
"devDependencies": { | ||
"hydro": "*", | ||
"hydro-dot": "*", | ||
"hydro-tdd": "*", | ||
"hydro-chai": "*", | ||
"istanbul": "~0.1.44", | ||
"component": "*", | ||
"chai": "*", | ||
"jsmd": "~0.2.0" | ||
}, | ||
"author": "Veselin Todorov <hi@vesln.com>", | ||
"license": "MIT" | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"@commitlint/cli": "^8.3.5", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.2.0", | ||
"codecov": "^3.6.5", | ||
"commitlint-config-angular": "^8.3.4", | ||
"core-js": "^3.6.4", | ||
"cross-env": "^7.0.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-strict": "^14.0.1", | ||
"eslint-plugin-filenames": "^1.3.2", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"esm": "^3.2.25", | ||
"husky": "^4.2.3", | ||
"karma": "^4.4.1", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-coverage": "^2.0.1", | ||
"karma-edge-launcher": "^0.4.2", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-opera-launcher": "^1.0.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-safaritechpreview-launcher": "^2.0.2", | ||
"karma-sauce-launcher": "^2.0.2", | ||
"mocha": "^7.1.1", | ||
"nyc": "^15.0.0", | ||
"prettier": "^2.0.2", | ||
"rollup": "^2.1.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"@rollup/plugin-commonjs": "^11.0.2", | ||
"rollup-plugin-istanbul": "^2.0.1", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"semantic-release": "^17.0.4", | ||
"simple-assert": "^1.0.0" | ||
} | ||
} |
@@ -1,16 +0,30 @@ | ||
[![NPM version](https://badge.fury.io/js/loupe.png)](http://badge.fury.io/js/loupe) | ||
[![Build Status](https://secure.travis-ci.org/chaijs/loupe.png)](http://travis-ci.org/chaijs/loupe) | ||
![npm](https://img.shields.io/npm/v/loupe?logo=npm) | ||
![Build](https://github.com/chaijs/loupe/workflows/Build/badge.svg?branch=master) | ||
![Codecov branch](https://img.shields.io/codecov/c/github/chaijs/loupe/master?logo=codecov) | ||
# loupe | ||
# What is loupe? | ||
Inspect utility for Node.js and browsers. | ||
Loupe turns the object you give it into a string. It's similar to Node.js' `util.inspect()` function, but it works cross platform, in most modern browsers as well as Node. | ||
## Installation | ||
### Node.js | ||
`loupe` is available on [npm](http://npmjs.org). To install it, type: | ||
$ npm install loupe | ||
### Browsers | ||
You can also use it within the browser; install via npm and use the `loupe.js` file found within the download. For example: | ||
```html | ||
<script src="./node_modules/loupe/loupe.js"></script> | ||
``` | ||
## Usage | ||
``` | ||
``` js | ||
var inspect = require('loupe'); | ||
``` | ||
<!-- js | ||
var inspect = require('./'); | ||
--> | ||
@@ -27,22 +41,2 @@ ```js | ||
## Installation | ||
npm: | ||
```bash | ||
npm install loupe | ||
``` | ||
component: | ||
```bash | ||
component install chaijs/loupe | ||
``` | ||
Standalone: | ||
```html | ||
<script src="loupe.js></script> | ||
``` | ||
## Tests | ||
@@ -57,3 +51,3 @@ | ||
```bash | ||
$ npm run coverage | ||
$ npm run upload-coverage | ||
``` | ||
@@ -60,0 +54,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2195084
34
12060
0
0
2
36
64
2
+ Addedget-function-name@0.0.1
+ Addedtype-detect@^4.0.8
+ Addedget-function-name@0.0.1(transitive)
+ Addedtype-detect@4.1.0(transitive)