1 line
110 KiB
Plaintext
1 line
110 KiB
Plaintext
|
{"version":3,"file":"underscore.js","sources":["modules/index.js","modules/index-default.js"],"sourcesContent":["// Underscore.js 1.10.2\n// https://underscorejs.org\n// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// Underscore may be freely distributed under the MIT license.\n\n// Baseline setup\n// --------------\n\n// Establish the root object, `window` (`self`) in the browser, `global`\n// on the server, or `this` in some virtual machines. We use `self`\n// instead of `window` for `WebWorker` support.\nvar root = typeof self == 'object' && self.self === self && self ||\n typeof global == 'object' && global.global === global && global ||\n Function('return this')() ||\n {};\n\n// Save bytes in the minified (but not gzipped) version:\nvar ArrayProto = Array.prototype, ObjProto = Object.prototype;\nvar SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;\n\n// Create quick reference variables for speed access to core prototypes.\nvar push = ArrayProto.push,\n slice = ArrayProto.slice,\n toString = ObjProto.toString,\n hasOwnProperty = ObjProto.hasOwnProperty;\n\n// All **ECMAScript 5** native function implementations that we hope to use\n// are declared here.\nvar nativeIsArray = Array.isArray,\n nativeKeys = Object.keys,\n nativeCreate = Object.create;\n\n// Create references to these builtin functions because we override them.\nvar _isNaN = root.isNaN,\n _isFinite = root.isFinite;\n\n// Naked function reference for surrogate-prototype-swapping.\nvar Ctor = function(){};\n\n// The Underscore object. All exported functions below are added to it in the\n// modules/index-all.js using the mixin function.\nexport default function _(obj) {\n if (obj instanceof _) return obj;\n if (!(this instanceof _)) return new _(obj);\n this._wrapped = obj;\n}\n\n// Current version.\nexport var VERSION = _.VERSION = '1.10.2';\n\n// Internal function that returns an efficient (for current engines) version\n// of the passed-in callback, to be repeatedly applied in other Underscore\n// functions.\nfunction optimizeCb(func, context, argCount) {\n if (context === void 0) return func;\n switch (argCount == null ? 3 : argCount) {\n case 1: return function(value) {\n return func.call(context, value);\n };\n // The 2-argument case is omitted because we’re not using it.\n case 3: return function(value, index, collection) {\n return func.call(context, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(context, accumulator, value, index, collection);\n };\n }\n return function() {\n return func.apply(context, arguments);\n };\n}\n\n// An internal function to generate callbacks that can be applied to each\n// element in a collection, returning the desired result — either `identity`,\n// an arbitrary callback, a property matcher, or a property accessor.\nfunction baseIteratee(value, context, argCount) {\n if (value == null) return identity;\n if (isFunction(value)) return optimizeCb(value, context, argCount);\n if (isObject(value) && !isArray(value)) return matcher(value);\n return property(value);\n}\n\n// External wrapper for our callback generator. Users may customize\n// `_.iteratee` if they want additional predicate/iteratee shorthand styles.\n// This abstraction hides the internal-only argCount argument.\n_.iteratee = iteratee;\nexport function iteratee(value, context) {\n return baseIteratee(value, context, Infinity);\n}\n\n// The function we actually call internally. It invokes _.iteratee if\n// overridden, otherwise baseIteratee.\nfunction cb(value, context, argCount) {\n if (_.iteratee !== iteratee) return _.iteratee(value, context);\n return baseIteratee(value, context, argCount);\n}\n\n// Some functions take a variable number of arguments, or a few expected\n// arguments at the beginning and then a variable number of values to operate\n// on. This helper accumulates all remaining arguments past the f
|