mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29a7bc4c81 | ||
|
|
e21e993729 |
@@ -1,29 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
extends: [
|
|
||||||
'@commitlint/config-conventional', // scoped packages are not prefixed
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
'type-enum': [
|
|
||||||
2,
|
|
||||||
'always',
|
|
||||||
[
|
|
||||||
'build',
|
|
||||||
'chore',
|
|
||||||
'ci',
|
|
||||||
'docs',
|
|
||||||
'feat',
|
|
||||||
'fix',
|
|
||||||
'perf',
|
|
||||||
'proposal',
|
|
||||||
'refactor',
|
|
||||||
'release',
|
|
||||||
'revert',
|
|
||||||
'style',
|
|
||||||
'test',
|
|
||||||
'wip',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# This file is for unifying the coding style for different editors and IDEs
|
|
||||||
# editorconfig.org
|
|
||||||
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
indent_size = 2
|
|
||||||
indent_style = space
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
coverage/
|
|
||||||
coverage-merged/
|
|
||||||
dist/
|
|
||||||
node_modules/
|
|
||||||
types/
|
|
||||||
99
.eslintrc
99
.eslintrc
@@ -1,99 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["airbnb-base", "prettier"],
|
|
||||||
"root": true,
|
|
||||||
"env": {
|
|
||||||
"amd": true,
|
|
||||||
"browser": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"BigInt": "readonly",
|
|
||||||
"BigInt64Array": "readonly",
|
|
||||||
"BigUint64Array": "readonly",
|
|
||||||
"globalThis": "readonly"
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2020,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"prettier/prettier": "error",
|
|
||||||
// Overridden
|
|
||||||
"camelcase": ["error", { "properties": "never", "allow": [ "W[0-9]+_"] }],
|
|
||||||
"import/extensions": "off",
|
|
||||||
"no-eval": "off",
|
|
||||||
"no-self-compare": "off",
|
|
||||||
"one-var": ["error", "never"],
|
|
||||||
// @TODO: Fix the following rules progressively.
|
|
||||||
"arrow-body-style": "warn",
|
|
||||||
"prefer-arrow-callback": "warn",
|
|
||||||
"prefer-object-spread": "off",
|
|
||||||
"max-classes-per-file": "off",
|
|
||||||
"dot-notation": "off",
|
|
||||||
"object-shorthand": "off",
|
|
||||||
"no-param-reassign": "off",
|
|
||||||
"no-cond-assign": "off",
|
|
||||||
"prefer-destructuring": "off",
|
|
||||||
"func-names": "off",
|
|
||||||
"no-nested-ternary": "off",
|
|
||||||
"no-plusplus": "off",
|
|
||||||
"strict": "off",
|
|
||||||
"no-restricted-syntax": "off",
|
|
||||||
"import/no-mutable-exports": "off",
|
|
||||||
"guard-for-in": "off",
|
|
||||||
"import/prefer-default-export": "off",
|
|
||||||
"prefer-rest-params": "off",
|
|
||||||
"prefer-spread": "off",
|
|
||||||
"no-lonely-if": "off",
|
|
||||||
"no-prototype-builtins": "off",
|
|
||||||
"no-continue": "off",
|
|
||||||
"no-shadow": "off",
|
|
||||||
// Rules up for discussion.
|
|
||||||
"no-multi-assign": "off",
|
|
||||||
"new-cap": "off"
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["**/*.ts"],
|
|
||||||
"parserOptions": {
|
|
||||||
"project": "./tsconfig.json"
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"airbnb-typescript/base",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"plugins": ["@typescript-eslint"],
|
|
||||||
"rules": {
|
|
||||||
"@typescript-eslint/no-unused-vars": [
|
|
||||||
"warn",
|
|
||||||
{
|
|
||||||
"vars": "all",
|
|
||||||
"args": "after-used",
|
|
||||||
"ignoreRestSiblings": true,
|
|
||||||
"argsIgnorePattern": "^_" // For tsc compatibility.
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"comma-dangle": "off",
|
|
||||||
"implicit-arrow-linebreak": "off", // Conflicts with prettier.
|
|
||||||
"import/extensions": "off",
|
|
||||||
"import/prefer-default-export": "off",
|
|
||||||
"operator-linebreak": "off",
|
|
||||||
"object-curly-newline": "off",
|
|
||||||
"prefer-rest-params": "off", // We need to use params.
|
|
||||||
"prettier/prettier": "error",
|
|
||||||
"@typescript-eslint/no-shadow": "warn",
|
|
||||||
"@typescript-eslint/no-use-before-define": ["warn", { "functions": false }],
|
|
||||||
"import/no-cycle": "warn",
|
|
||||||
"no-bitwise": "off",
|
|
||||||
"no-unsafe-finally": "warn",
|
|
||||||
"no-param-reassign": "off",
|
|
||||||
"no-shadow": "warn"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -1,2 +1,5 @@
|
|||||||
* text=auto
|
* text=auto
|
||||||
*.lockb binary diff=lockb
|
*.html text eol=lf
|
||||||
|
*.js text eol=lf
|
||||||
|
*.md text eol=lf
|
||||||
|
*.sh text eol=lf
|
||||||
|
|||||||
71
.github/CONTRIBUTING.md
vendored
71
.github/CONTRIBUTING.md
vendored
@@ -1,71 +0,0 @@
|
|||||||
# :construction: Notice :construction:
|
|
||||||
|
|
||||||
Pardon the mess. The `master` branch is in flux while we work on Lodash v5. This
|
|
||||||
means things like npm scripts, which we encourage using for contributions, may
|
|
||||||
not be working. Thank you for your patience.
|
|
||||||
|
|
||||||
# Contributing to Lodash
|
|
||||||
|
|
||||||
Contributions are always welcome. Before contributing please read the
|
|
||||||
[code of conduct](https://code-of-conduct.openjsf.org) &
|
|
||||||
[search the issue tracker](https://github.com/lodash/lodash/issues); your issue
|
|
||||||
may have already been discussed or fixed in `master`. To contribute,
|
|
||||||
[fork](https://help.github.com/articles/fork-a-repo/) Lodash, commit your changes,
|
|
||||||
& [send a pull request](https://help.github.com/articles/using-pull-requests/).
|
|
||||||
|
|
||||||
## Feature Requests
|
|
||||||
|
|
||||||
Feature requests should be submitted in the
|
|
||||||
[issue tracker](https://github.com/lodash/lodash/issues), with a description of
|
|
||||||
the expected behavior & use case, where they’ll remain closed until sufficient interest,
|
|
||||||
[e.g. :+1: reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/),
|
|
||||||
has been [shown by the community](https://github.com/lodash/lodash/issues?q=label%3A%22votes+needed%22+sort%3Areactions-%2B1-desc).
|
|
||||||
Before submitting a request, please search for similar ones in the
|
|
||||||
[closed issues](https://github.com/lodash/lodash/issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement).
|
|
||||||
|
|
||||||
## Pull Requests
|
|
||||||
|
|
||||||
For additions or bug fixes, please modify the relevant files. Include
|
|
||||||
updated unit tests in the `test` directory as part of your pull request.
|
|
||||||
Unit test files should be named `[filename].test.js`.
|
|
||||||
|
|
||||||
Before running the unit tests you’ll need to install, `npm i`,
|
|
||||||
[development dependencies](https://docs.npmjs.com/files/package.json#devdependencies).
|
|
||||||
Run unit tests from the command-line via `npm test`.
|
|
||||||
|
|
||||||
## Contributor License Agreement
|
|
||||||
|
|
||||||
Lodash is a member of the [JS Foundation](https://openjsf.org/).
|
|
||||||
As such, we request that all contributors sign the JS Foundation
|
|
||||||
[contributor license agreement (CLA)](https://cla.js.foundation/lodash/lodash).
|
|
||||||
|
|
||||||
For more information about CLAs, please check out Alex Russell’s excellent post,
|
|
||||||
[“Why Do I Need to Sign This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
|
|
||||||
|
|
||||||
## Coding Guidelines
|
|
||||||
|
|
||||||
In addition to the following guidelines, please follow the conventions already
|
|
||||||
established in the code.
|
|
||||||
|
|
||||||
- **Spacing**:<br>
|
|
||||||
Use two spaces for indentation. No tabs.
|
|
||||||
|
|
||||||
- **Naming**:<br>
|
|
||||||
Keep variable & method names concise & descriptive.<br>
|
|
||||||
Variable names `index`, `array`, & `iteratee` are preferable to
|
|
||||||
`i`, `arr`, & `fn`.
|
|
||||||
|
|
||||||
- **Quotes**:<br>
|
|
||||||
Single-quoted strings are preferred to double-quoted strings; however,
|
|
||||||
please use a double-quoted string if the value contains a single-quote
|
|
||||||
character to avoid unnecessary escaping.
|
|
||||||
|
|
||||||
- **Comments**:<br>
|
|
||||||
Please use single-line comments to annotate significant additions, &
|
|
||||||
[JSDoc-style](http://www.2ality.com/2011/08/jsdoc-intro.html) comments for
|
|
||||||
functions.
|
|
||||||
|
|
||||||
Guidelines are enforced using [ESLint](https://www.npmjs.com/package/eslint):
|
|
||||||
```bash
|
|
||||||
$ npm run style
|
|
||||||
```
|
|
||||||
24
.github/lock.yml
vendored
24
.github/lock.yml
vendored
@@ -1,24 +0,0 @@
|
|||||||
# Configuration for lock-threads - https://github.com/dessant/lock-threads
|
|
||||||
|
|
||||||
# Number of days of inactivity before a closed issue or pull request is locked
|
|
||||||
daysUntilLock: 365
|
|
||||||
|
|
||||||
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
|
||||||
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
|
||||||
skipCreatedBefore: false
|
|
||||||
|
|
||||||
# Issues and pull requests with these labels will not be locked. Set to `[]` to disable
|
|
||||||
exemptLabels:
|
|
||||||
- votes needed
|
|
||||||
|
|
||||||
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
|
||||||
lockLabel: false
|
|
||||||
|
|
||||||
# Comment to post before locking. Set to `false` to disable
|
|
||||||
lockComment: >
|
|
||||||
This thread has been automatically locked since there has not been
|
|
||||||
any recent activity after it was closed. Please open a new issue for
|
|
||||||
related bugs.
|
|
||||||
|
|
||||||
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
|
||||||
setLockReason: true
|
|
||||||
16
.github/workflows/tests.yml
vendored
16
.github/workflows/tests.yml
vendored
@@ -1,16 +0,0 @@
|
|||||||
name: CI
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
tests:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: oven-sh/setup-bun@v1
|
|
||||||
with:
|
|
||||||
bun-version: 1.0.2
|
|
||||||
- run: bun install
|
|
||||||
17
.gitignore
vendored
17
.gitignore
vendored
@@ -1,8 +1,11 @@
|
|||||||
|
.coveralls.yml
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.log*
|
*.custom.*
|
||||||
dist/
|
*.template.*
|
||||||
node_modules/
|
*.map
|
||||||
*.code-workspace
|
/*.min.*
|
||||||
*.lockb
|
modularize
|
||||||
*.sublime-project
|
node_modules
|
||||||
*.sublime-workspace
|
dist/*.backbone.*
|
||||||
|
dist/*.legacy.*
|
||||||
|
dist/*.mobile.*
|
||||||
|
|||||||
1
.husky/.gitignore
vendored
1
.husky/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
_
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
bun run commitlint --edit "$1"
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
bun run lint-staged
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
coverage/
|
|
||||||
coverage-merged/
|
|
||||||
dist/
|
|
||||||
node_modules/
|
|
||||||
types/
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 100,
|
|
||||||
"useTabs": false,
|
|
||||||
"tabWidth": 4,
|
|
||||||
"singleQuote": true
|
|
||||||
}
|
|
||||||
79
.travis.yml
Normal file
79
.travis.yml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "0.6"
|
||||||
|
- "0.8"
|
||||||
|
- "0.10"
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- BIN="node" BUILD=false COMPAT=false MAKE=false OPTION="" SAUCE_LABS=false SAUCE_USERNAME="lodash"
|
||||||
|
- secure: "tg1JFsIFnxzLaTboFPOnm+aJCuMm5+JdhLlESlqg9x3fwro++7KCnwHKLNovhchaPe4otC43ZMB/nfWhDnDm11dKbm/V6HlTkED+dadTsaLxVDg6J+7yK41QhokBPJOxLV78iDaNaAQVYEirAgZ0yn8kFubxmNKV+bpCGQNc9yU="
|
||||||
|
matrix:
|
||||||
|
- BUILD="compat"
|
||||||
|
- BUILD="modern"
|
||||||
|
- BUILD="legacy"
|
||||||
|
- BUILD="mobile"
|
||||||
|
- BIN="phantomjs" BUILD="compat"
|
||||||
|
- BIN="phantomjs" BUILD="legacy"
|
||||||
|
- BIN="phantomjs" BUILD="mobile"
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="istanbul"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="narwhal" BUILD="compat"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="narwhal" BUILD="legacy"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="rhino" BUILD="compat"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="rhino" BUILD="legacy"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="rhino" BUILD="compat" OPTION="-require"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="rhino" BUILD="legacy" OPTION="-require"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="ringo" BUILD="compat"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: BIN="ringo" BUILD="legacy"
|
||||||
|
- node_js: "0.8"
|
||||||
|
env: SAUCE_LABS=true BUILD="compat"
|
||||||
|
- node_js: "0.8"
|
||||||
|
env: SAUCE_LABS=true BUILD="modern"
|
||||||
|
- node_js: "0.8"
|
||||||
|
env: SAUCE_LABS=true BUILD="legacy"
|
||||||
|
- node_js: "0.8"
|
||||||
|
env: SAUCE_LABS=true BUILD="mobile"
|
||||||
|
- node_js: "0.8"
|
||||||
|
env: SAUCE_LABS=true BUILD="underscore"
|
||||||
|
git:
|
||||||
|
depth: 10
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
before_install:
|
||||||
|
- "([ $BUILD == 'legacy' ] || [ $BUILD == 'mobile' ] || [ $BUILD == 'modern' ]) && MAKE=true || true"
|
||||||
|
- "([ $BUILD == 'compat' ] || [ $BUILD == 'legacy' ]) && COMPAT=true || true"
|
||||||
|
- "[ $SAUCE_LABS != false ] && npm i ecstatic@\"~0.4.0\" request@\"~2.27.0\" sauce-tunnel@\"~1.1.0\" || true"
|
||||||
|
- "[ $BIN == 'istanbul' ] && npm i -g coveralls@\"~2.5.0\" istanbul@\"~0.1.0\" || true"
|
||||||
|
- "[ $BIN == 'narwhal' ] && wget https://github.com/280north/narwhal/archive/v0.3.2.zip && sudo unzip v0.3.2 -d /opt/ && rm v0.3.2.zip || true"
|
||||||
|
- "[ $BIN == 'narwhal' ] && sudo ln -s /opt/narwhal-0.3.2/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal || true"
|
||||||
|
- "[ $BIN == 'rhino' ] && sudo mkdir /opt/rhino-1.7R5 && sudo wget -O /opt/rhino-1.7R5/js.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/rhino-1.7R5-20120629.144839-4.jar || true"
|
||||||
|
- "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true"
|
||||||
|
- "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true"
|
||||||
|
- "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true"
|
||||||
|
- "[ $MAKE != false ] && git clone --depth=10 --branch=master git://github.com/lodash/lodash-cli.git ./node_modules/lodash-cli || true"
|
||||||
|
- "[ $MAKE != false ] && mkdir ./node_modules/lodash-cli/node_modules && cd ./node_modules/lodash-cli/node_modules/ && ln -s ../../../ ./lodash && cd ../ && npm i . && cd ../../ || true"
|
||||||
|
- "[ $MAKE != false ] && node ./node_modules/lodash-cli/bin/lodash $BUILD -o ./dist/lodash.$BUILD.js || true"
|
||||||
|
script:
|
||||||
|
- "[ $BIN == 'istanbul' ] && $BIN cover -x \"**/vendor/**\" --report lcovonly ./test/test.js -- ./dist/lodash.js && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage || true"
|
||||||
|
- "([ $SAUCE_LABS != false ] || [ $BUILD == false ]) && true || cd ./test"
|
||||||
|
- "([ $SAUCE_LABS != false ] || [ $BUILD == false ]) && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.js"
|
||||||
|
- "([ $SAUCE_LABS != false ] || [ $BUILD == false ]) && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.min.js"
|
||||||
|
- "([ $SAUCE_LABS == false ] || [ $BUILD == 'underscore' ]) && true || node ./test/saucelabs.js runner=\"test/index.html?build=lodash-$BUILD\" tags=\"$BUILD,production\""
|
||||||
|
- "([ $SAUCE_LABS == false ] || [ $COMPAT == false ]) && true || node ./test/saucelabs.js runner=\"test/index.html?build=lodash-$BUILD\" tags=\"$BUILD,production,ie-compat\" compatMode=7"
|
||||||
|
- "([ $SAUCE_LABS == false ] || [ $BUILD == 'underscore' ]) && true || node ./test/saucelabs.js runner=\"test/index.html?build=../dist/lodash.$BUILD.js\" tags=\"$BUILD,development\""
|
||||||
|
- "([ $SAUCE_LABS == false ] || [ $COMPAT == false ]) && true || node ./test/saucelabs.js runner=\"test/index.html?build=../dist/lodash.$BUILD.js\" tags=\"$BUILD,development,ie-compat\" compatMode=7"
|
||||||
|
- "[ $SAUCE_LABS == false ] && true || node ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=lodash-$BUILD\" tags=\"$BUILD,production,backbone\""
|
||||||
|
- "[ $SAUCE_LABS == false ] && true || node ./test/saucelabs.js name=\"backbone tests\" runner=\"test/backbone.html?build=../dist/lodash.$BUILD.js\" tags=\"$BUILD,development,backbone\""
|
||||||
|
- "[ $SAUCE_LABS == false ] && true || node ./test/saucelabs.js name=\"underscore tests\" runner=\"test/underscore.html?build=lodash-$BUILD\" tags=\"$BUILD,production,underscore\""
|
||||||
|
- "[ $SAUCE_LABS == false ] && true || node ./test/saucelabs.js name=\"underscore tests\" runner=\"test/underscore.html?build=../dist/lodash.$BUILD.js\" tags=\"$BUILD,development,underscore\""
|
||||||
35
CONTRIBUTING.md
Normal file
35
CONTRIBUTING.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Contributing to Lo-Dash
|
||||||
|
|
||||||
|
If you’d like to contribute a feature or bug fix, you can [fork](https://help.github.com/articles/fork-a-repo) Lo-Dash, commit your changes, and [send a pull request](https://help.github.com/articles/using-pull-requests).
|
||||||
|
Please make sure to [search the issue tracker](https://github.com/lodash/lodash/issues) first; your issue may have already been discussed or fixed in `master`.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Include updated unit tests in the `test` directory as part of your pull request.
|
||||||
|
You can run the tests from the command line via `node test/test`, or open `test/index.html` in a web browser.
|
||||||
|
The `test/run-test.sh` script attempts to run the tests in [Rhino](https://developer.mozilla.org/en-US/docs/Rhino), [Narwhal](https://github.com/280north/narwhal), [RingoJS](http://ringojs.org/), [PhantomJS](http://phantomjs.org/), and [Node](http://nodejs.org/), before running them in your default browser.
|
||||||
|
The [Backbone](http://backbonejs.org/) and [Underscore](http://http://underscorejs.org/) test suites are included as well.
|
||||||
|
|
||||||
|
## Contributor License Agreement
|
||||||
|
|
||||||
|
Lo-Dash is a member of the [Dojo Foundation](http://dojofoundation.org/).
|
||||||
|
As such, we request that all contributors sign the Dojo Foundation [contributor license agreement](http://dojofoundation.org/about/claForm).
|
||||||
|
|
||||||
|
For more information about CLAs, please check out Alex Russell’s excellent post, [“Why Do I Need to Sign This?”](http://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
|
||||||
|
|
||||||
|
## Coding Guidelines
|
||||||
|
|
||||||
|
In addition to the following guidelines, please follow the conventions already established in the code.
|
||||||
|
|
||||||
|
- **Spacing**:<br>
|
||||||
|
Use two spaces for indentation. No tabs.
|
||||||
|
|
||||||
|
- **Naming**:<br>
|
||||||
|
Keep variable and method names concise and descriptive.<br>
|
||||||
|
Variable names `index`, `collection`, and `callback` are preferable to `i`, `arr`, and `fn`.
|
||||||
|
|
||||||
|
- **Quotes**:<br>
|
||||||
|
Single-quoted strings are preferred to double-quoted strings; however, please use a double-quoted string if the value contains a single-quote character to avoid unnecessary escaping.
|
||||||
|
|
||||||
|
- **Comments**:<br>
|
||||||
|
Please use single-line comments to annotate significant additions, and [JSDoc-style](http://www.2ality.com/2011/08/jsdoc-intro.html) comments for new methods.
|
||||||
@@ -1,19 +1,7 @@
|
|||||||
The MIT License
|
Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
|
||||||
|
Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas,
|
||||||
Copyright JS Foundation and other contributors <https://js.foundation/>
|
|
||||||
|
|
||||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
||||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||||
|
|
||||||
This software consists of voluntary contributions made by many
|
|
||||||
individuals. For exact contribution history, see the revision history
|
|
||||||
available at https://github.com/lodash/lodash
|
|
||||||
|
|
||||||
The following license applies to all parts of this software except as
|
|
||||||
documented below:
|
|
||||||
|
|
||||||
====
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
"Software"), to deal in the Software without restriction, including
|
"Software"), to deal in the Software without restriction, including
|
||||||
@@ -31,19 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
====
|
|
||||||
|
|
||||||
Copyright and related rights for sample code are waived via CC0. Sample
|
|
||||||
code is defined as all source code displayed within the prose of the
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
|
||||||
|
|
||||||
====
|
|
||||||
|
|
||||||
Files located in the node_modules and vendor directories are externally
|
|
||||||
maintained libraries used by this software which have their own
|
|
||||||
licenses; we recommend you read them, as their terms may differ from the
|
|
||||||
terms above.
|
|
||||||
173
README.md
173
README.md
@@ -1,72 +1,145 @@
|
|||||||
# lodash
|
# Lo-Dash v2.4.2
|
||||||
|
A utility library delivering consistency, [customization](https://lodash.com/custom-builds), [performance](https://lodash.com/benchmarks), & [extras](https://lodash.com/#features).
|
||||||
[Site](https://lodash.com/) |
|
|
||||||
[Docs](https://lodash.com/docs) |
|
|
||||||
[Contributing](https://github.com/lodash/lodash/blob/master/.github/CONTRIBUTING.md) |
|
|
||||||
[Wiki](https://github.com/lodash/lodash/wiki "Changelog, Roadmap, etc.") |
|
|
||||||
[Code of Conduct](https://code-of-conduct.openjsf.org)
|
|
||||||
|
|
||||||
The [Lodash](https://lodash.com/) library exported as a [UMD](https://github.com/umdjs/umd) module.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ bun run build
|
|
||||||
$ lodash -o ./dist/lodash.js
|
|
||||||
$ lodash core -o ./dist/lodash.core.js
|
|
||||||
```
|
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
* [Core build](https://raw.githubusercontent.com/lodash/lodash/4.17.10-npm/core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.10-npm/core.min.js))
|
Check out our [wiki]([https://github.com/lodash/lodash/wiki/build-differences]) for details over the differences between builds.
|
||||||
* [Full build](https://raw.githubusercontent.com/lodash/lodash/4.17.10-npm/lodash.js) ([~24 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.10-npm/lodash.min.js))
|
|
||||||
* [CDN copies](https://www.jsdelivr.com/projects/lodash) [](https://www.jsdelivr.com/package/npm/lodash)
|
|
||||||
|
|
||||||
Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.17.10-npm/LICENSE) & supports modern environments.<br>
|
* Modern builds perfect for newer browsers/environments:<br>
|
||||||
Review the [build differences](https://github.com/lodash/lodash/wiki/build-differences) & pick one that’s right for you.
|
[Development](https://raw.github.com/lodash/lodash/2.4.2/dist/lodash.js) &
|
||||||
|
[Production](https://raw.github.com/lodash/lodash/2.4.2/dist/lodash.min.js)
|
||||||
|
|
||||||
## Installation
|
* Compatibility builds for older environment support too:<br>
|
||||||
|
[Development](https://raw.github.com/lodash/lodash/2.4.2/dist/lodash.compat.js) &
|
||||||
|
[Production](https://raw.github.com/lodash/lodash/2.4.2/dist/lodash.compat.min.js)
|
||||||
|
|
||||||
|
* Underscore builds to use as a drop-in replacement:<br>
|
||||||
|
[Development](https://raw.github.com/lodash/lodash/2.4.2/dist/lodash.underscore.js) &
|
||||||
|
[Production](https://raw.github.com/lodash/lodash/2.4.2/dist/lodash.underscore.min.js)
|
||||||
|
|
||||||
|
CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash). For smaller file sizes, create [custom builds](https://lodash.com/custom-builds) with only the features needed.
|
||||||
|
|
||||||
|
Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-es6](https://github.com/lodash/lodash-es6), [lodash-node](https://npmjs.org/package/lodash-node), & [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method.
|
||||||
|
|
||||||
|
## Dive in
|
||||||
|
|
||||||
|
There’s plenty of **[documentation](https://lodash.com/docs)**, [unit tests](https://lodash.com/tests), & [benchmarks](https://lodash.com/benchmarks).<br>
|
||||||
|
Check out <a href="http://devdocs.io/lodash/">DevDocs</a> as a fast, organized, & searchable interface for our documentation.
|
||||||
|
|
||||||
|
The full changelog for this release is available on our [wiki](https://github.com/lodash/lodash/wiki/Changelog).<br>
|
||||||
|
A list of upcoming features is available on our [roadmap](https://github.com/lodash/lodash/wiki/Roadmap).
|
||||||
|
|
||||||
|
## Installation & usage
|
||||||
|
|
||||||
|
In browsers:
|
||||||
|
|
||||||
In a browser:
|
|
||||||
```html
|
```html
|
||||||
<script src="lodash.js"></script>
|
<script src="lodash.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
Using bun:
|
Using [`npm`](http://npmjs.org/):
|
||||||
```shell
|
|
||||||
$ bun i lodash
|
```bash
|
||||||
|
npm i --save lodash
|
||||||
|
|
||||||
|
{sudo} npm i -g lodash
|
||||||
|
npm ln lodash
|
||||||
```
|
```
|
||||||
|
|
||||||
In [Bun](https://bun.sh):
|
In [Node.js](http://nodejs.org/) & [Ringo](http://ringojs.org/):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Load the full build.
|
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
// Load the core build.
|
// or as Underscore
|
||||||
var _ = require('lodash/core');
|
var _ = require('lodash/dist/lodash.underscore');
|
||||||
// Load the FP build for immutable auto-curried iteratee-first data-last methods.
|
|
||||||
var fp = require('lodash/fp');
|
|
||||||
|
|
||||||
// Load method categories.
|
|
||||||
var array = require('lodash/array');
|
|
||||||
var object = require('lodash/fp/object');
|
|
||||||
|
|
||||||
// Cherry-pick methods for smaller browserify/rollup/webpack bundles.
|
|
||||||
var at = require('lodash/at');
|
|
||||||
var curryN = require('lodash/fp/curryN');
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Looking for Lodash modules written in ES6 or smaller bundle sizes? Check out [lodash-es](https://www.npmjs.com/package/lodash-es).
|
**Notes:**
|
||||||
|
* Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL
|
||||||
|
* If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it
|
||||||
|
|
||||||
## Why Lodash?
|
In [Rhino](http://www.mozilla.org/rhino/):
|
||||||
|
|
||||||
Lodash makes JavaScript easier by taking the hassle out of working with arrays,<br>
|
```js
|
||||||
numbers, objects, strings, etc. Lodash’s modular methods are great for:
|
load('lodash.js');
|
||||||
|
```
|
||||||
|
|
||||||
* Iterating arrays, objects, & strings
|
In an AMD loader:
|
||||||
* Manipulating & testing values
|
|
||||||
* Creating composite functions
|
|
||||||
|
|
||||||
## Module Formats
|
```js
|
||||||
|
require({
|
||||||
|
'packages': [
|
||||||
|
{ 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
['lodash'], function(_) {
|
||||||
|
console.log(_.VERSION);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
Lodash is available in a [variety of builds](https://lodash.com/custom-builds) & module formats.
|
## Resources
|
||||||
|
|
||||||
* [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/search?q=keywords:lodash-modularized)
|
* Podcasts
|
||||||
* [lodash-es](https://www.npmjs.com/package/lodash-es), [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash), & [lodash-webpack-plugin](https://www.npmjs.com/package/lodash-webpack-plugin)
|
- [JavaScript Jabber](http://javascriptjabber.com/079-jsj-lo-dash-with-john-david-dalton/)
|
||||||
|
|
||||||
|
* Posts
|
||||||
|
- [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
|
||||||
|
- [Custom builds in Lo-Dash 2.0](http://kitcambridge.be/blog/custom-builds-in-lo-dash-2-dot-0/)
|
||||||
|
|
||||||
|
* Videos
|
||||||
|
- [Introduction](https://vimeo.com/44154599)
|
||||||
|
- [Origins](https://vimeo.com/44154600)
|
||||||
|
- [Optimizations & builds](https://vimeo.com/44154601)
|
||||||
|
- [Native method use](https://vimeo.com/48576012)
|
||||||
|
- [Testing](https://vimeo.com/45865290)
|
||||||
|
- [CascadiaJS ’12](http://www.youtube.com/watch?v=dpPy4f_SeEk)
|
||||||
|
|
||||||
|
A list of other community created podcasts, posts, & videos is available on our [wiki](https://github.com/lodash/lodash/wiki/Resources).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* AMD loader support ([curl](https://github.com/cujojs/curl), [dojo](http://dojotoolkit.org/), [requirejs](http://requirejs.org/), etc.)
|
||||||
|
* [_(…)](https://lodash.com/docs#_) supports intuitive chaining
|
||||||
|
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values
|
||||||
|
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
|
||||||
|
* [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
|
||||||
|
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
|
||||||
|
* [_.constant](https://lodash.com/docs#constant) & [_.property](https://lodash.com/docs#property) function generators for composing functions
|
||||||
|
* [_.contains](https://lodash.com/docs#contains) accepts a `fromIndex`
|
||||||
|
* [_.create](https://lodash.com/docs#create) for easier object inheritance
|
||||||
|
* [_.createCallback](https://lodash.com/docs#createCallback) for extending callbacks in methods & mixins
|
||||||
|
* [_.curry](https://lodash.com/docs#curry) for creating [curried](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) functions
|
||||||
|
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) accept additional `options` for more control
|
||||||
|
* [_.findIndex](https://lodash.com/docs#findIndex) & [_.findKey](https://lodash.com/docs#findKey) for finding indexes & keys
|
||||||
|
* [_.forEach](https://lodash.com/docs#forEach) is chainable & supports exiting early
|
||||||
|
* [_.forIn](https://lodash.com/docs#forIn) for iterating own & inherited properties
|
||||||
|
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties
|
||||||
|
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) for checking if values are created by `Object`
|
||||||
|
* [_.mapValues](https://lodash.com/docs#mapValues) for [mapping](https://lodash.com/docs#map) values to an object
|
||||||
|
* [_.memoize](https://lodash.com/docs#memoize) exposes the `cache` of memoized functions
|
||||||
|
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend)
|
||||||
|
* [_.noop](https://lodash.com/docs#noop) for function placeholders
|
||||||
|
* [_.now](https://lodash.com/docs#now) as a cross-browser `Date.now` alternative
|
||||||
|
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent behavior
|
||||||
|
* [_.pull](https://lodash.com/docs#pull) & [_.remove](https://lodash.com/docs#remove) for mutating arrays
|
||||||
|
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers
|
||||||
|
* [_.runInContext](https://lodash.com/docs#runInContext) for easier mocking
|
||||||
|
* [_.sortBy](https://lodash.com/docs#sortBy) supports sorting by multiple properties
|
||||||
|
* [_.support](https://lodash.com/docs#support) for flagging environment features
|
||||||
|
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings_imports) options & [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals)
|
||||||
|
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects
|
||||||
|
* [_.where](https://lodash.com/docs#where) supports deep object comparisons
|
||||||
|
* [_.xor](https://lodash.com/docs#xor) as a companion to [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union)
|
||||||
|
* [_.zip](https://lodash.com/docs#zip) is capable of unzipping values
|
||||||
|
* [_.omit](https://lodash.com/docs#omit), [_.pick](https://lodash.com/docs#pick), &
|
||||||
|
[more](https://lodash.com/docs "_.assign, _.clone, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept callbacks
|
||||||
|
* [_.contains](https://lodash.com/docs#contains), [_.toArray](https://lodash.com/docs#toArray), &
|
||||||
|
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.forEachRight, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.where") accept strings
|
||||||
|
* [_.filter](https://lodash.com/docs#filter), [_.map](https://lodash.com/docs#map), &
|
||||||
|
[more](https://lodash.com/docs "_.countBy, _.every, _.find, _.findKey, _.findLast, _.findLastIndex, _.findLastKey, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* & *“_.where”* shorthands
|
||||||
|
* [_.findLast](https://lodash.com/docs#findLast), [_.findLastIndex](https://lodash.com/docs#findLastIndex), &
|
||||||
|
[more](https://lodash.com/docs "_.findLastKey, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Tested in Chrome 5~31, Firefox 2~25, IE 6-11, Opera 9.25-17, Safari 3-7, Node.js 0.6.21-0.10.22, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, & Rhino 1.7RC5.
|
||||||
|
|||||||
35
SECURITY.md
35
SECURITY.md
@@ -1,35 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Supported versions
|
|
||||||
|
|
||||||
The following table describes the versions of this project that are currently
|
|
||||||
supported with security updates:
|
|
||||||
|
|
||||||
| Version | Supported |
|
|
||||||
| ------- | ------------------ |
|
|
||||||
| 4.x | :white_check_mark: |
|
|
||||||
| 3.x | :x: |
|
|
||||||
| 2.x | :x: |
|
|
||||||
| 1.x | :x: |
|
|
||||||
|
|
||||||
## Responsible disclosure security policy
|
|
||||||
|
|
||||||
A responsible disclosure policy helps protect users of the project from publicly
|
|
||||||
disclosed security vulnerabilities without a fix by employing a process where
|
|
||||||
vulnerabilities are first triaged in a private manner, and only publicly disclosed
|
|
||||||
after a reasonable time period that allows patching the vulnerability and provides
|
|
||||||
an upgrade path for users.
|
|
||||||
|
|
||||||
We kindly ask you to refrain from malicious acts that put our users, the project,
|
|
||||||
or any of the project’s team members at risk.
|
|
||||||
|
|
||||||
## Reporting a security issue
|
|
||||||
|
|
||||||
We consider the security of Lodash a top priority. But no matter how much effort
|
|
||||||
we put into security, there can still be vulnerabilities present.
|
|
||||||
|
|
||||||
If you discover a security vulnerability, please report the security issue
|
|
||||||
directly to the Lodash maintainers through the Security tab of the Lodash
|
|
||||||
repository.
|
|
||||||
|
|
||||||
Your efforts to responsibly disclose your findings are sincerely appreciated.
|
|
||||||
23
bower.json
Normal file
23
bower.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "lodash",
|
||||||
|
"version": "2.4.2",
|
||||||
|
"main": "dist/lodash.compat.js",
|
||||||
|
"ignore": [
|
||||||
|
".*",
|
||||||
|
"*.custom.*",
|
||||||
|
"*.template.*",
|
||||||
|
"*.map",
|
||||||
|
"*.md",
|
||||||
|
"/*.min.*",
|
||||||
|
"/lodash.js",
|
||||||
|
"index.js",
|
||||||
|
"component.json",
|
||||||
|
"package.json",
|
||||||
|
"doc",
|
||||||
|
"modularize",
|
||||||
|
"node_modules",
|
||||||
|
"perf",
|
||||||
|
"test",
|
||||||
|
"vendor"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[install.lockfile]
|
|
||||||
print = "yarn"
|
|
||||||
12
component.json
Normal file
12
component.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "lodash",
|
||||||
|
"repo": "lodash/lodash",
|
||||||
|
"version": "2.4.2",
|
||||||
|
"description": "A utility library delivering consistency, customization, performance, & extras.",
|
||||||
|
"license": "MIT",
|
||||||
|
"keywords": ["amd", "browser", "client", "functional", "server", "util"],
|
||||||
|
"scripts": [
|
||||||
|
"index.js",
|
||||||
|
"dist/lodash.compat.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
7158
dist/lodash.compat.js
vendored
Normal file
7158
dist/lodash.compat.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
92
dist/lodash.compat.min.js
vendored
Normal file
92
dist/lodash.compat.min.js
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Lo-Dash 2.4.2 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||||
|
* Build: `lodash -o ./dist/lodash.compat.js`
|
||||||
|
*/
|
||||||
|
;(function(){function n(n,r,e){for(var t=(e||0)-1,o=n?n.length:0;++t<o;)if(n[t]===r)return t;return-1}function r(r,e){var t=typeof e;if(r=r.cache,"boolean"==t||null==e)return r[e]?0:-1;"number"!=t&&"string"!=t&&(t="object");var o="number"==t?e:m+e;return r=(r=r[t])&&r[o],"object"==t?r&&n(r,e)>-1?0:-1:r?0:-1}function e(n){var r=this.cache,e=typeof n;if("boolean"==e||null==n)r[n]=!0;else{"number"!=e&&"string"!=e&&(e="object");var t="number"==e?n:m+n,o=r[e]||(r[e]={});"object"==e?(o[t]||(o[t]=[])).push(n):o[t]=!0;
|
||||||
|
|
||||||
|
}}function t(n){return n.charCodeAt(0)}function o(n,r){for(var e=n.criteria,t=r.criteria,o=-1,u=e.length;++o<u;){var a=e[o],i=t[o];if(a!==i){if(a>i||"undefined"==typeof a)return 1;if(a<i||"undefined"==typeof i)return-1}}return n.index-r.index}function u(n){var r=-1,t=n.length,o=n[0],u=n[t/2|0],a=n[t-1];if(o&&"object"==typeof o&&u&&"object"==typeof u&&a&&"object"==typeof a)return!1;var i=l();i["false"]=i["null"]=i["true"]=i.undefined=!1;var c=l();for(c.array=n,c.cache=i,c.push=e;++r<t;)c.push(n[r]);
|
||||||
|
|
||||||
|
return c}function a(n){return"\\"+Z[n]}function i(){return v.pop()||[]}function l(){return y.pop()||{array:null,cache:null,criteria:null,"false":!1,index:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,value:null}}function c(n){return"function"!=typeof n.toString&&"string"==typeof(n+"")}function f(n){n.length=0,v.length<w&&v.push(n)}function s(n){var r=n.cache;r&&s(r),n.array=n.cache=n.criteria=n.object=n.number=n.string=n.value=null,y.length<w&&y.push(n)}function p(n,r,e){
|
||||||
|
r||(r=0),"undefined"==typeof e&&(e=n?n.length:0);for(var t=-1,o=e-r||0,u=Array(o<0?0:o);++t<o;)u[t]=n[r+t];return u}function g(e){function v(n){return n&&"object"==typeof n&&!st(n)&&Ke.call(n,"__wrapped__")?n:new y(n)}function y(n,r){this.__chain__=!!r,this.__wrapped__=n}function w(n){function r(){if(t){var n=p(t);Ue.apply(n,arguments)}if(this instanceof r){var u=rn(e.prototype),a=e.apply(u,n||arguments);return Fn(a)?a:u}return e.apply(o,n||arguments)}var e=n[0],t=n[2],o=n[4];return ft(r,n),r}function Z(n,r,e,t,o){
|
||||||
|
if(e){var u=e(n);if("undefined"!=typeof u)return u}var a=Fn(n);if(!a)return n;var l=$e.call(n);if(!G[l]||!lt.nodeClass&&c(n))return n;var s=at[l];switch(l){case H:case W:return new s(+n);case K:case V:return new s(n);case M:return u=s(n.source,O.exec(n)),u.lastIndex=n.lastIndex,u}var g=st(n);if(r){var h=!t;t||(t=i()),o||(o=i());for(var v=t.length;v--;)if(t[v]==n)return o[v];u=g?s(n.length):{}}else u=g?p(n):xt({},n);return g&&(Ke.call(n,"index")&&(u.index=n.index),Ke.call(n,"input")&&(u.input=n.input)),
|
||||||
|
r?(t.push(n),o.push(u),(g?wt:Ct)(n,function(n,a){u[a]=Z(n,r,e,t,o)}),h&&(f(t),f(o)),u):u}function rn(n,r){return Fn(n)?Xe(n):{}}function en(n,r,e){if("function"!=typeof n)return ue;if("undefined"==typeof r||!("prototype"in n))return n;var t=n.__bindData__;if("undefined"==typeof t&&(lt.funcNames&&(t=!n.name),t=t||!lt.funcDecomp,!t)){var o=qe.call(n);lt.funcNames||(t=!S.test(o)),t||(t=N.test(o),ft(n,t))}if(t===!1||t!==!0&&1&t[1])return n;switch(e){case 1:return function(e){return n.call(r,e)};case 2:
|
||||||
|
return function(e,t){return n.call(r,e,t)};case 3:return function(e,t,o){return n.call(r,e,t,o)};case 4:return function(e,t,o,u){return n.call(r,e,t,o,u)}}return qr(n,r)}function tn(n){function r(){var n=l?a:this;if(o){var h=p(o);Ue.apply(h,arguments)}if((u||f)&&(h||(h=p(arguments)),u&&Ue.apply(h,u),f&&h.length<i))return t|=16,tn([e,s?t:-4&t,h,null,a,i]);if(h||(h=arguments),c&&(e=n[g]),this instanceof r){n=rn(e.prototype);var v=e.apply(n,h);return Fn(v)?v:n}return e.apply(n,h)}var e=n[0],t=n[1],o=n[2],u=n[3],a=n[4],i=n[5],l=1&t,c=2&t,f=4&t,s=8&t,g=e;
|
||||||
|
|
||||||
|
return ft(r,n),r}function on(e,t){var o=-1,a=yn(),i=e?e.length:0,l=i>=_&&a===n,c=[];if(l){var f=u(t);f?(a=r,t=f):l=!1}for(;++o<i;){var p=e[o];a(t,p)<0&&c.push(p)}return l&&s(t),c}function an(n,r,e,t){for(var o=(t||0)-1,u=n?n.length:0,a=[];++o<u;){var i=n[o];if(i&&"object"==typeof i&&"number"==typeof i.length&&(st(i)||_n(i))){r||(i=an(i,r,e));var l=-1,c=i.length,f=a.length;for(a.length+=c;++l<c;)a[f++]=i[l]}else e||a.push(i)}return a}function ln(n,r,e,t,o,u){if(e){var a=e(n,r);if("undefined"!=typeof a)return!!a;
|
||||||
|
|
||||||
|
}if(n===r)return 0!==n||1/n==1/r;var l=typeof n,s=typeof r;if(n===n&&(!n||!Y[l])&&(!r||!Y[s]))return!1;if(null==n||null==r)return n===r;var p=$e.call(n),g=$e.call(r);if(p==F&&(p=U),g==F&&(g=U),p!=g)return!1;switch(p){case H:case W:return+n==+r;case K:return n!=+n?r!=+r:0==n?1/n==1/r:n==+r;case M:case V:return n==Ae(r)}var v=p==B;if(!v){var y=Ke.call(n,"__wrapped__"),b=Ke.call(r,"__wrapped__");if(y||b)return ln(y?n.__wrapped__:n,b?r.__wrapped__:r,e,t,o,u);if(p!=U||!lt.nodeClass&&(c(n)||c(r)))return!1;
|
||||||
|
|
||||||
|
var d=!lt.argsObject&&_n(n)?Oe:n.constructor,m=!lt.argsObject&&_n(r)?Oe:r.constructor;if(d!=m&&!($n(d)&&d instanceof d&&$n(m)&&m instanceof m)&&"constructor"in n&&"constructor"in r)return!1}var _=!o;o||(o=i()),u||(u=i());for(var w=o.length;w--;)if(o[w]==n)return u[w]==r;var x=0;if(a=!0,o.push(n),u.push(r),v){if(w=n.length,x=r.length,a=x==w,a||t)for(;x--;){var j=w,k=r[x];if(t)for(;j--&&!(a=ln(n[j],k,e,t,o,u)););else if(!(a=ln(n[x],k,e,t,o,u)))break}}else kt(r,function(r,i,l){return Ke.call(l,i)?(x++,
|
||||||
|
a=Ke.call(n,i)&&ln(n[i],r,e,t,o,u)):h}),a&&!t&&kt(n,function(n,r,e){return Ke.call(e,r)?a=--x>-1:h});return o.pop(),u.pop(),_&&(f(o),f(u)),a}function cn(n,r,e,t,o){(st(r)?or:Ct)(r,function(r,u){var a,i,l=r,c=n[u];if(r&&((i=st(r))||Pt(r))){for(var f=t.length;f--;)if(a=t[f]==r){c=o[f];break}if(!a){var s;e&&(l=e(c,r),(s="undefined"!=typeof l)&&(c=l)),s||(c=i?st(c)?c:[]:Pt(c)?c:{}),t.push(r),o.push(c),s||cn(c,r,e,t,o)}}else e&&(l=e(c,r),"undefined"==typeof l&&(l=r)),"undefined"!=typeof l&&(c=l);n[u]=c;
|
||||||
|
|
||||||
|
})}function fn(n,r){return n+We(ut()*(r-n+1))}function sn(e,t,o){var a=-1,l=yn(),c=e?e.length:0,p=[],g=!t&&c>=_&&l===n,h=o||g?i():p;if(g){var v=u(h);l=r,h=v}for(;++a<c;){var y=e[a],b=o?o(y,a,e):y;(t?!a||h[h.length-1]!==b:l(h,b)<0)&&((o||g)&&h.push(b),p.push(y))}return g?(f(h.array),s(h)):o&&f(h),p}function pn(n){return function(r,e,t){var o={};if(e=v.createCallback(e,t,3),st(r))for(var u=-1,a=r.length;++u<a;){var i=r[u];n(o,i,e(i,u,r),r)}else wt(r,function(r,t,u){n(o,r,e(r,t,u),u)});return o}}function gn(n,r,e,t,o,u){
|
||||||
|
var a=1&r,i=2&r,l=4&r,c=16&r,f=32&r;if(!i&&!$n(n))throw new Ie;c&&!e.length&&(r&=-17,c=e=!1),f&&!t.length&&(r&=-33,f=t=!1);var s=n&&n.__bindData__;if(s&&s!==!0)return s=p(s),s[2]&&(s[2]=p(s[2])),s[3]&&(s[3]=p(s[3])),!a||1&s[1]||(s[4]=o),!a&&1&s[1]&&(r|=8),!l||4&s[1]||(s[5]=u),c&&Ue.apply(s[2]||(s[2]=[]),e),f&&Je.apply(s[3]||(s[3]=[]),t),s[1]|=r,gn.apply(null,s);var g=1==r||17===r?w:tn;return g([n,r,e,t,o,u])}function hn(){X.shadowedProps=D,X.array=X.bottom=X.loop=X.top="",X.init="iterable",X.useHas=!0;
|
||||||
|
|
||||||
|
for(var n,r=0;n=arguments[r];r++)for(var e in n)X[e]=n[e];var t=X.args;X.firstArg=/^[^,]+/.exec(t)[0];var o=Ce("baseCreateCallback, errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments, isArray, isString, keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString","return function("+t+") {\n"+ct(X)+"\n}");return o(en,q,Ne,Ke,d,_n,st,zn,X.keys,Re,Y,it,V,Te,$e)}function vn(n){return bt[n]}function yn(){var r=(r=v.indexOf)===Cr?n:r;return r}function bn(n){return"function"==typeof n&&Fe.test(n);
|
||||||
|
|
||||||
|
}function dn(n){var r,e;return!n||$e.call(n)!=U||(r=n.constructor,$n(r)&&!(r instanceof r))||!lt.argsClass&&_n(n)||!lt.nodeClass&&c(n)?!1:lt.ownLast?(kt(n,function(n,r,t){return e=Ke.call(t,r),!1}),e!==!1):(kt(n,function(n,r){e=r}),"undefined"==typeof e||Ke.call(n,e))}function mn(n){return dt[n]}function _n(n){return n&&"object"==typeof n&&"number"==typeof n.length&&$e.call(n)==F||!1}function wn(n,r,e,t){return"boolean"!=typeof r&&null!=r&&(t=e,e=r,r=!1),Z(n,r,"function"==typeof e&&en(e,t,1))}function xn(n,r,e){
|
||||||
|
return Z(n,!0,"function"==typeof r&&en(r,e,1))}function jn(n,r){var e=rn(n);return r?xt(e,r):e}function kn(n,r,e){var t;return r=v.createCallback(r,e,3),Ct(n,function(n,e,o){return r(n,e,o)?(t=e,!1):h}),t}function Cn(n,r,e){var t;return r=v.createCallback(r,e,3),En(n,function(n,e,o){return r(n,e,o)?(t=e,!1):h}),t}function Pn(n,r,e){var t=[];kt(n,function(n,r){t.push(r,n)});var o=t.length;for(r=en(r,e,3);o--&&r(t[o--],t[o],n)!==!1;);return n}function En(n,r,e){var t=gt(n),o=t.length;for(r=en(r,e,3);o--;){
|
||||||
|
var u=t[o];if(r(n[u],u,n)===!1)break}return n}function On(n){var r=[];return kt(n,function(n,e){$n(n)&&r.push(e)}),r.sort()}function Sn(n,r){return n?Ke.call(n,r):!1}function An(n){for(var r=-1,e=gt(n),t=e.length,o={};++r<t;){var u=e[r];o[n[u]]=u}return o}function In(n){return n===!0||n===!1||n&&"object"==typeof n&&$e.call(n)==H||!1}function Ln(n){return n&&"object"==typeof n&&$e.call(n)==W||!1}function Nn(n){return n&&1===n.nodeType||!1}function Rn(n){var r=!0;if(!n)return r;var e=$e.call(n),t=n.length;
|
||||||
|
|
||||||
|
return e==B||e==V||(lt.argsClass?e==F:_n(n))||e==U&&"number"==typeof t&&$n(n.splice)?!t:(Ct(n,function(){return r=!1}),r)}function Tn(n,r,e,t){return ln(n,r,"function"==typeof e&&en(e,t,2))}function Dn(n){return Ze(n)&&!nt(parseFloat(n))}function $n(n){return"function"==typeof n}function Fn(n){return!(!n||!Y[typeof n])}function Bn(n){return Wn(n)&&n!=+n}function Hn(n){return null===n}function Wn(n){return"number"==typeof n||n&&"object"==typeof n&&$e.call(n)==K||!1}function qn(n){return n&&Y[typeof n]&&$e.call(n)==M||!1;
|
||||||
|
|
||||||
|
}function zn(n){return"string"==typeof n||n&&"object"==typeof n&&$e.call(n)==V||!1}function Kn(n){return"undefined"==typeof n}function Un(n,r,e){var t={};return r=v.createCallback(r,e,3),Ct(n,function(n,e,o){t[e]=r(n,e,o)}),t}function Mn(n){var r=arguments,e=2;if(!Fn(n))return n;if("number"!=typeof r[2]&&(e=r.length),e>3&&"function"==typeof r[e-2])var t=en(r[--e-1],r[e--],2);else e>2&&"function"==typeof r[e-1]&&(t=r[--e]);for(var o=p(arguments,1,e),u=-1,a=i(),l=i();++u<e;)cn(n,o[u],t,a,l);return f(a),
|
||||||
|
f(l),n}function Vn(n,r,e){var t={};if("function"!=typeof r){var o=[];kt(n,function(n,r){o.push(r)}),o=on(o,an(arguments,!0,!1,1));for(var u=-1,a=o.length;++u<a;){var i=o[u];t[i]=n[i]}}else r=v.createCallback(r,e,3),kt(n,function(n,e,o){r(n,e,o)||(t[e]=n)});return t}function Gn(n){for(var r=-1,e=gt(n),t=e.length,o=we(t);++r<t;){var u=e[r];o[r]=[u,n[u]]}return o}function Jn(n,r,e){var t={};if("function"!=typeof r)for(var o=-1,u=an(arguments,!0,!1,1),a=Fn(n)?u.length:0;++o<a;){var i=u[o];i in n&&(t[i]=n[i]);
|
||||||
|
|
||||||
|
}else r=v.createCallback(r,e,3),kt(n,function(n,e,o){r(n,e,o)&&(t[e]=n)});return t}function Qn(n,r,e,t){var o=st(n);if(null==e)if(o)e=[];else{var u=n&&n.constructor,a=u&&u.prototype;e=rn(a)}return r&&(r=v.createCallback(r,t,4),(o?wt:Ct)(n,function(n,t,o){return r(e,n,t,o)})),e}function Xn(n){for(var r=-1,e=gt(n),t=e.length,o=we(t);++r<t;)o[r]=n[e[r]];return o}function Yn(n){var r=arguments,e=-1,t=an(r,!0,!1,1),o=r[2]&&r[2][r[1]]===n?1:t.length,u=we(o);for(lt.unindexedChars&&zn(n)&&(n=n.split(""));++e<o;)u[e]=n[t[e]];
|
||||||
|
|
||||||
|
return u}function Zn(n,r,e){var t=-1,o=yn(),u=n?n.length:0,a=!1;return e=(e<0?et(0,u+e):e)||0,st(n)?a=o(n,r,e)>-1:"number"==typeof u?a=(zn(n)?n.indexOf(r,e):o(n,r,e))>-1:wt(n,function(n){return++t<e?h:!(a=n===r)}),a}function nr(n,r,e){var t=!0;if(r=v.createCallback(r,e,3),st(n))for(var o=-1,u=n.length;++o<u&&(t=!!r(n[o],o,n)););else wt(n,function(n,e,o){return t=!!r(n,e,o)});return t}function rr(n,r,e){var t=[];if(r=v.createCallback(r,e,3),st(n))for(var o=-1,u=n.length;++o<u;){var a=n[o];r(a,o,n)&&t.push(a);
|
||||||
|
|
||||||
|
}else wt(n,function(n,e,o){r(n,e,o)&&t.push(n)});return t}function er(n,r,e){if(r=v.createCallback(r,e,3),!st(n)){var t;return wt(n,function(n,e,o){return r(n,e,o)?(t=n,!1):h}),t}for(var o=-1,u=n.length;++o<u;){var a=n[o];if(r(a,o,n))return a}}function tr(n,r,e){var t;return r=v.createCallback(r,e,3),ur(n,function(n,e,o){return r(n,e,o)?(t=n,!1):h}),t}function or(n,r,e){if(r&&"undefined"==typeof e&&st(n))for(var t=-1,o=n.length;++t<o&&r(n[t],t,n)!==!1;);else wt(n,r,e);return n}function ur(n,r,e){
|
||||||
|
var t=n,o=n?n.length:0;if(r=r&&"undefined"==typeof e?r:en(r,e,3),st(n))for(;o--&&r(n[o],o,n)!==!1;);else{if("number"!=typeof o){var u=gt(n);o=u.length}else lt.unindexedChars&&zn(n)&&(t=n.split(""));wt(n,function(n,e,a){return e=u?u[--o]:--o,r(t[e],e,a)})}return n}function ar(n,r){var e=p(arguments,2),t=-1,o="function"==typeof r,u=n?n.length:0,a=we("number"==typeof u?u:0);return or(n,function(n){a[++t]=(o?r:n[r]).apply(n,e)}),a}function ir(n,r,e){var t=-1,o=n?n.length:0,u=we("number"==typeof o?o:0);
|
||||||
|
|
||||||
|
if(r=v.createCallback(r,e,3),st(n))for(;++t<o;)u[t]=r(n[t],t,n);else wt(n,function(n,e,o){u[++t]=r(n,e,o)});return u}function lr(n,r,e){var o=-(1/0),u=o;if("function"!=typeof r&&e&&e[r]===n&&(r=null),null==r&&st(n))for(var a=-1,i=n.length;++a<i;){var l=n[a];l>u&&(u=l)}else r=null==r&&zn(n)?t:v.createCallback(r,e,3),wt(n,function(n,e,t){var a=r(n,e,t);a>o&&(o=a,u=n)});return u}function cr(n,r,e){var o=1/0,u=o;if("function"!=typeof r&&e&&e[r]===n&&(r=null),null==r&&st(n))for(var a=-1,i=n.length;++a<i;){
|
||||||
|
var l=n[a];l<u&&(u=l)}else r=null==r&&zn(n)?t:v.createCallback(r,e,3),wt(n,function(n,e,t){var a=r(n,e,t);a<o&&(o=a,u=n)});return u}function fr(n,r,e,t){var o=arguments.length<3;if(r=v.createCallback(r,t,4),st(n)){var u=-1,a=n.length;for(o&&(e=n[++u]);++u<a;)e=r(e,n[u],u,n)}else wt(n,function(n,t,u){e=o?(o=!1,n):r(e,n,t,u)});return e}function sr(n,r,e,t){var o=arguments.length<3;return r=v.createCallback(r,t,4),ur(n,function(n,t,u){e=o?(o=!1,n):r(e,n,t,u)}),e}function pr(n,r,e){return r=v.createCallback(r,e,3),
|
||||||
|
rr(n,function(n,e,t){return!r(n,e,t)})}function gr(n,r,e){if(n&&"number"!=typeof n.length?n=Xn(n):lt.unindexedChars&&zn(n)&&(n=n.split("")),null==r||e)return n?n[fn(0,n.length-1)]:h;var t=hr(n);return t.length=tt(et(0,r),t.length),t}function hr(n){var r=-1,e=n?n.length:0,t=we("number"==typeof e?e:0);return or(n,function(n){var e=fn(0,++r);t[r]=t[e],t[e]=n}),t}function vr(n){var r=n?n.length:0;return"number"==typeof r?r:gt(n).length}function yr(n,r,e){var t;if(r=v.createCallback(r,e,3),st(n))for(var o=-1,u=n.length;++o<u&&!(t=r(n[o],o,n)););else wt(n,function(n,e,o){
|
||||||
|
return!(t=r(n,e,o))});return!!t}function br(n,r,e){var t=-1,u=st(r),a=n?n.length:0,c=we("number"==typeof a?a:0);for(u||(r=v.createCallback(r,e,3)),or(n,function(n,e,o){var a=c[++t]=l();u?a.criteria=ir(r,function(r){return n[r]}):(a.criteria=i())[0]=r(n,e,o),a.index=t,a.value=n}),a=c.length,c.sort(o);a--;){var p=c[a];c[a]=p.value,u||f(p.criteria),s(p)}return c}function dr(n){return n&&"number"==typeof n.length?lt.unindexedChars&&zn(n)?n.split(""):p(n):Xn(n)}function mr(n){for(var r=-1,e=n?n.length:0,t=[];++r<e;){
|
||||||
|
var o=n[r];o&&t.push(o)}return t}function _r(n){return on(n,an(arguments,!0,!0,1))}function wr(n,r,e){var t=-1,o=n?n.length:0;for(r=v.createCallback(r,e,3);++t<o;)if(r(n[t],t,n))return t;return-1}function xr(n,r,e){var t=n?n.length:0;for(r=v.createCallback(r,e,3);t--;)if(r(n[t],t,n))return t;return-1}function jr(n,r,e){var t=0,o=n?n.length:0;if("number"!=typeof r&&null!=r){var u=-1;for(r=v.createCallback(r,e,3);++u<o&&r(n[u],u,n);)t++}else if(t=r,null==t||e)return n?n[0]:h;return p(n,0,tt(et(0,t),o));
|
||||||
|
|
||||||
|
}function kr(n,r,e,t){return"boolean"!=typeof r&&null!=r&&(t=e,e="function"!=typeof r&&t&&t[r]===n?null:r,r=!1),null!=e&&(n=ir(n,e,t)),an(n,r)}function Cr(r,e,t){if("number"==typeof t){var o=r?r.length:0;t=t<0?et(0,o+t):t||0}else if(t){var u=Rr(r,e);return r[u]===e?u:-1}return n(r,e,t)}function Pr(n,r,e){var t=0,o=n?n.length:0;if("number"!=typeof r&&null!=r){var u=o;for(r=v.createCallback(r,e,3);u--&&r(n[u],u,n);)t++}else t=null==r||e?1:r||t;return p(n,0,tt(et(0,o-t),o))}function Er(){for(var e=[],t=-1,o=arguments.length,a=i(),l=yn(),c=l===n,p=i();++t<o;){
|
||||||
|
var g=arguments[t];(st(g)||_n(g))&&(e.push(g),a.push(c&&g.length>=_&&u(t?e[t]:p)))}var h=e[0],v=-1,y=h?h.length:0,b=[];n:for(;++v<y;){var d=a[0];if(g=h[v],(d?r(d,g):l(p,g))<0){for(t=o,(d||p).push(g);--t;)if(d=a[t],(d?r(d,g):l(e[t],g))<0)continue n;b.push(g)}}for(;o--;)d=a[o],d&&s(d);return f(a),f(p),b}function Or(n,r,e){var t=0,o=n?n.length:0;if("number"!=typeof r&&null!=r){var u=o;for(r=v.createCallback(r,e,3);u--&&r(n[u],u,n);)t++}else if(t=r,null==t||e)return n?n[o-1]:h;return p(n,et(0,o-t))}function Sr(n,r,e){
|
||||||
|
var t=n?n.length:0;for("number"==typeof e&&(t=(e<0?et(0,t+e):tt(e,t-1))+1);t--;)if(n[t]===r)return t;return-1}function Ar(n){for(var r=arguments,e=0,t=r.length,o=n?n.length:0;++e<t;)for(var u=-1,a=r[e];++u<o;)n[u]===a&&(Ge.call(n,u--,1),o--);return n}function Ir(n,r,e){n=+n||0,e="number"==typeof e?e:+e||1,null==r&&(r=n,n=0);for(var t=-1,o=et(0,Be((r-n)/(e||1))),u=we(o);++t<o;)u[t]=n,n+=e;return u}function Lr(n,r,e){var t=-1,o=n?n.length:0,u=[];for(r=v.createCallback(r,e,3);++t<o;){var a=n[t];r(a,t,n)&&(u.push(a),
|
||||||
|
Ge.call(n,t--,1),o--)}return u}function Nr(n,r,e){if("number"!=typeof r&&null!=r){var t=0,o=-1,u=n?n.length:0;for(r=v.createCallback(r,e,3);++o<u&&r(n[o],o,n);)t++}else t=null==r||e?1:et(0,r);return p(n,t)}function Rr(n,r,e,t){var o=0,u=n?n.length:o;for(e=e?v.createCallback(e,t,1):ue,r=e(r);o<u;){var a=o+u>>>1;e(n[a])<r?o=a+1:u=a}return o}function Tr(){return sn(an(arguments,!0,!0))}function Dr(n,r,e,t){return"boolean"!=typeof r&&null!=r&&(t=e,e="function"!=typeof r&&t&&t[r]===n?null:r,r=!1),null!=e&&(e=v.createCallback(e,t,3)),
|
||||||
|
sn(n,r,e)}function $r(n){return on(n,p(arguments,1))}function Fr(){for(var n=-1,r=arguments.length;++n<r;){var e=arguments[n];if(st(e)||_n(e))var t=t?sn(on(t,e).concat(on(e,t))):e}return t||[]}function Br(){for(var n=arguments.length>1?arguments:arguments[0],r=-1,e=n?lr(At(n,"length")):0,t=we(e<0?0:e);++r<e;)t[r]=At(n,r);return t}function Hr(n,r){var e=-1,t=n?n.length:0,o={};for(r||!t||st(n[0])||(r=[]);++e<t;){var u=n[e];r?o[u]=r[e]:u&&(o[u[0]]=u[1])}return o}function Wr(n,r){if(!$n(r))throw new Ie;
|
||||||
|
|
||||||
|
return function(){return--n<1?r.apply(this,arguments):h}}function qr(n,r){return arguments.length>2?gn(n,17,p(arguments,2),null,r):gn(n,1,null,null,r)}function zr(n){for(var r=arguments.length>1?an(arguments,!0,!1,1):On(n),e=-1,t=r.length;++e<t;){var o=r[e];n[o]=gn(n[o],1,null,null,n)}return n}function Kr(n,r){return arguments.length>2?gn(r,19,p(arguments,2),null,n):gn(r,3,null,null,n)}function Ur(){for(var n=arguments,r=n.length;r--;)if(!$n(n[r]))throw new Ie;return function(){for(var r=arguments,e=n.length;e--;)r=[n[e].apply(this,r)];
|
||||||
|
|
||||||
|
return r[0]}}function Mr(n,r){return r="number"==typeof r?r:+r||n.length,gn(n,4,null,null,null,r)}function Vr(n,r,e){var t,o,u,a,i,l,c,f=0,s=!1,p=!0;if(!$n(n))throw new Ie;if(r=et(0,r)||0,e===!0){var g=!0;p=!1}else Fn(e)&&(g=e.leading,s="maxWait"in e&&(et(r,e.maxWait)||0),p="trailing"in e?e.trailing:p);var v=function(){var e=r-(Lt()-a);if(e>0)l=Ve(v,e);else{o&&He(o);var s=c;o=l=c=h,s&&(f=Lt(),u=n.apply(i,t),l||o||(t=i=null))}},y=function(){l&&He(l),o=l=c=h,(p||s!==r)&&(f=Lt(),u=n.apply(i,t),l||o||(t=i=null));
|
||||||
|
|
||||||
|
};return function(){if(t=arguments,a=Lt(),i=this,c=p&&(l||!g),s===!1)var e=g&&!l;else{o||g||(f=a);var h=s-(a-f),b=h<=0;b?(o&&(o=He(o)),f=a,u=n.apply(i,t)):o||(o=Ve(y,h))}return b&&l?l=He(l):l||r===s||(l=Ve(v,r)),e&&(b=!0,u=n.apply(i,t)),!b||l||o||(t=i=null),u}}function Gr(n){if(!$n(n))throw new Ie;var r=p(arguments,1);return Ve(function(){n.apply(h,r)},1)}function Jr(n,r){if(!$n(n))throw new Ie;var e=p(arguments,2);return Ve(function(){n.apply(h,e)},r)}function Qr(n,r){if(!$n(n))throw new Ie;var e=function(){
|
||||||
|
var t=e.cache,o=r?r.apply(this,arguments):m+arguments[0];return Ke.call(t,o)?t[o]:t[o]=n.apply(this,arguments)};return e.cache={},e}function Xr(n){var r,e;if(!$n(n))throw new Ie;return function(){return r?e:(r=!0,e=n.apply(this,arguments),n=null,e)}}function Yr(n){return gn(n,16,p(arguments,1))}function Zr(n){return gn(n,32,null,p(arguments,1))}function ne(n,r,e){var t=!0,o=!0;if(!$n(n))throw new Ie;return e===!1?t=!1:Fn(e)&&(t="leading"in e?e.leading:t,o="trailing"in e?e.trailing:o),J.leading=t,
|
||||||
|
J.maxWait=r,J.trailing=o,Vr(n,r,J)}function re(n,r){return gn(r,16,[n])}function ee(n){return function(){return n}}function te(n,r,e){var t=typeof n;if(null==n||"function"==t)return en(n,r,e);if("object"!=t)return ce(n);var o=gt(n),u=o[0],a=n[u];return 1!=o.length||a!==a||Fn(a)?function(r){for(var e=o.length,t=!1;e--&&(t=ln(r[o[e]],n[o[e]],null,!0)););return t}:function(n){var r=n[u];return a===r&&(0!==a||1/a==1/r)}}function oe(n){return null==n?"":Ae(n).replace(_t,vn)}function ue(n){return n}function ae(n,r,e){
|
||||||
|
var t=!0,o=r&&On(r);r&&(e||o.length)||(null==e&&(e=r),u=y,r=n,n=v,o=On(r)),e===!1?t=!1:Fn(e)&&"chain"in e&&(t=e.chain);var u=n,a=$n(u);or(o,function(e){var o=n[e]=r[e];a&&(u.prototype[e]=function(){var r=this.__chain__,e=this.__wrapped__,a=[e];Ue.apply(a,arguments);var i=o.apply(n,a);if(t||r){if(e===i&&Fn(i))return this;i=new u(i),i.__chain__=r}return i})})}function ie(){return e._=De,this}function le(){}function ce(n){return function(r){return r[n]}}function fe(n,r,e){var t=null==n,o=null==r;if(null==e&&("boolean"==typeof n&&o?(e=n,
|
||||||
|
n=1):o||"boolean"!=typeof r||(e=r,o=!0)),t&&o&&(r=1),n=+n||0,o?(r=n,n=0):r=+r||0,e||n%1||r%1){var u=ut();return tt(n+u*(r-n+parseFloat("1e-"+((u+"").length-1))),r)}return fn(n,r)}function se(n,r){if(n){var e=n[r];return $n(e)?n[r]():e}}function pe(n,r,e){var t=v.templateSettings;n=Ae(n||""),e=jt({},e,t);var o,u=jt({},e.imports,t.imports),i=gt(u),l=Xn(u),c=0,f=e.interpolate||L,s="__p += '",p=Se((e.escape||L).source+"|"+f.source+"|"+(f===A?E:L).source+"|"+(e.evaluate||L).source+"|$","g");n.replace(p,function(r,e,t,u,i,l){
|
||||||
|
return t||(t=u),s+=n.slice(c,l).replace(R,a),e&&(s+="' +\n__e("+e+") +\n'"),i&&(o=!0,s+="';\n"+i+";\n__p += '"),t&&(s+="' +\n((__t = ("+t+")) == null ? '' : __t) +\n'"),c=l+r.length,r}),s+="';\n";var g=e.variable,y=g;y||(g="obj",s="with ("+g+") {\n"+s+"\n}\n"),s=(o?s.replace(j,""):s).replace(C,"$1").replace(P,"$1;"),s="function("+g+") {\n"+(y?"":g+" || ("+g+" = {});\n")+"var __t, __p = '', __e = _.escape"+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";
|
||||||
|
|
||||||
|
var b="\n/*\n//# sourceURL="+(e.sourceURL||"/lodash/template/source["+$++ +"]")+"\n*/";try{var d=Ce(i,"return "+s+b).apply(h,l)}catch(m){throw m.source=s,m}return r?d(r):(d.source=s,d)}function ge(n,r,e){n=(n=+n)>-1?n:0;var t=-1,o=we(n);for(r=en(r,e,1);++t<n;)o[t]=r(t);return o}function he(n){return null==n?"":Ae(n).replace(mt,mn)}function ve(n){var r=++b;return Ae(null==n?"":n)+r}function ye(n){return n=new y(n),n.__chain__=!0,n}function be(n,r){return r(n),n}function de(){return this.__chain__=!0,
|
||||||
|
this}function me(){return Ae(this.__wrapped__)}function _e(){return this.__wrapped__}e=e?un.defaults(nn.Object(),e,un.pick(nn,T)):nn;var we=e.Array,xe=e.Boolean,je=e.Date,ke=e.Error,Ce=e.Function,Pe=e.Math,Ee=e.Number,Oe=e.Object,Se=e.RegExp,Ae=e.String,Ie=e.TypeError,Le=[],Ne=ke.prototype,Re=Oe.prototype,Te=Ae.prototype,De=e._,$e=Re.toString,Fe=Se("^"+Ae($e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Be=Pe.ceil,He=e.clearTimeout,We=Pe.floor,qe=Ce.prototype.toString,ze=bn(ze=Oe.getPrototypeOf)&&ze,Ke=Re.hasOwnProperty,Ue=Le.push,Me=Re.propertyIsEnumerable,Ve=e.setTimeout,Ge=Le.splice,Je=Le.unshift,Qe=function(){
|
||||||
|
try{var n={},r=bn(r=Oe.defineProperty)&&r,e=r(n,n,n)&&r}catch(t){}return e}(),Xe=bn(Xe=Oe.create)&&Xe,Ye=bn(Ye=we.isArray)&&Ye,Ze=e.isFinite,nt=e.isNaN,rt=bn(rt=Oe.keys)&&rt,et=Pe.max,tt=Pe.min,ot=e.parseInt,ut=Pe.random,at={};at[B]=we,at[H]=xe,at[W]=je,at[z]=Ce,at[U]=Oe,at[K]=Ee,at[M]=Se,at[V]=Ae;var it={};it[B]=it[W]=it[K]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},it[H]=it[V]={constructor:!0,toString:!0,valueOf:!0},it[q]=it[z]=it[M]={constructor:!0,toString:!0},it[U]={constructor:!0
|
||||||
|
},function(){for(var n=D.length;n--;){var r=D[n];for(var e in it)Ke.call(it,e)&&!Ke.call(it[e],r)&&(it[e][r]=!1)}}(),y.prototype=v.prototype;var lt=v.support={};!function(){var n=function(){this.x=1},r={0:1,length:1},t=[];n.prototype={valueOf:1,y:1};for(var o in new n)t.push(o);for(o in arguments);lt.argsClass=$e.call(arguments)==F,lt.argsObject=arguments.constructor==Oe&&!(arguments instanceof we),lt.enumErrorProps=Me.call(Ne,"message")||Me.call(Ne,"name"),lt.enumPrototypes=Me.call(n,"prototype"),
|
||||||
|
lt.funcDecomp=!bn(e.WinRTError)&&N.test(g),lt.funcNames="string"==typeof Ce.name,lt.nonEnumArgs=0!=o,lt.nonEnumShadows=!/valueOf/.test(t),lt.ownLast="x"!=t[0],lt.spliceObjects=(Le.splice.call(r,0,1),!r[0]),lt.unindexedChars="x"[0]+Oe("x")[0]!="xx";try{lt.nodeClass=!($e.call(document)==U&&!({toString:0}+""))}catch(u){lt.nodeClass=!0}}(1),v.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:A,variable:"",imports:{_:v}};var ct=function(n){var r="var index, iterable = "+n.firstArg+", result = "+n.init+";\nif (!iterable) return result;\n"+n.top+";";
|
||||||
|
|
||||||
|
n.array?(r+="\nvar length = iterable.length; index = -1;\nif ("+n.array+") { ",lt.unindexedChars&&(r+="\n if (isString(iterable)) {\n iterable = iterable.split('')\n } "),r+="\n while (++index < length) {\n "+n.loop+";\n }\n}\nelse { "):lt.nonEnumArgs&&(r+="\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += '';\n "+n.loop+";\n }\n } else { "),lt.enumPrototypes&&(r+="\n var skipProto = typeof iterable == 'function';\n "),
|
||||||
|
lt.enumErrorProps&&(r+="\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n ");var e=[];if(lt.enumPrototypes&&e.push('!(skipProto && index == "prototype")'),lt.enumErrorProps&&e.push('!(skipErrorProps && (index == "message" || index == "name"))'),n.useHas&&n.keys)r+="\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n",
|
||||||
|
e.length&&(r+=" if ("+e.join(" && ")+") {\n "),r+=n.loop+"; ",e.length&&(r+="\n }"),r+="\n } ";else if(r+="\n for (index in iterable) {\n",n.useHas&&e.push("hasOwnProperty.call(iterable, index)"),e.length&&(r+=" if ("+e.join(" && ")+") {\n "),r+=n.loop+"; ",e.length&&(r+="\n }"),r+="\n } ",lt.nonEnumShadows){for(r+="\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n ",
|
||||||
|
k=0;k<7;k++)r+="\n index = '"+n.shadowedProps[k]+"';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))",n.useHas||(r+=" || (!nonEnum[index] && iterable[index] !== objectProto[index])"),r+=") {\n "+n.loop+";\n } ";r+="\n } "}return(n.array||lt.nonEnumArgs)&&(r+="\n}"),r+=n.bottom+";\nreturn result"};Xe||(rn=function(){function n(){}return function(r){if(Fn(r)){n.prototype=r;var t=new n;n.prototype=null}return t||e.Object()}}());var ft=Qe?function(n,r){
|
||||||
|
Q.value=r,Qe(n,"__bindData__",Q),Q.value=null}:le;lt.argsClass||(_n=function(n){return n&&"object"==typeof n&&"number"==typeof n.length&&Ke.call(n,"callee")&&!Me.call(n,"callee")||!1});var st=Ye||function(n){return n&&"object"==typeof n&&"number"==typeof n.length&&$e.call(n)==B||!1},pt=hn({args:"object",init:"[]",top:"if (!(objectTypes[typeof object])) return result",loop:"result.push(index)"}),gt=rt?function(n){return Fn(n)?lt.enumPrototypes&&"function"==typeof n||lt.nonEnumArgs&&n.length&&_n(n)?pt(n):rt(n):[];
|
||||||
|
|
||||||
|
}:pt,ht={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",array:"typeof length == 'number'",keys:gt,loop:"if (callback(iterable[index], index, collection) === false) return result"},vt={args:"object, source, guard",top:"var args = arguments,\n argsIndex = 0,\n argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n iterable = args[argsIndex];\n if (iterable && objectTypes[typeof iterable]) {",
|
||||||
|
keys:gt,loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:" }\n}"},yt={top:"if (!objectTypes[typeof iterable]) return result;\n"+ht.top,array:!1},bt={"&":"&","<":"<",">":">",'"':""","'":"'"},dt=An(bt),mt=Se("("+gt(dt).join("|")+")","g"),_t=Se("["+gt(bt).join("")+"]","g"),wt=hn(ht),xt=hn(vt,{top:vt.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n callback = args[--argsLength];\n}"),
|
||||||
|
loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"}),jt=hn(vt),kt=hn(ht,yt,{useHas:!1}),Ct=hn(ht,yt);$n(/x/)&&($n=function(n){return"function"==typeof n&&$e.call(n)==z});var Pt=ze?function(n){if(!n||$e.call(n)!=U||!lt.argsClass&&_n(n))return!1;var r=n.valueOf,e=bn(r)&&(e=ze(r))&&ze(e);return e?n==e||ze(n)==e:dn(n)}:dn,Et=pn(function(n,r,e){Ke.call(n,e)?n[e]++:n[e]=1}),Ot=pn(function(n,r,e){(Ke.call(n,e)?n[e]:n[e]=[]).push(r)}),St=pn(function(n,r,e){n[e]=r;
|
||||||
|
|
||||||
|
}),At=ir,It=rr,Lt=bn(Lt=je.now)&&Lt||function(){return(new je).getTime()},Nt=8==ot(x+"08")?ot:function(n,r){return ot(zn(n)?n.replace(I,""):n,r||0)};return v.after=Wr,v.assign=xt,v.at=Yn,v.bind=qr,v.bindAll=zr,v.bindKey=Kr,v.chain=ye,v.compact=mr,v.compose=Ur,v.constant=ee,v.countBy=Et,v.create=jn,v.createCallback=te,v.curry=Mr,v.debounce=Vr,v.defaults=jt,v.defer=Gr,v.delay=Jr,v.difference=_r,v.filter=rr,v.flatten=kr,v.forEach=or,v.forEachRight=ur,v.forIn=kt,v.forInRight=Pn,v.forOwn=Ct,v.forOwnRight=En,
|
||||||
|
v.functions=On,v.groupBy=Ot,v.indexBy=St,v.initial=Pr,v.intersection=Er,v.invert=An,v.invoke=ar,v.keys=gt,v.map=ir,v.mapValues=Un,v.max=lr,v.memoize=Qr,v.merge=Mn,v.min=cr,v.omit=Vn,v.once=Xr,v.pairs=Gn,v.partial=Yr,v.partialRight=Zr,v.pick=Jn,v.pluck=At,v.property=ce,v.pull=Ar,v.range=Ir,v.reject=pr,v.remove=Lr,v.rest=Nr,v.shuffle=hr,v.sortBy=br,v.tap=be,v.throttle=ne,v.times=ge,v.toArray=dr,v.transform=Qn,v.union=Tr,v.uniq=Dr,v.values=Xn,v.where=It,v.without=$r,v.wrap=re,v.xor=Fr,v.zip=Br,v.zipObject=Hr,
|
||||||
|
v.collect=ir,v.drop=Nr,v.each=or,v.eachRight=ur,v.extend=xt,v.methods=On,v.object=Hr,v.select=rr,v.tail=Nr,v.unique=Dr,v.unzip=Br,ae(v),v.clone=wn,v.cloneDeep=xn,v.contains=Zn,v.escape=oe,v.every=nr,v.find=er,v.findIndex=wr,v.findKey=kn,v.findLast=tr,v.findLastIndex=xr,v.findLastKey=Cn,v.has=Sn,v.identity=ue,v.indexOf=Cr,v.isArguments=_n,v.isArray=st,v.isBoolean=In,v.isDate=Ln,v.isElement=Nn,v.isEmpty=Rn,v.isEqual=Tn,v.isFinite=Dn,v.isFunction=$n,v.isNaN=Bn,v.isNull=Hn,v.isNumber=Wn,v.isObject=Fn,
|
||||||
|
v.isPlainObject=Pt,v.isRegExp=qn,v.isString=zn,v.isUndefined=Kn,v.lastIndexOf=Sr,v.mixin=ae,v.noConflict=ie,v.noop=le,v.now=Lt,v.parseInt=Nt,v.random=fe,v.reduce=fr,v.reduceRight=sr,v.result=se,v.runInContext=g,v.size=vr,v.some=yr,v.sortedIndex=Rr,v.template=pe,v.unescape=he,v.uniqueId=ve,v.all=nr,v.any=yr,v.detect=er,v.findWhere=er,v.foldl=fr,v.foldr=sr,v.include=Zn,v.inject=fr,ae(function(){var n={};return Ct(v,function(r,e){v.prototype[e]||(n[e]=r)}),n}(),!1),v.first=jr,v.last=Or,v.sample=gr,v.take=jr,
|
||||||
|
v.head=jr,Ct(v,function(n,r){var e="sample"!==r;v.prototype[r]||(v.prototype[r]=function(r,t){var o=this.__chain__,u=n(this.__wrapped__,r,t);return o||null!=r&&(!t||e&&"function"==typeof r)?new y(u,o):u})}),v.VERSION="2.4.2",v.prototype.chain=de,v.prototype.toString=me,v.prototype.value=_e,v.prototype.valueOf=_e,wt(["join","pop","shift"],function(n){var r=Le[n];v.prototype[n]=function(){var n=this.__chain__,e=r.apply(this.__wrapped__,arguments);return n?new y(e,n):e}}),wt(["push","reverse","sort","unshift"],function(n){
|
||||||
|
var r=Le[n];v.prototype[n]=function(){return r.apply(this.__wrapped__,arguments),this}}),wt(["concat","slice","splice"],function(n){var r=Le[n];v.prototype[n]=function(){return new y(r.apply(this.__wrapped__,arguments),this.__chain__)}}),lt.spliceObjects||wt(["pop","shift","splice"],function(n){var r=Le[n],e="splice"==n;v.prototype[n]=function(){var n=this.__chain__,t=this.__wrapped__,o=r.apply(t,arguments);return 0===t.length&&delete t[0],n||e?new y(o,n):o}}),v}var h,v=[],y=[],b=0,d={},m=+new Date+"",_=75,w=40,x=" \f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=/\b__p \+= '';/g,C=/\b(__p \+=) '' \+/g,P=/(__e\(.*?\)|\b__t\)) \+\n'';/g,E=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,S=/^\s*function[ \n\r\t]+\w/,A=/<%=([\s\S]+?)%>/g,I=RegExp("^["+x+"]*0+(?=.$)"),L=/($^)/,N=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,T=["Array","Boolean","Date","Error","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"],D=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$=0,F="[object Arguments]",B="[object Array]",H="[object Boolean]",W="[object Date]",q="[object Error]",z="[object Function]",K="[object Number]",U="[object Object]",M="[object RegExp]",V="[object String]",G={};
|
||||||
|
|
||||||
|
G[z]=!1,G[F]=G[B]=G[H]=G[W]=G[K]=G[U]=G[M]=G[V]=!0;var J={leading:!1,maxWait:0,trailing:!1},Q={configurable:!1,enumerable:!1,value:null,writable:!1},X={args:"",array:null,bottom:"",firstArg:"",init:"",keys:null,loop:"",shadowedProps:null,support:null,top:"",useHas:!1},Y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Z={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},nn=Y[typeof window]&&window||this,rn=Y[typeof exports]&&exports&&!exports.nodeType&&exports,en=Y[typeof module]&&module&&!module.nodeType&&module,tn=en&&en.exports===rn&&rn,on=Y[typeof global]&&global;
|
||||||
|
|
||||||
|
!on||on.global!==on&&on.window!==on||(nn=on);var un=g();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(nn._=un,define(function(){return un})):rn&&en?tn?(en.exports=un)._=un:rn._=un:nn._=un}).call(this);
|
||||||
6786
dist/lodash.js
vendored
Normal file
6786
dist/lodash.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
87
dist/lodash.min.js
vendored
Normal file
87
dist/lodash.min.js
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Lo-Dash 2.4.2 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||||
|
* Build: `lodash modern -o ./dist/lodash.js`
|
||||||
|
*/
|
||||||
|
;(function(){function n(n,r,t){for(var e=(t||0)-1,u=n?n.length:0;++e<u;)if(n[e]===r)return e;return-1}function r(r,t){var e=typeof t;if(r=r.cache,"boolean"==e||null==t)return r[t]?0:-1;"number"!=e&&"string"!=e&&(e="object");var u="number"==e?t:m+t;return r=(r=r[e])&&r[u],"object"==e?r&&n(r,t)>-1?0:-1:r?0:-1}function t(n){var r=this.cache,t=typeof n;if("boolean"==t||null==n)r[n]=!0;else{"number"!=t&&"string"!=t&&(t="object");var e="number"==t?n:m+n,u=r[t]||(r[t]={});"object"==t?(u[e]||(u[e]=[])).push(n):u[e]=!0;
|
||||||
|
|
||||||
|
}}function e(n){return n.charCodeAt(0)}function u(n,r){for(var t=n.criteria,e=r.criteria,u=-1,o=t.length;++u<o;){var a=t[u],i=e[u];if(a!==i){if(a>i||"undefined"==typeof a)return 1;if(a<i||"undefined"==typeof i)return-1}}return n.index-r.index}function o(n){var r=-1,e=n.length,u=n[0],o=n[e/2|0],a=n[e-1];if(u&&"object"==typeof u&&o&&"object"==typeof o&&a&&"object"==typeof a)return!1;var i=f();i["false"]=i["null"]=i["true"]=i.undefined=!1;var l=f();for(l.array=n,l.cache=i,l.push=t;++r<e;)l.push(n[r]);
|
||||||
|
|
||||||
|
return l}function a(n){return"\\"+G[n]}function i(){return h.pop()||[]}function f(){return g.pop()||{array:null,cache:null,criteria:null,"false":!1,index:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,value:null}}function l(n){n.length=0,h.length<_&&h.push(n)}function c(n){var r=n.cache;r&&c(r),n.array=n.cache=n.criteria=n.object=n.number=n.string=n.value=null,g.length<_&&g.push(n)}function p(n,r,t){r||(r=0),"undefined"==typeof t&&(t=n?n.length:0);for(var e=-1,u=t-r||0,o=Array(u<0?0:u);++e<u;)o[e]=n[r+e];
|
||||||
|
|
||||||
|
return o}function s(t){function h(n){return n&&"object"==typeof n&&!Yt(n)&&Tt.call(n,"__wrapped__")?n:new g(n)}function g(n,r){this.__chain__=!!r,this.__wrapped__=n}function _(n){function r(){if(e){var n=p(e);$t.apply(n,arguments)}if(this instanceof r){var o=J(t.prototype),a=t.apply(o,n||arguments);return Sn(a)?a:o}return t.apply(u,n||arguments)}var t=n[0],e=n[2],u=n[4];return Xt(r,n),r}function G(n,r,t,e,u){if(t){var o=t(n);if("undefined"!=typeof o)return o}var a=Sn(n);if(!a)return n;var f=Nt.call(n);
|
||||||
|
|
||||||
|
if(!K[f])return n;var c=Jt[f];switch(f){case F:case B:return new c(+n);case q:case P:return new c(n);case L:return o=c(n.source,C.exec(n)),o.lastIndex=n.lastIndex,o}var s=Yt(n);if(r){var v=!e;e||(e=i()),u||(u=i());for(var h=e.length;h--;)if(e[h]==n)return u[h];o=s?c(n.length):{}}else o=s?p(n):oe({},n);return s&&(Tt.call(n,"index")&&(o.index=n.index),Tt.call(n,"input")&&(o.input=n.input)),r?(e.push(n),u.push(o),(s?Xn:fe)(n,function(n,a){o[a]=G(n,r,t,e,u)}),v&&(l(e),l(u)),o):o}function J(n,r){return Sn(n)?zt(n):{};
|
||||||
|
|
||||||
|
}function Q(n,r,t){if("function"!=typeof n)return Yr;if("undefined"==typeof r||!("prototype"in n))return n;var e=n.__bindData__;if("undefined"==typeof e&&(Qt.funcNames&&(e=!n.name),e=e||!Qt.funcDecomp,!e)){var u=At.call(n);Qt.funcNames||(e=!O.test(u)),e||(e=I.test(u),Xt(n,e))}if(e===!1||e!==!0&&1&e[1])return n;switch(t){case 1:return function(t){return n.call(r,t)};case 2:return function(t,e){return n.call(r,t,e)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){
|
||||||
|
return n.call(r,t,e,u,o)}}return $r(n,r)}function X(n){function r(){var n=f?a:this;if(u){var h=p(u);$t.apply(h,arguments)}if((o||c)&&(h||(h=p(arguments)),o&&$t.apply(h,o),c&&h.length<i))return e|=16,X([t,s?e:-4&e,h,null,a,i]);if(h||(h=arguments),l&&(t=n[v]),this instanceof r){n=J(t.prototype);var g=t.apply(n,h);return Sn(g)?g:n}return t.apply(n,h)}var t=n[0],e=n[1],u=n[2],o=n[3],a=n[4],i=n[5],f=1&e,l=2&e,c=4&e,s=8&e,v=t;return Xt(r,n),r}function Y(t,e){var u=-1,a=ln(),i=t?t.length:0,f=i>=b&&a===n,l=[];
|
||||||
|
|
||||||
|
if(f){var p=o(e);p?(a=r,e=p):f=!1}for(;++u<i;){var s=t[u];a(e,s)<0&&l.push(s)}return f&&c(e),l}function nn(n,r,t,e){for(var u=(e||0)-1,o=n?n.length:0,a=[];++u<o;){var i=n[u];if(i&&"object"==typeof i&&"number"==typeof i.length&&(Yt(i)||vn(i))){r||(i=nn(i,r,t));var f=-1,l=i.length,c=a.length;for(a.length+=l;++f<l;)a[c++]=i[f]}else t||a.push(i)}return a}function rn(n,r,t,e,u,o){if(t){var a=t(n,r);if("undefined"!=typeof a)return!!a}if(n===r)return 0!==n||1/n==1/r;var f=typeof n,c=typeof r;if(n===n&&(!n||!V[f])&&(!r||!V[c]))return!1;
|
||||||
|
|
||||||
|
if(null==n||null==r)return n===r;var p=Nt.call(n),s=Nt.call(r);if(p==T&&(p=z),s==T&&(s=z),p!=s)return!1;switch(p){case F:case B:return+n==+r;case q:return n!=+n?r!=+r:0==n?1/n==1/r:n==+r;case L:case P:return n==jt(r)}var h=p==$;if(!h){var g=Tt.call(n,"__wrapped__"),y=Tt.call(r,"__wrapped__");if(g||y)return rn(g?n.__wrapped__:n,y?r.__wrapped__:r,t,e,u,o);if(p!=z)return!1;var m=n.constructor,b=r.constructor;if(m!=b&&!(In(m)&&m instanceof m&&In(b)&&b instanceof b)&&"constructor"in n&&"constructor"in r)return!1;
|
||||||
|
|
||||||
|
}var _=!u;u||(u=i()),o||(o=i());for(var d=u.length;d--;)if(u[d]==n)return o[d]==r;var w=0;if(a=!0,u.push(n),o.push(r),h){if(d=n.length,w=r.length,a=w==d,a||e)for(;w--;){var j=d,k=r[w];if(e)for(;j--&&!(a=rn(n[j],k,t,e,u,o)););else if(!(a=rn(n[w],k,t,e,u,o)))break}}else ie(r,function(r,i,f){return Tt.call(f,i)?(w++,a=Tt.call(n,i)&&rn(n[i],r,t,e,u,o)):v}),a&&!e&&ie(n,function(n,r,t){return Tt.call(t,r)?a=--w>-1:v});return u.pop(),o.pop(),_&&(l(u),l(o)),a}function tn(n,r,t,e,u){(Yt(r)?Xn:fe)(r,function(r,o){
|
||||||
|
var a,i,f=r,l=n[o];if(r&&((i=Yt(r))||le(r))){for(var c=e.length;c--;)if(a=e[c]==r){l=u[c];break}if(!a){var p;t&&(f=t(l,r),(p="undefined"!=typeof f)&&(l=f)),p||(l=i?Yt(l)?l:[]:le(l)?l:{}),e.push(r),u.push(l),p||tn(l,r,t,e,u)}}else t&&(f=t(l,r),"undefined"==typeof f&&(f=r)),"undefined"!=typeof f&&(l=f);n[o]=l})}function en(n,r){return n+St(Ht()*(r-n+1))}function un(t,e,u){var a=-1,f=ln(),p=t?t.length:0,s=[],v=!e&&p>=b&&f===n,h=u||v?i():s;if(v){var g=o(h);f=r,h=g}for(;++a<p;){var y=t[a],m=u?u(y,a,t):y;
|
||||||
|
|
||||||
|
(e?!a||h[h.length-1]!==m:f(h,m)<0)&&((u||v)&&h.push(m),s.push(y))}return v?(l(h.array),c(h)):u&&l(h),s}function on(n){return function(r,t,e){var u={};t=h.createCallback(t,e,3);var o=-1,a=r?r.length:0;if("number"==typeof a)for(;++o<a;){var i=r[o];n(u,i,t(i,o,r),r)}else fe(r,function(r,e,o){n(u,r,t(r,e,o),o)});return u}}function an(n,r,t,e,u,o){var a=1&r,i=2&r,f=4&r,l=16&r,c=32&r;if(!i&&!In(n))throw new kt;l&&!t.length&&(r&=-17,l=t=!1),c&&!e.length&&(r&=-33,c=e=!1);var s=n&&n.__bindData__;if(s&&s!==!0)return s=p(s),
|
||||||
|
s[2]&&(s[2]=p(s[2])),s[3]&&(s[3]=p(s[3])),!a||1&s[1]||(s[4]=u),!a&&1&s[1]&&(r|=8),!f||4&s[1]||(s[5]=o),l&&$t.apply(s[2]||(s[2]=[]),t),c&&Wt.apply(s[3]||(s[3]=[]),e),s[1]|=r,an.apply(null,s);var v=1==r||17===r?_:X;return v([n,r,t,e,u,o])}function fn(n){return re[n]}function ln(){var r=(r=h.indexOf)===br?n:r;return r}function cn(n){return"function"==typeof n&&Rt.test(n)}function pn(n){var r,t;return n&&Nt.call(n)==z&&(r=n.constructor,!In(r)||r instanceof r)?(ie(n,function(n,r){t=r}),"undefined"==typeof t||Tt.call(n,t)):!1;
|
||||||
|
|
||||||
|
}function sn(n){return te[n]}function vn(n){return n&&"object"==typeof n&&"number"==typeof n.length&&Nt.call(n)==T||!1}function hn(n,r,t,e){return"boolean"!=typeof r&&null!=r&&(e=t,t=r,r=!1),G(n,r,"function"==typeof t&&Q(t,e,1))}function gn(n,r,t){return G(n,!0,"function"==typeof r&&Q(r,t,1))}function yn(n,r){var t=J(n);return r?oe(t,r):t}function mn(n,r,t){var e;return r=h.createCallback(r,t,3),fe(n,function(n,t,u){return r(n,t,u)?(e=t,!1):v}),e}function bn(n,r,t){var e;return r=h.createCallback(r,t,3),
|
||||||
|
dn(n,function(n,t,u){return r(n,t,u)?(e=t,!1):v}),e}function _n(n,r,t){var e=[];ie(n,function(n,r){e.push(r,n)});var u=e.length;for(r=Q(r,t,3);u--&&r(e[u--],e[u],n)!==!1;);return n}function dn(n,r,t){var e=ne(n),u=e.length;for(r=Q(r,t,3);u--;){var o=e[u];if(r(n[o],o,n)===!1)break}return n}function wn(n){var r=[];return ie(n,function(n,t){In(n)&&r.push(t)}),r.sort()}function jn(n,r){return n?Tt.call(n,r):!1}function kn(n){for(var r=-1,t=ne(n),e=t.length,u={};++r<e;){var o=t[r];u[n[o]]=o}return u}function xn(n){
|
||||||
|
return n===!0||n===!1||n&&"object"==typeof n&&Nt.call(n)==F||!1}function Cn(n){return n&&"object"==typeof n&&Nt.call(n)==B||!1}function On(n){return n&&1===n.nodeType||!1}function Nn(n){var r=!0;if(!n)return r;var t=Nt.call(n),e=n.length;return t==$||t==P||t==T||t==z&&"number"==typeof e&&In(n.splice)?!e:(fe(n,function(){return r=!1}),r)}function Rn(n,r,t,e){return rn(n,r,"function"==typeof t&&Q(t,e,2))}function En(n){return Pt(n)&&!Kt(parseFloat(n))}function In(n){return"function"==typeof n}function Sn(n){
|
||||||
|
return!(!n||!V[typeof n])}function An(n){return Tn(n)&&n!=+n}function Dn(n){return null===n}function Tn(n){return"number"==typeof n||n&&"object"==typeof n&&Nt.call(n)==q||!1}function $n(n){return n&&"object"==typeof n&&Nt.call(n)==L||!1}function Fn(n){return"string"==typeof n||n&&"object"==typeof n&&Nt.call(n)==P||!1}function Bn(n){return"undefined"==typeof n}function Wn(n,r,t){var e={};return r=h.createCallback(r,t,3),fe(n,function(n,t,u){e[t]=r(n,t,u)}),e}function qn(n){var r=arguments,t=2;if(!Sn(n))return n;
|
||||||
|
|
||||||
|
if("number"!=typeof r[2]&&(t=r.length),t>3&&"function"==typeof r[t-2])var e=Q(r[--t-1],r[t--],2);else t>2&&"function"==typeof r[t-1]&&(e=r[--t]);for(var u=p(arguments,1,t),o=-1,a=i(),f=i();++o<t;)tn(n,u[o],e,a,f);return l(a),l(f),n}function zn(n,r,t){var e={};if("function"!=typeof r){var u=[];ie(n,function(n,r){u.push(r)}),u=Y(u,nn(arguments,!0,!1,1));for(var o=-1,a=u.length;++o<a;){var i=u[o];e[i]=n[i]}}else r=h.createCallback(r,t,3),ie(n,function(n,t,u){r(n,t,u)||(e[t]=n)});return e}function Ln(n){
|
||||||
|
for(var r=-1,t=ne(n),e=t.length,u=ht(e);++r<e;){var o=t[r];u[r]=[o,n[o]]}return u}function Pn(n,r,t){var e={};if("function"!=typeof r)for(var u=-1,o=nn(arguments,!0,!1,1),a=Sn(n)?o.length:0;++u<a;){var i=o[u];i in n&&(e[i]=n[i])}else r=h.createCallback(r,t,3),ie(n,function(n,t,u){r(n,t,u)&&(e[t]=n)});return e}function Kn(n,r,t,e){var u=Yt(n);if(null==t)if(u)t=[];else{var o=n&&n.constructor,a=o&&o.prototype;t=J(a)}return r&&(r=h.createCallback(r,e,4),(u?Xn:fe)(n,function(n,e,u){return r(t,n,e,u)})),
|
||||||
|
t}function Un(n){for(var r=-1,t=ne(n),e=t.length,u=ht(e);++r<e;)u[r]=n[t[r]];return u}function Mn(n){for(var r=arguments,t=-1,e=nn(r,!0,!1,1),u=r[2]&&r[2][r[1]]===n?1:e.length,o=ht(u);++t<u;)o[t]=n[e[t]];return o}function Vn(n,r,t){var e=-1,u=ln(),o=n?n.length:0,a=!1;return t=(t<0?Mt(0,o+t):t)||0,Yt(n)?a=u(n,r,t)>-1:"number"==typeof o?a=(Fn(n)?n.indexOf(r,t):u(n,r,t))>-1:fe(n,function(n){return++e<t?v:!(a=n===r)}),a}function Gn(n,r,t){var e=!0;r=h.createCallback(r,t,3);var u=-1,o=n?n.length:0;if("number"==typeof o)for(;++u<o&&(e=!!r(n[u],u,n)););else fe(n,function(n,t,u){
|
||||||
|
return e=!!r(n,t,u)});return e}function Hn(n,r,t){var e=[];r=h.createCallback(r,t,3);var u=-1,o=n?n.length:0;if("number"==typeof o)for(;++u<o;){var a=n[u];r(a,u,n)&&e.push(a)}else fe(n,function(n,t,u){r(n,t,u)&&e.push(n)});return e}function Jn(n,r,t){r=h.createCallback(r,t,3);var e=-1,u=n?n.length:0;if("number"!=typeof u){var o;return fe(n,function(n,t,e){return r(n,t,e)?(o=n,!1):v}),o}for(;++e<u;){var a=n[e];if(r(a,e,n))return a}}function Qn(n,r,t){var e;return r=h.createCallback(r,t,3),Yn(n,function(n,t,u){
|
||||||
|
return r(n,t,u)?(e=n,!1):v}),e}function Xn(n,r,t){var e=-1,u=n?n.length:0;if(r=r&&"undefined"==typeof t?r:Q(r,t,3),"number"==typeof u)for(;++e<u&&r(n[e],e,n)!==!1;);else fe(n,r);return n}function Yn(n,r,t){var e=n?n.length:0;if(r=r&&"undefined"==typeof t?r:Q(r,t,3),"number"==typeof e)for(;e--&&r(n[e],e,n)!==!1;);else{var u=ne(n);e=u.length,fe(n,function(n,t,o){return t=u?u[--e]:--e,r(o[t],t,o)})}return n}function Zn(n,r){var t=p(arguments,2),e=-1,u="function"==typeof r,o=n?n.length:0,a=ht("number"==typeof o?o:0);
|
||||||
|
|
||||||
|
return Xn(n,function(n){a[++e]=(u?r:n[r]).apply(n,t)}),a}function nr(n,r,t){var e=-1,u=n?n.length:0;if(r=h.createCallback(r,t,3),"number"==typeof u)for(var o=ht(u);++e<u;)o[e]=r(n[e],e,n);else o=[],fe(n,function(n,t,u){o[++e]=r(n,t,u)});return o}function rr(n,r,t){var u=-(1/0),o=u;if("function"!=typeof r&&t&&t[r]===n&&(r=null),null==r&&Yt(n))for(var a=-1,i=n.length;++a<i;){var f=n[a];f>o&&(o=f)}else r=null==r&&Fn(n)?e:h.createCallback(r,t,3),Xn(n,function(n,t,e){var a=r(n,t,e);a>u&&(u=a,o=n)});return o;
|
||||||
|
|
||||||
|
}function tr(n,r,t){var u=1/0,o=u;if("function"!=typeof r&&t&&t[r]===n&&(r=null),null==r&&Yt(n))for(var a=-1,i=n.length;++a<i;){var f=n[a];f<o&&(o=f)}else r=null==r&&Fn(n)?e:h.createCallback(r,t,3),Xn(n,function(n,t,e){var a=r(n,t,e);a<u&&(u=a,o=n)});return o}function er(n,r,t,e){if(!n)return t;var u=arguments.length<3;r=h.createCallback(r,e,4);var o=-1,a=n.length;if("number"==typeof a)for(u&&(t=n[++o]);++o<a;)t=r(t,n[o],o,n);else fe(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)});return t}function ur(n,r,t,e){
|
||||||
|
var u=arguments.length<3;return r=h.createCallback(r,e,4),Yn(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function or(n,r,t){return r=h.createCallback(r,t,3),Hn(n,function(n,t,e){return!r(n,t,e)})}function ar(n,r,t){if(n&&"number"!=typeof n.length&&(n=Un(n)),null==r||t)return n?n[en(0,n.length-1)]:v;var e=ir(n);return e.length=Vt(Mt(0,r),e.length),e}function ir(n){var r=-1,t=n?n.length:0,e=ht("number"==typeof t?t:0);return Xn(n,function(n){var t=en(0,++r);e[r]=e[t],e[t]=n}),e}function fr(n){var r=n?n.length:0;
|
||||||
|
|
||||||
|
return"number"==typeof r?r:ne(n).length}function lr(n,r,t){var e;r=h.createCallback(r,t,3);var u=-1,o=n?n.length:0;if("number"==typeof o)for(;++u<o&&!(e=r(n[u],u,n)););else fe(n,function(n,t,u){return!(e=r(n,t,u))});return!!e}function cr(n,r,t){var e=-1,o=Yt(r),a=n?n.length:0,p=ht("number"==typeof a?a:0);for(o||(r=h.createCallback(r,t,3)),Xn(n,function(n,t,u){var a=p[++e]=f();o?a.criteria=nr(r,function(r){return n[r]}):(a.criteria=i())[0]=r(n,t,u),a.index=e,a.value=n}),a=p.length,p.sort(u);a--;){
|
||||||
|
var s=p[a];p[a]=s.value,o||l(s.criteria),c(s)}return p}function pr(n){return n&&"number"==typeof n.length?p(n):Un(n)}function sr(n){for(var r=-1,t=n?n.length:0,e=[];++r<t;){var u=n[r];u&&e.push(u)}return e}function vr(n){return Y(n,nn(arguments,!0,!0,1))}function hr(n,r,t){var e=-1,u=n?n.length:0;for(r=h.createCallback(r,t,3);++e<u;)if(r(n[e],e,n))return e;return-1}function gr(n,r,t){var e=n?n.length:0;for(r=h.createCallback(r,t,3);e--;)if(r(n[e],e,n))return e;return-1}function yr(n,r,t){var e=0,u=n?n.length:0;
|
||||||
|
|
||||||
|
if("number"!=typeof r&&null!=r){var o=-1;for(r=h.createCallback(r,t,3);++o<u&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[0]:v;return p(n,0,Vt(Mt(0,e),u))}function mr(n,r,t,e){return"boolean"!=typeof r&&null!=r&&(e=t,t="function"!=typeof r&&e&&e[r]===n?null:r,r=!1),null!=t&&(n=nr(n,t,e)),nn(n,r)}function br(r,t,e){if("number"==typeof e){var u=r?r.length:0;e=e<0?Mt(0,u+e):e||0}else if(e){var o=Nr(r,t);return r[o]===t?o:-1}return n(r,t,e)}function _r(n,r,t){var e=0,u=n?n.length:0;if("number"!=typeof r&&null!=r){
|
||||||
|
var o=u;for(r=h.createCallback(r,t,3);o--&&r(n[o],o,n);)e++}else e=null==r||t?1:r||e;return p(n,0,Vt(Mt(0,u-e),u))}function dr(){for(var t=[],e=-1,u=arguments.length,a=i(),f=ln(),p=f===n,s=i();++e<u;){var v=arguments[e];(Yt(v)||vn(v))&&(t.push(v),a.push(p&&v.length>=b&&o(e?t[e]:s)))}var h=t[0],g=-1,y=h?h.length:0,m=[];n:for(;++g<y;){var _=a[0];if(v=h[g],(_?r(_,v):f(s,v))<0){for(e=u,(_||s).push(v);--e;)if(_=a[e],(_?r(_,v):f(t[e],v))<0)continue n;m.push(v)}}for(;u--;)_=a[u],_&&c(_);return l(a),l(s),
|
||||||
|
m}function wr(n,r,t){var e=0,u=n?n.length:0;if("number"!=typeof r&&null!=r){var o=u;for(r=h.createCallback(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:v;return p(n,Mt(0,u-e))}function jr(n,r,t){var e=n?n.length:0;for("number"==typeof t&&(e=(t<0?Mt(0,e+t):Vt(t,e-1))+1);e--;)if(n[e]===r)return e;return-1}function kr(n){for(var r=arguments,t=0,e=r.length,u=n?n.length:0;++t<e;)for(var o=-1,a=r[t];++o<u;)n[o]===a&&(Bt.call(n,o--,1),u--);return n}function xr(n,r,t){n=+n||0,t="number"==typeof t?t:+t||1,
|
||||||
|
null==r&&(r=n,n=0);for(var e=-1,u=Mt(0,Et((r-n)/(t||1))),o=ht(u);++e<u;)o[e]=n,n+=t;return o}function Cr(n,r,t){var e=-1,u=n?n.length:0,o=[];for(r=h.createCallback(r,t,3);++e<u;){var a=n[e];r(a,e,n)&&(o.push(a),Bt.call(n,e--,1),u--)}return o}function Or(n,r,t){if("number"!=typeof r&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=h.createCallback(r,t,3);++u<o&&r(n[u],u,n);)e++}else e=null==r||t?1:Mt(0,r);return p(n,e)}function Nr(n,r,t,e){var u=0,o=n?n.length:u;for(t=t?h.createCallback(t,e,1):Yr,r=t(r);u<o;){
|
||||||
|
var a=u+o>>>1;t(n[a])<r?u=a+1:o=a}return u}function Rr(){return un(nn(arguments,!0,!0))}function Er(n,r,t,e){return"boolean"!=typeof r&&null!=r&&(e=t,t="function"!=typeof r&&e&&e[r]===n?null:r,r=!1),null!=t&&(t=h.createCallback(t,e,3)),un(n,r,t)}function Ir(n){return Y(n,p(arguments,1))}function Sr(){for(var n=-1,r=arguments.length;++n<r;){var t=arguments[n];if(Yt(t)||vn(t))var e=e?un(Y(e,t).concat(Y(t,e))):t}return e||[]}function Ar(){for(var n=arguments.length>1?arguments:arguments[0],r=-1,t=n?rr(ve(n,"length")):0,e=ht(t<0?0:t);++r<t;)e[r]=ve(n,r);
|
||||||
|
|
||||||
|
return e}function Dr(n,r){var t=-1,e=n?n.length:0,u={};for(r||!e||Yt(n[0])||(r=[]);++t<e;){var o=n[t];r?u[o]=r[t]:o&&(u[o[0]]=o[1])}return u}function Tr(n,r){if(!In(r))throw new kt;return function(){return--n<1?r.apply(this,arguments):v}}function $r(n,r){return arguments.length>2?an(n,17,p(arguments,2),null,r):an(n,1,null,null,r)}function Fr(n){for(var r=arguments.length>1?nn(arguments,!0,!1,1):wn(n),t=-1,e=r.length;++t<e;){var u=r[t];n[u]=an(n[u],1,null,null,n)}return n}function Br(n,r){return arguments.length>2?an(r,19,p(arguments,2),null,n):an(r,3,null,null,n);
|
||||||
|
|
||||||
|
}function Wr(){for(var n=arguments,r=n.length;r--;)if(!In(n[r]))throw new kt;return function(){for(var r=arguments,t=n.length;t--;)r=[n[t].apply(this,r)];return r[0]}}function qr(n,r){return r="number"==typeof r?r:+r||n.length,an(n,4,null,null,null,r)}function zr(n,r,t){var e,u,o,a,i,f,l,c=0,p=!1,s=!0;if(!In(n))throw new kt;if(r=Mt(0,r)||0,t===!0){var h=!0;s=!1}else Sn(t)&&(h=t.leading,p="maxWait"in t&&(Mt(r,t.maxWait)||0),s="trailing"in t?t.trailing:s);var g=function(){var t=r-(ge()-a);if(t>0)f=Ft(g,t);
|
||||||
|
else{u&&It(u);var p=l;u=f=l=v,p&&(c=ge(),o=n.apply(i,e),f||u||(e=i=null))}},y=function(){f&&It(f),u=f=l=v,(s||p!==r)&&(c=ge(),o=n.apply(i,e),f||u||(e=i=null))};return function(){if(e=arguments,a=ge(),i=this,l=s&&(f||!h),p===!1)var t=h&&!f;else{u||h||(c=a);var v=p-(a-c),m=v<=0;m?(u&&(u=It(u)),c=a,o=n.apply(i,e)):u||(u=Ft(y,v))}return m&&f?f=It(f):f||r===p||(f=Ft(g,r)),t&&(m=!0,o=n.apply(i,e)),!m||f||u||(e=i=null),o}}function Lr(n){if(!In(n))throw new kt;var r=p(arguments,1);return Ft(function(){n.apply(v,r);
|
||||||
|
|
||||||
|
},1)}function Pr(n,r){if(!In(n))throw new kt;var t=p(arguments,2);return Ft(function(){n.apply(v,t)},r)}function Kr(n,r){if(!In(n))throw new kt;var t=function(){var e=t.cache,u=r?r.apply(this,arguments):m+arguments[0];return Tt.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return t.cache={},t}function Ur(n){var r,t;if(!In(n))throw new kt;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}}function Mr(n){return an(n,16,p(arguments,1))}function Vr(n){return an(n,32,null,p(arguments,1));
|
||||||
|
|
||||||
|
}function Gr(n,r,t){var e=!0,u=!0;if(!In(n))throw new kt;return t===!1?e=!1:Sn(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),U.leading=e,U.maxWait=r,U.trailing=u,zr(n,r,U)}function Hr(n,r){return an(r,16,[n])}function Jr(n){return function(){return n}}function Qr(n,r,t){var e=typeof n;if(null==n||"function"==e)return Q(n,r,t);if("object"!=e)return tt(n);var u=ne(n),o=u[0],a=n[o];return 1!=u.length||a!==a||Sn(a)?function(r){for(var t=u.length,e=!1;t--&&(e=rn(r[u[t]],n[u[t]],null,!0)););
|
||||||
|
return e}:function(n){var r=n[o];return a===r&&(0!==a||1/a==1/r)}}function Xr(n){return null==n?"":jt(n).replace(ue,fn)}function Yr(n){return n}function Zr(n,r,t){var e=!0,u=r&&wn(r);r&&(t||u.length)||(null==t&&(t=r),o=g,r=n,n=h,u=wn(r)),t===!1?e=!1:Sn(t)&&"chain"in t&&(e=t.chain);var o=n,a=In(o);Xn(u,function(t){var u=n[t]=r[t];a&&(o.prototype[t]=function(){var r=this.__chain__,t=this.__wrapped__,a=[t];$t.apply(a,arguments);var i=u.apply(n,a);if(e||r){if(t===i&&Sn(i))return this;i=new o(i),i.__chain__=r;
|
||||||
|
|
||||||
|
}return i})})}function nt(){return t._=Ot,this}function rt(){}function tt(n){return function(r){return r[n]}}function et(n,r,t){var e=null==n,u=null==r;if(null==t&&("boolean"==typeof n&&u?(t=n,n=1):u||"boolean"!=typeof r||(t=r,u=!0)),e&&u&&(r=1),n=+n||0,u?(r=n,n=0):r=+r||0,t||n%1||r%1){var o=Ht();return Vt(n+o*(r-n+parseFloat("1e-"+((o+"").length-1))),r)}return en(n,r)}function ut(n,r){if(n){var t=n[r];return In(t)?n[r]():t}}function ot(n,r,t){var e=h.templateSettings;n=jt(n||""),t=ae({},t,e);var u,o=ae({},t.imports,e.imports),i=ne(o),f=Un(o),l=0,c=t.interpolate||E,p="__p += '",s=wt((t.escape||E).source+"|"+c.source+"|"+(c===N?x:E).source+"|"+(t.evaluate||E).source+"|$","g");
|
||||||
|
|
||||||
|
n.replace(s,function(r,t,e,o,i,f){return e||(e=o),p+=n.slice(l,f).replace(S,a),t&&(p+="' +\n__e("+t+") +\n'"),i&&(u=!0,p+="';\n"+i+";\n__p += '"),e&&(p+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),l=f+r.length,r}),p+="';\n";var g=t.variable,y=g;y||(g="obj",p="with ("+g+") {\n"+p+"\n}\n"),p=(u?p.replace(w,""):p).replace(j,"$1").replace(k,"$1;"),p="function("+g+") {\n"+(y?"":g+" || ("+g+" = {});\n")+"var __t, __p = '', __e = _.escape"+(u?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";
|
||||||
|
|
||||||
|
var m="\n/*\n//# sourceURL="+(t.sourceURL||"/lodash/template/source["+D++ +"]")+"\n*/";try{var b=mt(i,"return "+p+m).apply(v,f)}catch(_){throw _.source=p,_}return r?b(r):(b.source=p,b)}function at(n,r,t){n=(n=+n)>-1?n:0;var e=-1,u=ht(n);for(r=Q(r,t,1);++e<n;)u[e]=r(e);return u}function it(n){return null==n?"":jt(n).replace(ee,sn)}function ft(n){var r=++y;return jt(null==n?"":n)+r}function lt(n){return n=new g(n),n.__chain__=!0,n}function ct(n,r){return r(n),n}function pt(){return this.__chain__=!0,
|
||||||
|
this}function st(){return jt(this.__wrapped__)}function vt(){return this.__wrapped__}t=t?Z.defaults(H.Object(),t,Z.pick(H,A)):H;var ht=t.Array,gt=t.Boolean,yt=t.Date,mt=t.Function,bt=t.Math,_t=t.Number,dt=t.Object,wt=t.RegExp,jt=t.String,kt=t.TypeError,xt=[],Ct=dt.prototype,Ot=t._,Nt=Ct.toString,Rt=wt("^"+jt(Nt).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Et=bt.ceil,It=t.clearTimeout,St=bt.floor,At=mt.prototype.toString,Dt=cn(Dt=dt.getPrototypeOf)&&Dt,Tt=Ct.hasOwnProperty,$t=xt.push,Ft=t.setTimeout,Bt=xt.splice,Wt=xt.unshift,qt=function(){
|
||||||
|
try{var n={},r=cn(r=dt.defineProperty)&&r,t=r(n,n,n)&&r}catch(e){}return t}(),zt=cn(zt=dt.create)&&zt,Lt=cn(Lt=ht.isArray)&&Lt,Pt=t.isFinite,Kt=t.isNaN,Ut=cn(Ut=dt.keys)&&Ut,Mt=bt.max,Vt=bt.min,Gt=t.parseInt,Ht=bt.random,Jt={};Jt[$]=ht,Jt[F]=gt,Jt[B]=yt,Jt[W]=mt,Jt[z]=dt,Jt[q]=_t,Jt[L]=wt,Jt[P]=jt,g.prototype=h.prototype;var Qt=h.support={};Qt.funcDecomp=!cn(t.WinRTError)&&I.test(s),Qt.funcNames="string"==typeof mt.name,h.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,
|
||||||
|
variable:"",imports:{_:h}},zt||(J=function(){function n(){}return function(r){if(Sn(r)){n.prototype=r;var e=new n;n.prototype=null}return e||t.Object()}}());var Xt=qt?function(n,r){M.value=r,qt(n,"__bindData__",M),M.value=null}:rt,Yt=Lt||function(n){return n&&"object"==typeof n&&"number"==typeof n.length&&Nt.call(n)==$||!1},Zt=function(n){var r,t=n,e=[];if(!t)return e;if(!V[typeof n])return e;for(r in t)Tt.call(t,r)&&e.push(r);return e},ne=Ut?function(n){return Sn(n)?Ut(n):[]}:Zt,re={"&":"&",
|
||||||
|
"<":"<",">":">",'"':""","'":"'"},te=kn(re),ee=wt("("+ne(te).join("|")+")","g"),ue=wt("["+ne(re).join("")+"]","g"),oe=function(n,r,t){var e,u=n,o=u;if(!u)return o;var a=arguments,i=0,f="number"==typeof t?2:a.length;if(f>3&&"function"==typeof a[f-2])var l=Q(a[--f-1],a[f--],2);else f>2&&"function"==typeof a[f-1]&&(l=a[--f]);for(;++i<f;)if(u=a[i],u&&V[typeof u])for(var c=-1,p=V[typeof u]&&ne(u),s=p?p.length:0;++c<s;)e=p[c],o[e]=l?l(o[e],u[e]):u[e];return o},ae=function(n,r,t){var e,u=n,o=u;
|
||||||
|
|
||||||
|
if(!u)return o;for(var a=arguments,i=0,f="number"==typeof t?2:a.length;++i<f;)if(u=a[i],u&&V[typeof u])for(var l=-1,c=V[typeof u]&&ne(u),p=c?c.length:0;++l<p;)e=c[l],"undefined"==typeof o[e]&&(o[e]=u[e]);return o},ie=function(n,r,t){var e,u=n,o=u;if(!u)return o;if(!V[typeof u])return o;r=r&&"undefined"==typeof t?r:Q(r,t,3);for(e in u)if(r(u[e],e,n)===!1)return o;return o},fe=function(n,r,t){var e,u=n,o=u;if(!u)return o;if(!V[typeof u])return o;r=r&&"undefined"==typeof t?r:Q(r,t,3);for(var a=-1,i=V[typeof u]&&ne(u),f=i?i.length:0;++a<f;)if(e=i[a],
|
||||||
|
r(u[e],e,n)===!1)return o;return o},le=Dt?function(n){if(!n||Nt.call(n)!=z)return!1;var r=n.valueOf,t=cn(r)&&(t=Dt(r))&&Dt(t);return t?n==t||Dt(n)==t:pn(n)}:pn,ce=on(function(n,r,t){Tt.call(n,t)?n[t]++:n[t]=1}),pe=on(function(n,r,t){(Tt.call(n,t)?n[t]:n[t]=[]).push(r)}),se=on(function(n,r,t){n[t]=r}),ve=nr,he=Hn,ge=cn(ge=yt.now)&&ge||function(){return(new yt).getTime()},ye=8==Gt(d+"08")?Gt:function(n,r){return Gt(Fn(n)?n.replace(R,""):n,r||0)};return h.after=Tr,h.assign=oe,h.at=Mn,h.bind=$r,h.bindAll=Fr,
|
||||||
|
h.bindKey=Br,h.chain=lt,h.compact=sr,h.compose=Wr,h.constant=Jr,h.countBy=ce,h.create=yn,h.createCallback=Qr,h.curry=qr,h.debounce=zr,h.defaults=ae,h.defer=Lr,h.delay=Pr,h.difference=vr,h.filter=Hn,h.flatten=mr,h.forEach=Xn,h.forEachRight=Yn,h.forIn=ie,h.forInRight=_n,h.forOwn=fe,h.forOwnRight=dn,h.functions=wn,h.groupBy=pe,h.indexBy=se,h.initial=_r,h.intersection=dr,h.invert=kn,h.invoke=Zn,h.keys=ne,h.map=nr,h.mapValues=Wn,h.max=rr,h.memoize=Kr,h.merge=qn,h.min=tr,h.omit=zn,h.once=Ur,h.pairs=Ln,
|
||||||
|
h.partial=Mr,h.partialRight=Vr,h.pick=Pn,h.pluck=ve,h.property=tt,h.pull=kr,h.range=xr,h.reject=or,h.remove=Cr,h.rest=Or,h.shuffle=ir,h.sortBy=cr,h.tap=ct,h.throttle=Gr,h.times=at,h.toArray=pr,h.transform=Kn,h.union=Rr,h.uniq=Er,h.values=Un,h.where=he,h.without=Ir,h.wrap=Hr,h.xor=Sr,h.zip=Ar,h.zipObject=Dr,h.collect=nr,h.drop=Or,h.each=Xn,h.eachRight=Yn,h.extend=oe,h.methods=wn,h.object=Dr,h.select=Hn,h.tail=Or,h.unique=Er,h.unzip=Ar,Zr(h),h.clone=hn,h.cloneDeep=gn,h.contains=Vn,h.escape=Xr,h.every=Gn,
|
||||||
|
h.find=Jn,h.findIndex=hr,h.findKey=mn,h.findLast=Qn,h.findLastIndex=gr,h.findLastKey=bn,h.has=jn,h.identity=Yr,h.indexOf=br,h.isArguments=vn,h.isArray=Yt,h.isBoolean=xn,h.isDate=Cn,h.isElement=On,h.isEmpty=Nn,h.isEqual=Rn,h.isFinite=En,h.isFunction=In,h.isNaN=An,h.isNull=Dn,h.isNumber=Tn,h.isObject=Sn,h.isPlainObject=le,h.isRegExp=$n,h.isString=Fn,h.isUndefined=Bn,h.lastIndexOf=jr,h.mixin=Zr,h.noConflict=nt,h.noop=rt,h.now=ge,h.parseInt=ye,h.random=et,h.reduce=er,h.reduceRight=ur,h.result=ut,h.runInContext=s,
|
||||||
|
h.size=fr,h.some=lr,h.sortedIndex=Nr,h.template=ot,h.unescape=it,h.uniqueId=ft,h.all=Gn,h.any=lr,h.detect=Jn,h.findWhere=Jn,h.foldl=er,h.foldr=ur,h.include=Vn,h.inject=er,Zr(function(){var n={};return fe(h,function(r,t){h.prototype[t]||(n[t]=r)}),n}(),!1),h.first=yr,h.last=wr,h.sample=ar,h.take=yr,h.head=yr,fe(h,function(n,r){var t="sample"!==r;h.prototype[r]||(h.prototype[r]=function(r,e){var u=this.__chain__,o=n(this.__wrapped__,r,e);return u||null!=r&&(!e||t&&"function"==typeof r)?new g(o,u):o;
|
||||||
|
|
||||||
|
})}),h.VERSION="2.4.2",h.prototype.chain=pt,h.prototype.toString=st,h.prototype.value=vt,h.prototype.valueOf=vt,Xn(["join","pop","shift"],function(n){var r=xt[n];h.prototype[n]=function(){var n=this.__chain__,t=r.apply(this.__wrapped__,arguments);return n?new g(t,n):t}}),Xn(["push","reverse","sort","unshift"],function(n){var r=xt[n];h.prototype[n]=function(){return r.apply(this.__wrapped__,arguments),this}}),Xn(["concat","slice","splice"],function(n){var r=xt[n];h.prototype[n]=function(){return new g(r.apply(this.__wrapped__,arguments),this.__chain__);
|
||||||
|
|
||||||
|
}}),h}var v,h=[],g=[],y=0,m=+new Date+"",b=75,_=40,d=" \f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",w=/\b__p \+= '';/g,j=/\b(__p \+=) '' \+/g,k=/(__e\(.*?\)|\b__t\)) \+\n'';/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,C=/\w*$/,O=/^\s*function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,R=RegExp("^["+d+"]*0+(?=.$)"),E=/($^)/,I=/\bthis\b/,S=/['\n\r\t\u2028\u2029\\]/g,A=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"],D=0,T="[object Arguments]",$="[object Array]",F="[object Boolean]",B="[object Date]",W="[object Function]",q="[object Number]",z="[object Object]",L="[object RegExp]",P="[object String]",K={};
|
||||||
|
|
||||||
|
K[W]=!1,K[T]=K[$]=K[F]=K[B]=K[q]=K[z]=K[L]=K[P]=!0;var U={leading:!1,maxWait:0,trailing:!1},M={configurable:!1,enumerable:!1,value:null,writable:!1},V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},H=V[typeof window]&&window||this,J=V[typeof exports]&&exports&&!exports.nodeType&&exports,Q=V[typeof module]&&module&&!module.nodeType&&module,X=Q&&Q.exports===J&&J,Y=V[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(H=Y);
|
||||||
|
|
||||||
|
var Z=s();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(H._=Z,define(function(){return Z})):J&&Q?X?(Q.exports=Z)._=Z:J._=Z:H._=Z}).call(this);
|
||||||
4979
dist/lodash.underscore.js
vendored
Normal file
4979
dist/lodash.underscore.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
39
dist/lodash.underscore.min.js
vendored
Normal file
39
dist/lodash.underscore.min.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Lo-Dash 2.4.2 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||||
|
* Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
|
||||||
|
*/
|
||||||
|
;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++t<e;)if(n[t]===r)return t;return-1}function r(n,r){for(var t=n.m,e=r.m,u=-1,o=t.length;++u<o;){var i=t[u],f=e[u];if(i!==f){if(i>f||typeof i=="undefined")return 1;if(i<f||typeof f=="undefined")return-1}}return n.n-r.n}function t(n){return"\\"+yr[n]}function e(n,r,t){r||(r=0),typeof t=="undefined"&&(t=n?n.length:0);var e=-1;t=t-r||0;for(var u=Array(0>t?0:t);++e<t;)u[e]=n[r+e];return u}function u(n){return n instanceof u?n:new o(n)}function o(n,r){this.__chain__=!!r,this.__wrapped__=n
|
||||||
|
}function i(n){function r(){if(u){var n=e(u);Rr.apply(n,arguments)}if(this instanceof r){var i=f(t.prototype),n=t.apply(i,n||arguments);return O(n)?n:i}return t.apply(o,n||arguments)}var t=n[0],u=n[2],o=n[4];return r}function f(n){return O(n)?Br(n):{}}function a(n,r,t){if(typeof n!="function")return Y;if(typeof r=="undefined"||!("prototype"in n))return n;switch(t){case 1:return function(t){return n.call(r,t)};case 2:return function(t,e){return n.call(r,t,e)};case 3:return function(t,e,u){return n.call(r,t,e,u)
|
||||||
|
};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return L(n,r)}function l(n){function r(){var n=p?a:this;if(o){var y=e(o);Rr.apply(y,arguments)}return(i||g)&&(y||(y=e(arguments)),i&&Rr.apply(y,i),g&&y.length<c)?(u|=16,l([t,h?u:-4&u,y,null,a,c])):(y||(y=arguments),s&&(t=n[v]),this instanceof r?(n=f(t.prototype),y=t.apply(n,y),O(y)?y:n):t.apply(n,y))}var t=n[0],u=n[1],o=n[2],i=n[3],a=n[4],c=n[5],p=1&u,s=2&u,g=4&u,h=8&u,v=t;return r}function c(n,r){for(var t=-1,e=m(),u=n?n.length:0,o=[];++t<u;){var i=n[t];
|
||||||
|
0>e(r,i)&&o.push(i)}return o}function p(n,r,t,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++e<u;){var i=n[e];if(i&&typeof i=="object"&&typeof i.length=="number"&&(Cr(i)||b(i))){r||(i=p(i,r,t));var f=-1,a=i.length,l=o.length;for(o.length+=a;++f<a;)o[l++]=i[f]}else t||o.push(i)}return o}function s(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(n===n&&!(n&&vr[typeof n]||r&&vr[typeof r]))return false;if(null==n||null==r)return n===r;var o=Er.call(n),i=Er.call(r);if(o!=i)return false;switch(o){case lr:case cr:return+n==+r;
|
||||||
|
case pr:return n!=+n?r!=+r:0==n?1/n==1/r:n==+r;case gr:case hr:return n==r+""}if(i=o==ar,!i){var f=n instanceof u,a=r instanceof u;if(f||a)return s(f?n.__wrapped__:n,a?r.__wrapped__:r,t,e);if(o!=sr)return false;if(o=n.constructor,f=r.constructor,o!=f&&!(A(o)&&o instanceof o&&A(f)&&f instanceof f)&&"constructor"in n&&"constructor"in r)return false}for(t||(t=[]),e||(e=[]),o=t.length;o--;)if(t[o]==n)return e[o]==r;var l=true,c=0;if(t.push(n),e.push(r),i){if(c=r.length,l=c==n.length)for(;c--&&(l=s(n[c],r[c],t,e)););}else Kr(r,function(r,u,o){return Nr.call(o,u)?(c++,!(l=Nr.call(n,u)&&s(n[u],r,t,e))&&er):void 0
|
||||||
|
}),l&&Kr(n,function(n,r,t){return Nr.call(t,r)?!(l=-1<--c)&&er:void 0});return t.pop(),e.pop(),l}function g(n,r,t){for(var e=-1,u=m(),o=n?n.length:0,i=[],f=t?[]:i;++e<o;){var a=n[e],l=t?t(a,e,n):a;(r?!e||f[f.length-1]!==l:0>u(f,l))&&(t&&f.push(l),i.push(a))}return i}function h(n){return function(r,t,e){var u={};t=X(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++e<o;){var i=r[e];n(u,i,t(i,e,r),r)}else Lr(r,function(r,e,o){n(u,r,t(r,e,o),o)});return u}}function v(n,r,t,e,u,o){var f=16&r,a=32&r;
|
||||||
|
if(!(2&r||A(n)))throw new TypeError;return f&&!t.length&&(r&=-17,t=false),a&&!e.length&&(r&=-33,e=false),(1==r||17===r?i:l)([n,r,t,e,u,o])}function y(n){return Vr[n]}function m(){var r=(r=u.indexOf)===G?n:r;return r}function _(n){return typeof n=="function"&&Ar.test(n)}function d(n){return Gr[n]}function b(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Er.call(n)==fr||false}function w(n){if(!n)return n;for(var r=1,t=arguments.length;r<t;r++){var e=arguments[r];if(e)for(var u in e)n[u]=e[u]}return n
|
||||||
|
}function j(n){if(!n)return n;for(var r=1,t=arguments.length;r<t;r++){var e=arguments[r];if(e)for(var u in e)"undefined"==typeof n[u]&&(n[u]=e[u])}return n}function x(n){var r=[];return Kr(n,function(n,t){A(n)&&r.push(t)}),r.sort()}function T(n){for(var r=-1,t=Ur(n),e=t.length,u={};++r<e;){var o=t[r];u[n[o]]=o}return u}function E(n){if(!n)return true;if(Cr(n)||N(n))return!n.length;for(var r in n)if(Nr.call(n,r))return false;return true}function A(n){return typeof n=="function"}function O(n){return!(!n||!vr[typeof n])
|
||||||
|
}function S(n){return typeof n=="number"||n&&typeof n=="object"&&Er.call(n)==pr||false}function N(n){return typeof n=="string"||n&&typeof n=="object"&&Er.call(n)==hr||false}function R(n){for(var r=-1,t=Ur(n),e=t.length,u=Array(e);++r<e;)u[r]=n[t[r]];return u}function k(n,r){var t=m(),e=n?n.length:0,u=false;return e&&typeof e=="number"?u=-1<t(n,r):Lr(n,function(n){return(u=n===r)&&er}),u}function B(n,r,t){var e=true;r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&(e=!!r(n[t],t,n)););else Lr(n,function(n,t,u){return!(e=!!r(n,t,u))&&er
|
||||||
|
});return e}function F(n,r,t){var e=[];r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u;){var o=n[t];r(o,t,n)&&e.push(o)}else Lr(n,function(n,t,u){r(n,t,u)&&e.push(n)});return e}function q(n,r,t){r=X(r,t,3),t=-1;var e=n?n.length:0;if(typeof e!="number"){var u;return Lr(n,function(n,t,e){return r(n,t,e)?(u=n,er):void 0}),u}for(;++t<e;){var o=n[t];if(r(o,t,n))return o}}function D(n,r,t){var e=-1,u=n?n.length:0;if(r=r&&typeof t=="undefined"?r:a(r,t,3),typeof u=="number")for(;++e<u&&r(n[e],e,n)!==er;);else Lr(n,r)
|
||||||
|
}function I(n,r){var t=n?n.length:0;if(typeof t=="number")for(;t--&&false!==r(n[t],t,n););else{var e=Ur(n),t=e.length;Lr(n,function(n,u,o){return u=e?e[--t]:--t,false===r(o[u],u,o)&&er})}}function M(n,r,t){var e=-1,u=n?n.length:0;if(r=X(r,t,3),typeof u=="number")for(var o=Array(u);++e<u;)o[e]=r(n[e],e,n);else o=[],Lr(n,function(n,t,u){o[++e]=r(n,t,u)});return o}function $(n,r,t){var e=-1/0,u=e;typeof r!="function"&&t&&t[r]===n&&(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++o<i;)t=n[o],t>u&&(u=t);
|
||||||
|
else r=X(r,t,3),D(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function W(n,r,t,e){if(!n)return t;var u=3>arguments.length;r=X(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++o<i;)t=r(t,n[o],o,n);else Lr(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)});return t}function z(n,r,t,e){var u=3>arguments.length;return r=X(r,e,4),I(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function C(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return D(n,function(n){var t;t=++r,t=0+Sr(Wr()*(t-0+1)),e[r]=e[t],e[t]=n
|
||||||
|
}),e}function P(n,r,t){var e;r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&!(e=r(n[t],t,n)););else Lr(n,function(n,t,u){return(e=r(n,t,u))&&er});return!!e}function U(n,r,t){return t&&E(r)?rr:(t?q:F)(n,r)}function V(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=-1;for(r=X(r,t,3);++i<o&&r(n[i],i,n);)u++}else if(u=r,null==u||t)return n?n[0]:rr;return e(n,0,$r(Mr(0,u),o))}function G(r,t,e){if(typeof e=="number"){var u=r?r.length:0;e=0>e?Mr(0,u+e):e||0}else if(e)return e=J(r,t),r[e]===t?e:-1;
|
||||||
|
return n(r,t,e)}function H(n,r,t){if(typeof r!="number"&&null!=r){var u=0,o=-1,i=n?n.length:0;for(r=X(r,t,3);++o<i&&r(n[o],o,n);)u++}else u=null==r||t?1:Mr(0,r);return e(n,u)}function J(n,r,t,e){var u=0,o=n?n.length:u;for(t=t?X(t,e,1):Y,r=t(r);u<o;)e=u+o>>>1,t(n[e])<r?u=e+1:o=e;return u}function K(n,r,t,e){return typeof r!="boolean"&&null!=r&&(e=t,t=typeof r!="function"&&e&&e[r]===n?null:r,r=false),null!=t&&(t=X(t,e,3)),g(n,r,t)}function L(n,r){return 2<arguments.length?v(n,17,e(arguments,2),null,r):v(n,1,null,null,r)
|
||||||
|
}function Q(n,r,t){var e,u,o,i,f,a,l,c=0,p=false,s=true;if(!A(n))throw new TypeError;if(r=Mr(0,r)||0,true===t)var g=true,s=false;else O(t)&&(g=t.leading,p="maxWait"in t&&(Mr(r,t.maxWait)||0),s="trailing"in t?t.trailing:s);var h=function(){var t=r-(nt()-i);0<t?a=setTimeout(h,t):(u&&clearTimeout(u),t=l,u=a=l=rr,t&&(c=nt(),o=n.apply(f,e),a||u||(e=f=null)))},v=function(){a&&clearTimeout(a),u=a=l=rr,(s||p!==r)&&(c=nt(),o=n.apply(f,e),a||u||(e=f=null))};return function(){if(e=arguments,i=nt(),f=this,l=s&&(a||!g),false===p)var t=g&&!a;
|
||||||
|
else{u||g||(c=i);var y=p-(i-c),m=0>=y;m?(u&&(u=clearTimeout(u)),c=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o}}function X(n,r,t){var e=typeof n;if(null==n||"function"==e)return a(n,r,t);if("object"!=e)return nr(n);var u=Ur(n);return function(r){for(var t=u.length,e=false;t--&&(e=r[u[t]]===n[u[t]]););return e}}function Y(n){return n}function Z(n){D(x(n),function(r){var t=u[r]=n[r];u.prototype[r]=function(){var n=[this.__wrapped__];
|
||||||
|
return Rr.apply(n,arguments),n=t.apply(u,n),this.__chain__?new o(n,true):n}})}function nr(n){return function(r){return r[n]}}var rr,tr=0,er={},ur=+new Date+"",or=/($^)/,ir=/['\n\r\t\u2028\u2029\\]/g,fr="[object Arguments]",ar="[object Array]",lr="[object Boolean]",cr="[object Date]",pr="[object Number]",sr="[object Object]",gr="[object RegExp]",hr="[object String]",vr={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},yr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},mr=vr[typeof window]&&window||this,_r=vr[typeof exports]&&exports&&!exports.nodeType&&exports,dr=vr[typeof module]&&module&&!module.nodeType&&module,br=dr&&dr.exports===_r&&_r,wr=vr[typeof global]&&global;
|
||||||
|
!wr||wr.global!==wr&&wr.window!==wr||(mr=wr);var jr=[],xr=Object.prototype,Tr=mr._,Er=xr.toString,Ar=RegExp("^"+(Er+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Or=Math.ceil,Sr=Math.floor,Nr=xr.hasOwnProperty,Rr=jr.push,kr=xr.propertyIsEnumerable,Br=_(Br=Object.create)&&Br,Fr=_(Fr=Array.isArray)&&Fr,qr=mr.isFinite,Dr=mr.isNaN,Ir=_(Ir=Object.keys)&&Ir,Mr=Math.max,$r=Math.min,Wr=Math.random;o.prototype=u.prototype;var zr={};!function(){var n={0:1,length:1};zr.spliceObjects=(jr.splice.call(n,0,1),!n[0])
|
||||||
|
}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Br||(f=function(){function n(){}return function(r){if(O(r)){n.prototype=r;var t=new n;n.prototype=null}return t||mr.Object()}}()),b(arguments)||(b=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Nr.call(n,"callee")&&!kr.call(n,"callee")||false});var Cr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Er.call(n)==ar||false},Pr=function(n){var r,t=[];
|
||||||
|
if(!n||!vr[typeof n])return t;for(r in n)Nr.call(n,r)&&t.push(r);return t},Ur=Ir?function(n){return O(n)?Ir(n):[]}:Pr,Vr={"&":"&","<":"<",">":">",'"':""","'":"'"},Gr=T(Vr),Hr=RegExp("("+Ur(Gr).join("|")+")","g"),Jr=RegExp("["+Ur(Vr).join("")+"]","g"),Kr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(r(n[t],t,n)===er)break;return n},Lr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(Nr.call(n,t)&&r(n[t],t,n)===er)break;return n};A(/x/)&&(A=function(n){return typeof n=="function"&&"[object Function]"==Er.call(n)
|
||||||
|
});var Qr=h(function(n,r,t){Nr.call(n,t)?n[t]++:n[t]=1}),Xr=h(function(n,r,t){(Nr.call(n,t)?n[t]:n[t]=[]).push(r)}),Yr=h(function(n,r,t){n[t]=r}),Zr=M,nt=_(nt=Date.now)&&nt||function(){return(new Date).getTime()};u.after=function(n,r){if(!A(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=L,u.bindAll=function(n){for(var r=1<arguments.length?p(arguments,true,false,1):x(n),t=-1,e=r.length;++t<e;){var u=r[t];n[u]=v(n[u],1,null,null,n)}return n},u.chain=function(n){return n=new o(n),n.__chain__=true,n
|
||||||
|
},u.compact=function(n){for(var r=-1,t=n?n.length:0,e=[];++r<t;){var u=n[r];u&&e.push(u)}return e},u.compose=function(){for(var n=arguments,r=n.length;r--;)if(!A(n[r]))throw new TypeError;return function(){for(var r=arguments,t=n.length;t--;)r=[n[t].apply(this,r)];return r[0]}},u.countBy=Qr,u.debounce=Q,u.defaults=j,u.defer=function(n){if(!A(n))throw new TypeError;var r=e(arguments,1);return setTimeout(function(){n.apply(rr,r)},1)},u.delay=function(n,r){if(!A(n))throw new TypeError;var t=e(arguments,2);
|
||||||
|
return setTimeout(function(){n.apply(rr,t)},r)},u.difference=function(n){return c(n,p(arguments,true,true,1))},u.filter=F,u.flatten=function(n,r){return p(n,r)},u.forEach=D,u.functions=x,u.groupBy=Xr,u.indexBy=Yr,u.initial=function(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=o;for(r=X(r,t,3);i--&&r(n[i],i,n);)u++}else u=null==r||t?1:r||u;return e(n,0,$r(Mr(0,o-u),o))},u.intersection=function(){for(var n=[],r=-1,t=arguments.length;++r<t;){var e=arguments[r];(Cr(e)||b(e))&&n.push(e)
|
||||||
|
}var u=n[0],o=-1,i=m(),f=u?u.length:0,a=[];n:for(;++o<f;)if(e=u[o],0>i(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},u.invert=T,u.invoke=function(n,r){var t=e(arguments,2),u=-1,o=typeof r=="function",i=n?n.length:0,f=Array(typeof i=="number"?i:0);return D(n,function(n){f[++u]=(o?r:n[r]).apply(n,t)}),f},u.keys=Ur,u.map=M,u.max=$,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):ur+arguments[0];return Nr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)
|
||||||
|
}},u.min=function(n,r,t){var e=1/0,u=e;typeof r!="function"&&t&&t[r]===n&&(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++o<i;)t=n[o],t<u&&(u=t);else r=X(r,t,3),D(n,function(n,t,o){t=r(n,t,o),t<e&&(e=t,u=n)});return u},u.omit=function(n){var r=[];Kr(n,function(n,t){r.push(t)});for(var r=c(r,p(arguments,true,false,1)),t=-1,e=r.length,u={};++t<e;){var o=r[t];u[o]=n[o]}return u},u.once=function(n){var r,t;if(!A(n))throw new TypeError;return function(){return r?t:(r=true,t=n.apply(this,arguments),n=null,t)
|
||||||
|
}},u.pairs=function(n){for(var r=-1,t=Ur(n),e=t.length,u=Array(e);++r<e;){var o=t[r];u[r]=[o,n[o]]}return u},u.partial=function(n){return v(n,16,e(arguments,1))},u.pick=function(n){for(var r=-1,t=p(arguments,true,false,1),e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u},u.pluck=Zr,u.range=function(n,r,t){n=+n||0,t=+t||1,null==r&&(r=n,n=0);var e=-1;r=Mr(0,Or((r-n)/t));for(var u=Array(r);++e<r;)u[e]=n,n+=t;return u},u.reject=function(n,r,t){return r=X(r,t,3),F(n,function(n,t,e){return!r(n,t,e)
|
||||||
|
})},u.rest=H,u.shuffle=C,u.sortBy=function(n,t,e){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=X(t,e,3),D(n,function(n,r,e){i[++u]={m:[t(n,r,e)],n:u,o:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].o;return i},u.tap=function(n,r){return r(n),n},u.throttle=function(n,r,t){var e=true,u=true;if(!A(n))throw new TypeError;return false===t?e=false:O(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),t={},t.leading=e,t.maxWait=r,t.trailing=u,Q(n,r,t)},u.times=function(n,r,t){n=-1<(n=+n)?n:0;
|
||||||
|
var e=-1,u=Array(n);for(r=a(r,t,1);++e<n;)u[e]=r(e);return u},u.toArray=function(n){return Cr(n)?e(n):n&&typeof n.length=="number"?M(n):R(n)},u.union=function(){return g(p(arguments,true,true))},u.uniq=K,u.values=R,u.where=U,u.without=function(n){return c(n,e(arguments,1))},u.wrap=function(n,r){return v(r,16,[n])},u.zip=function(){for(var n=-1,r=$(Zr(arguments,"length")),t=Array(0>r?0:r);++n<r;)t[n]=Zr(arguments,n);return t},u.collect=M,u.drop=H,u.each=D,u.extend=w,u.methods=x,u.object=function(n,r){var t=-1,e=n?n.length:0,u={};
|
||||||
|
for(r||!e||Cr(n[0])||(r=[]);++t<e;){var o=n[t];r?u[o]=r[t]:o&&(u[o[0]]=o[1])}return u},u.select=F,u.tail=H,u.unique=K,u.clone=function(n){return O(n)?Cr(n)?e(n):w({},n):n},u.contains=k,u.escape=function(n){return null==n?"":(n+"").replace(Jr,y)},u.every=B,u.find=q,u.has=function(n,r){return n?Nr.call(n,r):false},u.identity=Y,u.indexOf=G,u.isArguments=b,u.isArray=Cr,u.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Er.call(n)==lr||false},u.isDate=function(n){return n&&typeof n=="object"&&Er.call(n)==cr||false
|
||||||
|
},u.isElement=function(n){return n&&1===n.nodeType||false},u.isEmpty=E,u.isEqual=function(n,r){return s(n,r)},u.isFinite=function(n){return qr(n)&&!Dr(parseFloat(n))},u.isFunction=A,u.isNaN=function(n){return S(n)&&n!=+n},u.isNull=function(n){return null===n},u.isNumber=S,u.isObject=O,u.isRegExp=function(n){return n&&vr[typeof n]&&Er.call(n)==gr||false},u.isString=N,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Mr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;
|
||||||
|
return-1},u.mixin=Z,u.noConflict=function(){return mr._=Tr,this},u.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Sr(Wr()*(r-n+1))},u.reduce=W,u.reduceRight=z,u.result=function(n,r){if(n){var t=n[r];return A(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Ur(n).length},u.some=P,u.sortedIndex=J,u.template=function(n,r,e){var o=u,i=o.templateSettings;n=(n||"")+"",e=j({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||or).source+"|"+(e.interpolate||or).source+"|"+(e.evaluate||or).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ir,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r
|
||||||
|
}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Hr,d)},u.uniqueId=function(n){var r=++tr+"";return n?n+r:r},u.all=B,u.any=P,u.detect=q,u.findWhere=function(n,r){return U(n,r,true)},u.foldl=W,u.foldr=z,u.include=k,u.inject=W,u.first=V,u.last=function(n,r,t){var u=0,o=n?n.length:0;
|
||||||
|
if(typeof r!="number"&&null!=r){var i=o;for(r=X(r,t,3);i--&&r(n[i],i,n);)u++}else if(u=r,null==u||t)return n?n[o-1]:rr;return e(n,Mr(0,o-u))},u.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=R(n)),null==r||t?n?n[0+Sr(Wr()*(n.length-1-0+1))]:rr:(n=C(n),n.length=$r(Mr(0,r),n.length),n)},u.take=V,u.head=V,Z(u),u.VERSION="2.4.2",u.prototype.chain=function(){return this.__chain__=true,this},u.prototype.value=function(){return this.__wrapped__},D("pop push reverse shift sort splice unshift".split(" "),function(n){var r=jr[n];
|
||||||
|
u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),zr.spliceObjects||0!==n.length||delete n[0],this}}),D(["concat","join","slice"],function(n){var r=jr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=true),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(mr._=u, define(function(){return u})):_r&&dr?br?(dr.exports=u)._=u:_r._=u:mr._=u}).call(this);
|
||||||
4937
doc/README.md
Normal file
4937
doc/README.md
Normal file
File diff suppressed because it is too large
Load Diff
38
doc/parse.php
Normal file
38
doc/parse.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// cleanup requested file path
|
||||||
|
$filePath = isset($_GET['f']) ? $_GET['f'] : 'lodash';
|
||||||
|
$filePath = preg_replace('#(\.*[\/])+#', '', $filePath);
|
||||||
|
$filePath .= preg_match('/\.[a-z]+$/', $filePath) ? '' : '.js';
|
||||||
|
|
||||||
|
// output filename
|
||||||
|
if (isset($_GET['o'])) {
|
||||||
|
$outputName = $_GET['o'];
|
||||||
|
} else if (isset($_SERVER['argv'][1])) {
|
||||||
|
$outputName = $_SERVER['argv'][1];
|
||||||
|
} else {
|
||||||
|
$outputName = basename($filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
require('../vendor/docdown/docdown.php');
|
||||||
|
|
||||||
|
// get package version
|
||||||
|
$version = json_decode(file_get_contents('../package.json'))->version;
|
||||||
|
|
||||||
|
// generate Markdown
|
||||||
|
$markdown = docdown(array(
|
||||||
|
'path' => '../' . $filePath,
|
||||||
|
'title' => '<a href="http://lodash.com/">Lo-Dash</a> <span>v' . $version . '</span>',
|
||||||
|
'toc' => 'categories',
|
||||||
|
'url' => 'https://github.com/lodash/lodash/blob/' . $version . '/lodash.js'
|
||||||
|
));
|
||||||
|
|
||||||
|
// save to a `.md` file
|
||||||
|
file_put_contents($outputName . '.md', $markdown);
|
||||||
|
|
||||||
|
// print
|
||||||
|
header('Content-Type: text/plain;charset=utf-8');
|
||||||
|
echo $markdown . PHP_EOL;
|
||||||
|
?>
|
||||||
1
index.js
Executable file
1
index.js
Executable file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./dist/lodash.compat.js');
|
||||||
96
package.json
96
package.json
@@ -1,50 +1,60 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash",
|
"name": "lodash",
|
||||||
"version": "5.0.0",
|
"version": "2.4.2",
|
||||||
|
"description": "A utility library delivering consistency, customization, performance, & extras.",
|
||||||
|
"homepage": "https://lodash.com/",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
|
||||||
"main": "dist/lodash.js",
|
"main": "dist/lodash.js",
|
||||||
"sideEffects": false,
|
"keywords": ["amd", "browser", "client", "customize", "functional", "server", "util"],
|
||||||
"scripts": {
|
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||||
"prepare": "husky install",
|
"contributors": [
|
||||||
"lint": "eslint ./src/**/*.ts"
|
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||||
},
|
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)",
|
||||||
"devDependencies": {
|
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)",
|
||||||
"@commitlint/cli": "17.7.1",
|
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
|
||||||
"@commitlint/config-conventional": "17.7.0",
|
],
|
||||||
"@types/eslint": "8.44.2",
|
"repository": "lodash/lodash",
|
||||||
"@types/jest": "29.5.5",
|
"files": [
|
||||||
"@typescript-eslint/eslint-plugin": "6.7.0",
|
"LICENSE.txt",
|
||||||
"@typescript-eslint/parser": "6.7.0",
|
"lodash.js",
|
||||||
"eslint": "8.49.0",
|
"dist/lodash.js",
|
||||||
"eslint-config-airbnb-base": "15.0.0",
|
"dist/lodash.min.js",
|
||||||
"eslint-config-airbnb-typescript": "17.1.0",
|
"dist/lodash.compat.js",
|
||||||
"eslint-config-prettier": "9.0.0",
|
"dist/lodash.compat.min.js",
|
||||||
"eslint-plugin-import": "2.28.1",
|
"dist/lodash.underscore.js",
|
||||||
"eslint-plugin-prettier": "5.0.0",
|
"dist/lodash.underscore.min.js"
|
||||||
"husky": "8.0.3",
|
],
|
||||||
"lint-staged": "14.0.1",
|
"jam": {
|
||||||
"lodash": "4.17.21",
|
"main": "dist/lodash.compat.js",
|
||||||
"prettier": "3.0.3"
|
"include": [
|
||||||
},
|
"LICENSE.txt",
|
||||||
"lint-staged": {
|
"dist/lodash.js",
|
||||||
"src/**/*.{ts}": [
|
"dist/lodash.min.js",
|
||||||
"eslint --fix"
|
"dist/lodash.compat.js",
|
||||||
|
"dist/lodash.compat.min.js",
|
||||||
|
"dist/lodash.underscore.js",
|
||||||
|
"dist/lodash.underscore.min.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"husky": {
|
"volo": {
|
||||||
"hooks": {
|
"type": "directory",
|
||||||
"pre-commit": "lint-staged",
|
"ignore": [
|
||||||
"commit-msg": "bun run commitlint --edit $1"
|
".*",
|
||||||
}
|
"*.custom.*",
|
||||||
},
|
"*.min.*",
|
||||||
"engines": {
|
"*.template.*",
|
||||||
"node": "^18.17.1",
|
"*.map",
|
||||||
"yarn": "^1.22.19"
|
"*.md",
|
||||||
},
|
"lodash.js",
|
||||||
"volta": {
|
"index.js",
|
||||||
"node": "18.17.1",
|
"bower.json",
|
||||||
"yarn": "1.22.19"
|
"component.json",
|
||||||
},
|
"doc",
|
||||||
"engineStrict": true
|
"modularize",
|
||||||
|
"node_modules",
|
||||||
|
"perf",
|
||||||
|
"test",
|
||||||
|
"vendor"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
172
perf/asset/perf-ui.js
Normal file
172
perf/asset/perf-ui.js
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
;(function(window) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** The base path of the builds */
|
||||||
|
var basePath = '../';
|
||||||
|
|
||||||
|
/** The Lo-Dash build to load */
|
||||||
|
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
|
||||||
|
|
||||||
|
/** The other library to load */
|
||||||
|
var other = (other = /other=([^&]+)/.exec(location.search)) && decodeURIComponent(other[1]);
|
||||||
|
|
||||||
|
/** The `ui` object */
|
||||||
|
var ui = {};
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an event listener on an element.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Element} element The element.
|
||||||
|
* @param {string} eventName The name of the event.
|
||||||
|
* @param {Function} handler The event handler.
|
||||||
|
* @returns {Element} The element.
|
||||||
|
*/
|
||||||
|
function addListener(element, eventName, handler) {
|
||||||
|
if (typeof element.addEventListener != 'undefined') {
|
||||||
|
element.addEventListener(eventName, handler, false);
|
||||||
|
} else if (typeof element.attachEvent != 'undefined') {
|
||||||
|
element.attachEvent('on' + eventName, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// initialize controls
|
||||||
|
addListener(window, 'load', function() {
|
||||||
|
function eventHandler(event) {
|
||||||
|
var buildIndex = buildList.selectedIndex,
|
||||||
|
otherIndex = otherList.selectedIndex,
|
||||||
|
search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, '');
|
||||||
|
|
||||||
|
if (event.stopPropagation) {
|
||||||
|
event.stopPropagation();
|
||||||
|
} else {
|
||||||
|
event.cancelBubble = true;
|
||||||
|
}
|
||||||
|
location.href =
|
||||||
|
location.href.split('?')[0] + '?' +
|
||||||
|
(search ? search + '&' : '') +
|
||||||
|
'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' +
|
||||||
|
'other=' + (otherIndex < 0 ? other : otherList[otherIndex].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
var span1 = document.createElement('span');
|
||||||
|
span1.style.cssText = 'float:right';
|
||||||
|
span1.innerHTML =
|
||||||
|
'<label for="perf-build">Build: </label>' +
|
||||||
|
'<select id="perf-build">' +
|
||||||
|
'<option value="lodash-compat">Lo-Dash (compat)</option>' +
|
||||||
|
'<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
|
||||||
|
'<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
|
||||||
|
'<option value="lodash-modern">Lo-Dash (modern)</option>' +
|
||||||
|
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||||
|
'<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
|
||||||
|
'<option value="lodash-custom">Lo-Dash (custom production)</option>' +
|
||||||
|
'</select>';
|
||||||
|
|
||||||
|
var span2 = document.createElement('span');
|
||||||
|
span2.style.cssText = 'float:right';
|
||||||
|
span2.innerHTML =
|
||||||
|
'<label for="perf-other">Other Library: </label>' +
|
||||||
|
'<select id="perf-other">' +
|
||||||
|
'<option value="underscore-dev">Underscore (development)</option>' +
|
||||||
|
'<option value="underscore">Underscore (production)</option>' +
|
||||||
|
'<option value="lodash-compat">Lo-Dash (compat)</option>' +
|
||||||
|
'<option value="lodash-legacy">Lo-Dash (legacy)</option>' +
|
||||||
|
'<option value="lodash-mobile">Lo-Dash (mobile)</option>' +
|
||||||
|
'<option value="lodash-modern">Lo-Dash (modern)</option>' +
|
||||||
|
'<option value="lodash-underscore">Lo-Dash (underscore)</option>' +
|
||||||
|
'<option value="lodash-custom-dev">Lo-Dash (custom development)</option>' +
|
||||||
|
'<option value="lodash-custom">Lo-Dash (custom production)</option>' +
|
||||||
|
'</select>';
|
||||||
|
|
||||||
|
var buildList = span1.lastChild,
|
||||||
|
otherList = span2.lastChild,
|
||||||
|
toolbar = document.getElementById('perf-toolbar');
|
||||||
|
|
||||||
|
toolbar.appendChild(span2);
|
||||||
|
toolbar.appendChild(span1);
|
||||||
|
|
||||||
|
buildList.selectedIndex = (function() {
|
||||||
|
switch (build) {
|
||||||
|
case 'lodash-compat': return 0;
|
||||||
|
case 'lodash-legacy': return 1;
|
||||||
|
case 'lodash-mobile': return 2;
|
||||||
|
case 'lodash-underscore': return 4;
|
||||||
|
case 'lodash-custom-dev': return 5;
|
||||||
|
case 'lodash-custom': return 6;
|
||||||
|
case 'lodash-modern':
|
||||||
|
case null: return 3;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}());
|
||||||
|
|
||||||
|
otherList.selectedIndex = (function() {
|
||||||
|
switch (other) {
|
||||||
|
case 'underscore-dev': return 0;
|
||||||
|
case 'lodash-compat': return 2;
|
||||||
|
case 'lodash-legacy': return 3;
|
||||||
|
case 'lodash-mobile': return 4;
|
||||||
|
case 'lodash-modern': return 5;
|
||||||
|
case 'lodash-underscore': return 6;
|
||||||
|
case 'lodash-custom-dev': return 7;
|
||||||
|
case 'lodash-custom': return 8;
|
||||||
|
case 'underscore':
|
||||||
|
case null: return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}());
|
||||||
|
|
||||||
|
addListener(buildList, 'change', eventHandler);
|
||||||
|
addListener(otherList, 'change', eventHandler);
|
||||||
|
});
|
||||||
|
|
||||||
|
// expose Lo-Dash build file path
|
||||||
|
ui.buildPath = (function() {
|
||||||
|
var result;
|
||||||
|
switch (build) {
|
||||||
|
case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
|
||||||
|
case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
|
||||||
|
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
|
||||||
|
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
|
||||||
|
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
|
||||||
|
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
|
||||||
|
case null: build = 'lodash-modern';
|
||||||
|
case 'lodash-modern': result = 'dist/lodash.min.js'; break;
|
||||||
|
default: return build;
|
||||||
|
}
|
||||||
|
return basePath + result;
|
||||||
|
}());
|
||||||
|
|
||||||
|
// expose other library file path
|
||||||
|
ui.otherPath = (function() {
|
||||||
|
var result;
|
||||||
|
switch (other) {
|
||||||
|
case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
|
||||||
|
case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
|
||||||
|
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
|
||||||
|
case 'lodash-modern': result = 'dist/lodash.min.js'; break;
|
||||||
|
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
|
||||||
|
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
|
||||||
|
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
|
||||||
|
case 'underscore-dev': result = 'vendor/underscore/underscore.js'; break;
|
||||||
|
case null: other = 'underscore';
|
||||||
|
case 'underscore': result = 'vendor/underscore/underscore-min.js'; break;
|
||||||
|
default: return other;
|
||||||
|
}
|
||||||
|
return basePath + result;
|
||||||
|
}());
|
||||||
|
|
||||||
|
// expose `ui.urlParams` properties
|
||||||
|
ui.urlParams = {
|
||||||
|
'build': build,
|
||||||
|
'other': other
|
||||||
|
};
|
||||||
|
|
||||||
|
// expose `ui`
|
||||||
|
window.ui = ui;
|
||||||
|
|
||||||
|
}(this));
|
||||||
82
perf/index.html
Normal file
82
perf/index.html
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Lo-Dash Performance Suite</title>
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
applet {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999em;
|
||||||
|
}
|
||||||
|
#FirebugUI {
|
||||||
|
top: 2em;
|
||||||
|
}
|
||||||
|
#perf-toolbar {
|
||||||
|
background-color: #EEE;
|
||||||
|
color: #5E740B;
|
||||||
|
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||||
|
font-size: small;
|
||||||
|
padding: 0.5em 0 0.5em 2em;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="perf-toolbar"></div>
|
||||||
|
<script src="../vendor/platform.js/platform.js"></script>
|
||||||
|
<script src="../lodash.js"></script>
|
||||||
|
<script src="../vendor/benchmark.js/benchmark.js"></script>
|
||||||
|
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
|
||||||
|
<script src="./asset/perf-ui.js"></script>
|
||||||
|
<script>
|
||||||
|
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
var lodash = _.noConflict();
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
document.write('<script src="' + ui.otherPath + '"><\/script>');
|
||||||
|
</script>
|
||||||
|
<script src="perf.js"></script>
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
var measured,
|
||||||
|
perfNow,
|
||||||
|
begin = new Date;
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
var fbUI = document.getElementById('FirebugUI'),
|
||||||
|
fbDoc = fbUI && (fbDoc = fbUI.contentWindow || fbUI.contentDocument).document || fbDoc,
|
||||||
|
fbCommandLine = fbDoc && fbDoc.getElementById('fbCommandLine');
|
||||||
|
|
||||||
|
if (!fbCommandLine) {
|
||||||
|
return setTimeout(init, 15);
|
||||||
|
}
|
||||||
|
fbUI.style.height = (
|
||||||
|
Math.max(document.documentElement.clientHeight, document.body.clientHeight) -
|
||||||
|
document.getElementById('perf-toolbar').clientHeight
|
||||||
|
) + 'px';
|
||||||
|
|
||||||
|
fbDoc.body.style.height = fbDoc.documentElement.style.height = '100%';
|
||||||
|
setTimeout(run, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
// is the applet permitted?
|
||||||
|
if (!/[?&]nojava=true(?:&|$)/.test(location.search)) {
|
||||||
|
// is the applet really needed?
|
||||||
|
while (!(measured = new Date - begin)) { }
|
||||||
|
if (measured != 1 && !((perfNow = window.performance) && typeof (perfNow.now || perfNow.webkitNow) == 'function')) {
|
||||||
|
// load applet
|
||||||
|
document.write('<applet code="nano" archive="../vendor/benchmark.js/nano.jar"></applet>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.onload = init;
|
||||||
|
}());
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
2008
perf/perf.js
Normal file
2008
perf/perf.js
Normal file
File diff suppressed because it is too large
Load Diff
14
perf/run-perf.sh
Executable file
14
perf/run-perf.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
echo "Running performance suite in node..."
|
||||||
|
node perf.js ../dist/lodash.js && node perf.js ../dist/lodash.min.js
|
||||||
|
|
||||||
|
for cmd in rhino "rhino -require" narwhal ringo phantomjs; do
|
||||||
|
echo ""
|
||||||
|
echo "Running performance suite in $cmd..."
|
||||||
|
$cmd perf.js ../dist/lodash.compat.js && $cmd perf.js ../dist/lodash.compat.min.js
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Running performance suite in a browser..."
|
||||||
|
open index.html
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const path = require('node:path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ['**/*.{ts}'],
|
|
||||||
rules: {
|
|
||||||
'import/no-extraneous-dependencies': [
|
|
||||||
'error',
|
|
||||||
// Use package.json from both this package folder and root.
|
|
||||||
{ packageDir: [__dirname, path.join(__dirname, '../')] },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/** Used to stand-in for `undefined` hash values. */
|
|
||||||
const HASH_UNDEFINED = '__lodash_hash_undefined__'
|
|
||||||
|
|
||||||
class Hash {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a hash object.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @constructor
|
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
|
||||||
*/
|
|
||||||
constructor(entries) {
|
|
||||||
let index = -1
|
|
||||||
const length = entries == null ? 0 : entries.length
|
|
||||||
|
|
||||||
this.clear()
|
|
||||||
while (++index < length) {
|
|
||||||
const entry = entries[index]
|
|
||||||
this.set(entry[0], entry[1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes all key-value entries from the hash.
|
|
||||||
*
|
|
||||||
* @memberOf Hash
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this.__data__ = Object.create(null)
|
|
||||||
this.size = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes `key` and its value from the hash.
|
|
||||||
*
|
|
||||||
* @memberOf Hash
|
|
||||||
* @param {string} key The key of the value to remove.
|
|
||||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
||||||
*/
|
|
||||||
delete(key) {
|
|
||||||
const result = this.has(key) && delete this.__data__[key]
|
|
||||||
this.size -= result ? 1 : 0
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the hash value for `key`.
|
|
||||||
*
|
|
||||||
* @memberOf Hash
|
|
||||||
* @param {string} key The key of the value to get.
|
|
||||||
* @returns {*} Returns the entry value.
|
|
||||||
*/
|
|
||||||
get(key) {
|
|
||||||
const data = this.__data__
|
|
||||||
const result = data[key]
|
|
||||||
return result === HASH_UNDEFINED ? undefined : result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a hash value for `key` exists.
|
|
||||||
*
|
|
||||||
* @memberOf Hash
|
|
||||||
* @param {string} key The key of the entry to check.
|
|
||||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
||||||
*/
|
|
||||||
has(key) {
|
|
||||||
const data = this.__data__
|
|
||||||
return data[key] !== undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the hash `key` to `value`.
|
|
||||||
*
|
|
||||||
* @memberOf Hash
|
|
||||||
* @param {string} key The key of the value to set.
|
|
||||||
* @param {*} value The value to set.
|
|
||||||
* @returns {Object} Returns the hash instance.
|
|
||||||
*/
|
|
||||||
set(key, value) {
|
|
||||||
const data = this.__data__
|
|
||||||
this.size += this.has(key) ? 0 : 1
|
|
||||||
data[key] = value === undefined ? HASH_UNDEFINED : value
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Hash
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
import assocIndexOf from './assocIndexOf.js'
|
|
||||||
|
|
||||||
class ListCache {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an list cache object.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @constructor
|
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
|
||||||
*/
|
|
||||||
constructor(entries) {
|
|
||||||
let index = -1
|
|
||||||
const length = entries == null ? 0 : entries.length
|
|
||||||
|
|
||||||
this.clear()
|
|
||||||
while (++index < length) {
|
|
||||||
const entry = entries[index]
|
|
||||||
this.set(entry[0], entry[1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes all key-value entries from the list cache.
|
|
||||||
*
|
|
||||||
* @memberOf ListCache
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this.__data__ = []
|
|
||||||
this.size = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes `key` and its value from the list cache.
|
|
||||||
*
|
|
||||||
* @memberOf ListCache
|
|
||||||
* @param {string} key The key of the value to remove.
|
|
||||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
||||||
*/
|
|
||||||
delete(key) {
|
|
||||||
const data = this.__data__
|
|
||||||
const index = assocIndexOf(data, key)
|
|
||||||
|
|
||||||
if (index < 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
const lastIndex = data.length - 1
|
|
||||||
if (index === lastIndex) {
|
|
||||||
data.pop()
|
|
||||||
} else {
|
|
||||||
data.splice(index, 1)
|
|
||||||
}
|
|
||||||
--this.size
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the list cache value for `key`.
|
|
||||||
*
|
|
||||||
* @memberOf ListCache
|
|
||||||
* @param {string} key The key of the value to get.
|
|
||||||
* @returns {*} Returns the entry value.
|
|
||||||
*/
|
|
||||||
get(key) {
|
|
||||||
const data = this.__data__
|
|
||||||
const index = assocIndexOf(data, key)
|
|
||||||
return index < 0 ? undefined : data[index][1]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a list cache value for `key` exists.
|
|
||||||
*
|
|
||||||
* @memberOf ListCache
|
|
||||||
* @param {string} key The key of the entry to check.
|
|
||||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
||||||
*/
|
|
||||||
has(key) {
|
|
||||||
return assocIndexOf(this.__data__, key) > -1
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the list cache `key` to `value`.
|
|
||||||
*
|
|
||||||
* @memberOf ListCache
|
|
||||||
* @param {string} key The key of the value to set.
|
|
||||||
* @param {*} value The value to set.
|
|
||||||
* @returns {Object} Returns the list cache instance.
|
|
||||||
*/
|
|
||||||
set(key, value) {
|
|
||||||
const data = this.__data__
|
|
||||||
const index = assocIndexOf(data, key)
|
|
||||||
|
|
||||||
if (index < 0) {
|
|
||||||
++this.size
|
|
||||||
data.push([key, value])
|
|
||||||
} else {
|
|
||||||
data[index][1] = value
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ListCache
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
|
|
||||||
import Hash from './Hash.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the data for `map`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} map The map to query.
|
|
||||||
* @param {string} key The reference key.
|
|
||||||
* @returns {*} Returns the map data.
|
|
||||||
*/
|
|
||||||
function getMapData({ __data__ }, key) {
|
|
||||||
const data = __data__
|
|
||||||
return isKeyable(key)
|
|
||||||
? data[typeof key === 'string' ? 'string' : 'hash']
|
|
||||||
: data.map
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if `value` is suitable for use as unique object key.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {*} value The value to check.
|
|
||||||
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
||||||
*/
|
|
||||||
function isKeyable(value) {
|
|
||||||
const type = typeof value
|
|
||||||
return (type === 'string' || type === 'number' || type === 'symbol' || type === 'boolean')
|
|
||||||
? (value !== '__proto__')
|
|
||||||
: (value === null)
|
|
||||||
}
|
|
||||||
|
|
||||||
class MapCache {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a map cache object to store key-value pairs.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @constructor
|
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
|
||||||
*/
|
|
||||||
constructor(entries) {
|
|
||||||
let index = -1
|
|
||||||
const length = entries == null ? 0 : entries.length
|
|
||||||
|
|
||||||
this.clear()
|
|
||||||
while (++index < length) {
|
|
||||||
const entry = entries[index]
|
|
||||||
this.set(entry[0], entry[1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes all key-value entries from the map.
|
|
||||||
*
|
|
||||||
* @memberOf MapCache
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this.size = 0
|
|
||||||
this.__data__ = {
|
|
||||||
'hash': new Hash,
|
|
||||||
'map': new Map,
|
|
||||||
'string': new Hash
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes `key` and its value from the map.
|
|
||||||
*
|
|
||||||
* @memberOf MapCache
|
|
||||||
* @param {string} key The key of the value to remove.
|
|
||||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
||||||
*/
|
|
||||||
delete(key) {
|
|
||||||
const result = getMapData(this, key)['delete'](key)
|
|
||||||
this.size -= result ? 1 : 0
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the map value for `key`.
|
|
||||||
*
|
|
||||||
* @memberOf MapCache
|
|
||||||
* @param {string} key The key of the value to get.
|
|
||||||
* @returns {*} Returns the entry value.
|
|
||||||
*/
|
|
||||||
get(key) {
|
|
||||||
return getMapData(this, key).get(key)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a map value for `key` exists.
|
|
||||||
*
|
|
||||||
* @memberOf MapCache
|
|
||||||
* @param {string} key The key of the entry to check.
|
|
||||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
||||||
*/
|
|
||||||
has(key) {
|
|
||||||
return getMapData(this, key).has(key)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the map `key` to `value`.
|
|
||||||
*
|
|
||||||
* @memberOf MapCache
|
|
||||||
* @param {string} key The key of the value to set.
|
|
||||||
* @param {*} value The value to set.
|
|
||||||
* @returns {Object} Returns the map cache instance.
|
|
||||||
*/
|
|
||||||
set(key, value) {
|
|
||||||
const data = getMapData(this, key)
|
|
||||||
const size = data.size
|
|
||||||
|
|
||||||
data.set(key, value)
|
|
||||||
this.size += data.size === size ? 0 : 1
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default MapCache
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
import MapCache from './MapCache.js'
|
|
||||||
|
|
||||||
/** Used to stand-in for `undefined` hash values. */
|
|
||||||
const HASH_UNDEFINED = '__lodash_hash_undefined__'
|
|
||||||
|
|
||||||
class SetCache {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an array cache object to store unique values.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @constructor
|
|
||||||
* @param {Array} [values] The values to cache.
|
|
||||||
*/
|
|
||||||
constructor(values) {
|
|
||||||
let index = -1
|
|
||||||
const length = values == null ? 0 : values.length
|
|
||||||
|
|
||||||
this.__data__ = new MapCache
|
|
||||||
while (++index < length) {
|
|
||||||
this.add(values[index])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds `value` to the array cache.
|
|
||||||
*
|
|
||||||
* @memberOf SetCache
|
|
||||||
* @alias push
|
|
||||||
* @param {*} value The value to cache.
|
|
||||||
* @returns {Object} Returns the cache instance.
|
|
||||||
*/
|
|
||||||
add(value) {
|
|
||||||
this.__data__.set(value, HASH_UNDEFINED)
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if `value` is in the array cache.
|
|
||||||
*
|
|
||||||
* @memberOf SetCache
|
|
||||||
* @param {*} value The value to search for.
|
|
||||||
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
|
||||||
*/
|
|
||||||
has(value) {
|
|
||||||
return this.__data__.has(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetCache.prototype.push = SetCache.prototype.add
|
|
||||||
|
|
||||||
export default SetCache
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
import ListCache from './ListCache.js'
|
|
||||||
import MapCache from './MapCache.js'
|
|
||||||
|
|
||||||
/** Used as the size to enable large array optimizations. */
|
|
||||||
const LARGE_ARRAY_SIZE = 200
|
|
||||||
|
|
||||||
class Stack {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a stack cache object to store key-value pairs.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @constructor
|
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
|
||||||
*/
|
|
||||||
constructor(entries) {
|
|
||||||
const data = this.__data__ = new ListCache(entries)
|
|
||||||
this.size = data.size
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes all key-value entries from the stack.
|
|
||||||
*
|
|
||||||
* @memberOf Stack
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this.__data__ = new ListCache
|
|
||||||
this.size = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes `key` and its value from the stack.
|
|
||||||
*
|
|
||||||
* @memberOf Stack
|
|
||||||
* @param {string} key The key of the value to remove.
|
|
||||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
||||||
*/
|
|
||||||
delete(key) {
|
|
||||||
const data = this.__data__
|
|
||||||
const result = data['delete'](key)
|
|
||||||
|
|
||||||
this.size = data.size
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the stack value for `key`.
|
|
||||||
*
|
|
||||||
* @memberOf Stack
|
|
||||||
* @param {string} key The key of the value to get.
|
|
||||||
* @returns {*} Returns the entry value.
|
|
||||||
*/
|
|
||||||
get(key) {
|
|
||||||
return this.__data__.get(key)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a stack value for `key` exists.
|
|
||||||
*
|
|
||||||
* @memberOf Stack
|
|
||||||
* @param {string} key The key of the entry to check.
|
|
||||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
||||||
*/
|
|
||||||
has(key) {
|
|
||||||
return this.__data__.has(key)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the stack `key` to `value`.
|
|
||||||
*
|
|
||||||
* @memberOf Stack
|
|
||||||
* @param {string} key The key of the value to set.
|
|
||||||
* @param {*} value The value to set.
|
|
||||||
* @returns {Object} Returns the stack cache instance.
|
|
||||||
*/
|
|
||||||
set(key, value) {
|
|
||||||
let data = this.__data__
|
|
||||||
if (data instanceof ListCache) {
|
|
||||||
const pairs = data.__data__
|
|
||||||
if (pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
||||||
pairs.push([key, value])
|
|
||||||
this.size = ++data.size
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
data = this.__data__ = new MapCache(pairs)
|
|
||||||
}
|
|
||||||
data.set(key, value)
|
|
||||||
this.size = data.size
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Stack
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Adds the key-value `pair` to `map`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} map The map to modify.
|
|
||||||
* @param {Array} pair The key-value pair to add.
|
|
||||||
* @returns {Object} Returns `map`.
|
|
||||||
*/
|
|
||||||
function addMapEntry(map, pair) {
|
|
||||||
// Don't return `map.set` because it's not chainable in IE 11.
|
|
||||||
map.set(pair[0], pair[1])
|
|
||||||
return map
|
|
||||||
}
|
|
||||||
|
|
||||||
export default addMapEntry
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Adds `value` to `set`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} set The set to modify.
|
|
||||||
* @param {*} value The value to add.
|
|
||||||
* @returns {Object} Returns `set`.
|
|
||||||
*/
|
|
||||||
function addSetEntry(set, value) {
|
|
||||||
// Don't return `set.add` because it's not chainable in IE 11.
|
|
||||||
set.add(value)
|
|
||||||
return set
|
|
||||||
}
|
|
||||||
|
|
||||||
export default addSetEntry
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* A specialized version of `forEach` for arrays.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} [array] The array to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns `array`.
|
|
||||||
*/
|
|
||||||
function arrayEach(array, iteratee) {
|
|
||||||
let index = -1
|
|
||||||
const length = array.length
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
if (iteratee(array[index], index, array) === false) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return array
|
|
||||||
}
|
|
||||||
|
|
||||||
export default arrayEach
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* A specialized version of `forEachRight` for arrays.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} [array] The array to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns `array`.
|
|
||||||
*/
|
|
||||||
function arrayEachRight(array, iteratee) {
|
|
||||||
let length = array == null ? 0 : array.length
|
|
||||||
|
|
||||||
while (length--) {
|
|
||||||
if (iteratee(array[length], length, array) === false) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return array
|
|
||||||
}
|
|
||||||
|
|
||||||
export default arrayEachRight
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import baseIndexOf from './baseIndexOf.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A specialized version of `includes` for arrays without support for
|
|
||||||
* specifying an index to search from.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} [array] The array to inspect.
|
|
||||||
* @param {*} target The value to search for.
|
|
||||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
||||||
*/
|
|
||||||
function arrayIncludes(array, value) {
|
|
||||||
const length = array == null ? 0 : array.length
|
|
||||||
return !!length && baseIndexOf(array, value, 0) > -1
|
|
||||||
}
|
|
||||||
|
|
||||||
export default arrayIncludes
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* This function is like `arrayIncludes` except that it accepts a comparator.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} [array] The array to inspect.
|
|
||||||
* @param {*} target The value to search for.
|
|
||||||
* @param {Function} comparator The comparator invoked per element.
|
|
||||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
||||||
*/
|
|
||||||
function arrayIncludesWith(array, target, comparator) {
|
|
||||||
if (array == null) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const value of array) {
|
|
||||||
if (comparator(target, value)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
export default arrayIncludesWith
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import isArguments from '../isArguments.js'
|
|
||||||
import isBuffer from '../isBuffer.js'
|
|
||||||
import isIndex from './isIndex.js'
|
|
||||||
import isTypedArray from '../isTypedArray.js'
|
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an array of the enumerable property names of the array-like `value`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {*} value The value to query.
|
|
||||||
* @param {boolean} inherited Specify returning inherited property names.
|
|
||||||
* @returns {Array} Returns the array of property names.
|
|
||||||
*/
|
|
||||||
function arrayLikeKeys(value, inherited) {
|
|
||||||
const isArr = Array.isArray(value)
|
|
||||||
const isArg = !isArr && isArguments(value)
|
|
||||||
const isBuff = !isArr && !isArg && isBuffer(value)
|
|
||||||
const isType = !isArr && !isArg && !isBuff && isTypedArray(value)
|
|
||||||
const skipIndexes = isArr || isArg || isBuff || isType
|
|
||||||
const length = value.length
|
|
||||||
const result = new Array(skipIndexes ? length : 0)
|
|
||||||
let index = skipIndexes ? -1 : length
|
|
||||||
while (++index < length) {
|
|
||||||
result[index] = `${index}`
|
|
||||||
}
|
|
||||||
for (const key in value) {
|
|
||||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
|
||||||
!(skipIndexes && (
|
|
||||||
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
||||||
(key === 'length' ||
|
|
||||||
// Skip index properties.
|
|
||||||
isIndex(key, length))
|
|
||||||
))) {
|
|
||||||
result.push(key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default arrayLikeKeys
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* A specialized version of `reduce` for arrays.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} [array] The array to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @param {*} [accumulator] The initial value.
|
|
||||||
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
||||||
* the initial value.
|
|
||||||
* @returns {*} Returns the accumulated value.
|
|
||||||
*/
|
|
||||||
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
||||||
let index = -1
|
|
||||||
const length = array == null ? 0 : array.length
|
|
||||||
|
|
||||||
if (initAccum && length) {
|
|
||||||
accumulator = array[++index]
|
|
||||||
}
|
|
||||||
while (++index < length) {
|
|
||||||
accumulator = iteratee(accumulator, array[index], index, array)
|
|
||||||
}
|
|
||||||
return accumulator
|
|
||||||
}
|
|
||||||
|
|
||||||
export default arrayReduce
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* A specialized version of `reduceRight` for arrays.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} [array] The array to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @param {*} [accumulator] The initial value.
|
|
||||||
* @param {boolean} [initAccum] Specify using the last element of `array` as
|
|
||||||
* the initial value.
|
|
||||||
* @returns {*} Returns the accumulated value.
|
|
||||||
*/
|
|
||||||
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
|
||||||
let length = array == null ? 0 : array.length
|
|
||||||
if (initAccum && length) {
|
|
||||||
accumulator = array[--length]
|
|
||||||
}
|
|
||||||
while (length--) {
|
|
||||||
accumulator = iteratee(accumulator, array[length], length, array)
|
|
||||||
}
|
|
||||||
return accumulator
|
|
||||||
}
|
|
||||||
|
|
||||||
export default arrayReduceRight
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/**
|
|
||||||
* Gets the size of an ASCII `string`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {string} string The string inspect.
|
|
||||||
* @returns {number} Returns the string size.
|
|
||||||
*/
|
|
||||||
function asciiSize({ length }) {
|
|
||||||
return length
|
|
||||||
}
|
|
||||||
|
|
||||||
export default asciiSize
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/**
|
|
||||||
* Converts an ASCII `string` to an array.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {string} string The string to convert.
|
|
||||||
* @returns {Array} Returns the converted array.
|
|
||||||
*/
|
|
||||||
function asciiToArray(string) {
|
|
||||||
return string.split('')
|
|
||||||
}
|
|
||||||
|
|
||||||
export default asciiToArray
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import baseAssignValue from './baseAssignValue.js'
|
|
||||||
import eq from '../eq.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is like `assignValue` except that it doesn't assign
|
|
||||||
* `undefined` values.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to modify.
|
|
||||||
* @param {string} key The key of the property to assign.
|
|
||||||
* @param {*} value The value to assign.
|
|
||||||
*/
|
|
||||||
function assignMergeValue(object, key, value) {
|
|
||||||
if ((value !== undefined && !eq(object[key], value)) ||
|
|
||||||
(value === undefined && !(key in object))) {
|
|
||||||
baseAssignValue(object, key, value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default assignMergeValue
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import baseAssignValue from './baseAssignValue.js'
|
|
||||||
import eq from '../eq.js'
|
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assigns `value` to `key` of `object` if the existing value is not equivalent.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to modify.
|
|
||||||
* @param {string} key The key of the property to assign.
|
|
||||||
* @param {*} value The value to assign.
|
|
||||||
*/
|
|
||||||
function assignValue(object, key, value) {
|
|
||||||
const objValue = object[key]
|
|
||||||
|
|
||||||
if (!(hasOwnProperty.call(object, key) && eq(objValue, value))) {
|
|
||||||
if (value !== 0 || (1 / value) === (1 / objValue)) {
|
|
||||||
baseAssignValue(object, key, value)
|
|
||||||
}
|
|
||||||
} else if (value === undefined && !(key in object)) {
|
|
||||||
baseAssignValue(object, key, value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default assignValue
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import eq from '../eq.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to inspect.
|
|
||||||
* @param {*} key The key to search for.
|
|
||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
||||||
*/
|
|
||||||
function assocIndexOf(array, key) {
|
|
||||||
let { length } = array
|
|
||||||
while (length--) {
|
|
||||||
if (eq(array[length][0], key)) {
|
|
||||||
return length
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
export default assocIndexOf
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
||||||
* value checks.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to modify.
|
|
||||||
* @param {string} key The key of the property to assign.
|
|
||||||
* @param {*} value The value to assign.
|
|
||||||
*/
|
|
||||||
function baseAssignValue(object, key, value) {
|
|
||||||
if (key === '__proto__') {
|
|
||||||
Object.defineProperty(object, key, {
|
|
||||||
'configurable': true,
|
|
||||||
'enumerable': true,
|
|
||||||
'value': value,
|
|
||||||
'writable': true
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
object[key] = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseAssignValue
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import get from '../get.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `at` without support for individual paths.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to iterate over.
|
|
||||||
* @param {string[]} paths The property paths to pick.
|
|
||||||
* @returns {Array} Returns the picked elements.
|
|
||||||
*/
|
|
||||||
function baseAt(object, paths) {
|
|
||||||
let index = -1
|
|
||||||
const length = paths.length
|
|
||||||
const result = new Array(length)
|
|
||||||
const skip = object == null
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
result[index] = skip ? undefined : get(object, paths[index])
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseAt
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
import Stack from './Stack.js'
|
|
||||||
import arrayEach from './arrayEach.js'
|
|
||||||
import assignValue from './assignValue.js'
|
|
||||||
import cloneBuffer from './cloneBuffer.js'
|
|
||||||
import copyArray from './copyArray.js'
|
|
||||||
import copyObject from './copyObject.js'
|
|
||||||
import cloneArrayBuffer from './cloneArrayBuffer.js'
|
|
||||||
import cloneDataView from './cloneDataView.js'
|
|
||||||
import cloneRegExp from './cloneRegExp.js'
|
|
||||||
import cloneSymbol from './cloneSymbol.js'
|
|
||||||
import cloneTypedArray from './cloneTypedArray.js'
|
|
||||||
import copySymbols from './copySymbols.js'
|
|
||||||
import copySymbolsIn from './copySymbolsIn.js'
|
|
||||||
import getAllKeys from './getAllKeys.js'
|
|
||||||
import getAllKeysIn from './getAllKeysIn.js'
|
|
||||||
import getTag from './getTag.js'
|
|
||||||
import initCloneObject from './initCloneObject.js'
|
|
||||||
import isBuffer from '../isBuffer.js'
|
|
||||||
import isObject from '../isObject.js'
|
|
||||||
import isTypedArray from '../isTypedArray.js'
|
|
||||||
import keys from '../keys.js'
|
|
||||||
import keysIn from '../keysIn.js'
|
|
||||||
|
|
||||||
/** Used to compose bitmasks for cloning. */
|
|
||||||
const CLONE_DEEP_FLAG = 1
|
|
||||||
const CLONE_FLAT_FLAG = 2
|
|
||||||
const CLONE_SYMBOLS_FLAG = 4
|
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
|
||||||
const argsTag = '[object Arguments]'
|
|
||||||
const arrayTag = '[object Array]'
|
|
||||||
const boolTag = '[object Boolean]'
|
|
||||||
const dateTag = '[object Date]'
|
|
||||||
const errorTag = '[object Error]'
|
|
||||||
const mapTag = '[object Map]'
|
|
||||||
const numberTag = '[object Number]'
|
|
||||||
const objectTag = '[object Object]'
|
|
||||||
const regexpTag = '[object RegExp]'
|
|
||||||
const setTag = '[object Set]'
|
|
||||||
const stringTag = '[object String]'
|
|
||||||
const symbolTag = '[object Symbol]'
|
|
||||||
const weakMapTag = '[object WeakMap]'
|
|
||||||
|
|
||||||
const arrayBufferTag = '[object ArrayBuffer]'
|
|
||||||
const dataViewTag = '[object DataView]'
|
|
||||||
const float32Tag = '[object Float32Array]'
|
|
||||||
const float64Tag = '[object Float64Array]'
|
|
||||||
const int8Tag = '[object Int8Array]'
|
|
||||||
const int16Tag = '[object Int16Array]'
|
|
||||||
const int32Tag = '[object Int32Array]'
|
|
||||||
const uint8Tag = '[object Uint8Array]'
|
|
||||||
const uint8ClampedTag = '[object Uint8ClampedArray]'
|
|
||||||
const uint16Tag = '[object Uint16Array]'
|
|
||||||
const uint32Tag = '[object Uint32Array]'
|
|
||||||
|
|
||||||
/** Used to identify `toStringTag` values supported by `clone`. */
|
|
||||||
const cloneableTags = {}
|
|
||||||
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
||||||
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
||||||
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
||||||
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
||||||
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
||||||
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
||||||
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
|
||||||
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
||||||
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
|
||||||
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
||||||
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true
|
|
||||||
cloneableTags[errorTag] = cloneableTags[weakMapTag] = false
|
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes an object clone based on its `toStringTag`.
|
|
||||||
*
|
|
||||||
* **Note:** This function only supports cloning values with tags of
|
|
||||||
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to clone.
|
|
||||||
* @param {string} tag The `toStringTag` of the object to clone.
|
|
||||||
* @param {boolean} [isDeep] Specify a deep clone.
|
|
||||||
* @returns {Object} Returns the initialized clone.
|
|
||||||
*/
|
|
||||||
function initCloneByTag(object, tag, isDeep) {
|
|
||||||
const Ctor = object.constructor
|
|
||||||
switch (tag) {
|
|
||||||
case arrayBufferTag:
|
|
||||||
return cloneArrayBuffer(object)
|
|
||||||
|
|
||||||
case boolTag:
|
|
||||||
case dateTag:
|
|
||||||
return new Ctor(+object)
|
|
||||||
|
|
||||||
case dataViewTag:
|
|
||||||
return cloneDataView(object, isDeep)
|
|
||||||
|
|
||||||
case float32Tag: case float64Tag:
|
|
||||||
case int8Tag: case int16Tag: case int32Tag:
|
|
||||||
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
|
|
||||||
return cloneTypedArray(object, isDeep)
|
|
||||||
|
|
||||||
case mapTag:
|
|
||||||
return new Ctor
|
|
||||||
|
|
||||||
case numberTag:
|
|
||||||
case stringTag:
|
|
||||||
return new Ctor(object)
|
|
||||||
|
|
||||||
case regexpTag:
|
|
||||||
return cloneRegExp(object)
|
|
||||||
|
|
||||||
case setTag:
|
|
||||||
return new Ctor
|
|
||||||
|
|
||||||
case symbolTag:
|
|
||||||
return cloneSymbol(object)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes an array clone.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to clone.
|
|
||||||
* @returns {Array} Returns the initialized clone.
|
|
||||||
*/
|
|
||||||
function initCloneArray(array) {
|
|
||||||
const { length } = array
|
|
||||||
const result = new array.constructor(length)
|
|
||||||
|
|
||||||
// Add properties assigned by `RegExp#exec`.
|
|
||||||
if (length && typeof array[0] === 'string' && hasOwnProperty.call(array, 'index')) {
|
|
||||||
result.index = array.index
|
|
||||||
result.input = array.input
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `clone` and `cloneDeep` which tracks
|
|
||||||
* traversed objects.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {*} value The value to clone.
|
|
||||||
* @param {number} bitmask The bitmask flags.
|
|
||||||
* 1 - Deep clone
|
|
||||||
* 2 - Flatten inherited properties
|
|
||||||
* 4 - Clone symbols
|
|
||||||
* @param {Function} [customizer] The function to customize cloning.
|
|
||||||
* @param {string} [key] The key of `value`.
|
|
||||||
* @param {Object} [object] The parent object of `value`.
|
|
||||||
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
||||||
* @returns {*} Returns the cloned value.
|
|
||||||
*/
|
|
||||||
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
||||||
let result
|
|
||||||
const isDeep = bitmask & CLONE_DEEP_FLAG
|
|
||||||
const isFlat = bitmask & CLONE_FLAT_FLAG
|
|
||||||
const isFull = bitmask & CLONE_SYMBOLS_FLAG
|
|
||||||
|
|
||||||
if (customizer) {
|
|
||||||
result = object ? customizer(value, key, object, stack) : customizer(value)
|
|
||||||
}
|
|
||||||
if (result !== undefined) {
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
if (!isObject(value)) {
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
const isArr = Array.isArray(value)
|
|
||||||
const tag = getTag(value)
|
|
||||||
if (isArr) {
|
|
||||||
result = initCloneArray(value)
|
|
||||||
if (!isDeep) {
|
|
||||||
return copyArray(value, result)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const isFunc = typeof value === 'function'
|
|
||||||
|
|
||||||
if (isBuffer(value)) {
|
|
||||||
return cloneBuffer(value, isDeep)
|
|
||||||
}
|
|
||||||
if (tag === objectTag || tag === argsTag || (isFunc && !object)) {
|
|
||||||
result = (isFlat || isFunc) ? {} : initCloneObject(value)
|
|
||||||
if (!isDeep) {
|
|
||||||
return isFlat
|
|
||||||
? copySymbolsIn(value, copyObject(value, keysIn(value), result))
|
|
||||||
: copySymbols(value, Object.assign(result, value))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isFunc || !cloneableTags[tag]) {
|
|
||||||
return object ? value : {}
|
|
||||||
}
|
|
||||||
result = initCloneByTag(value, tag, isDeep)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Check for circular references and return its corresponding clone.
|
|
||||||
stack || (stack = new Stack)
|
|
||||||
const stacked = stack.get(value)
|
|
||||||
if (stacked) {
|
|
||||||
return stacked
|
|
||||||
}
|
|
||||||
stack.set(value, result)
|
|
||||||
|
|
||||||
if (tag === mapTag) {
|
|
||||||
value.forEach((subValue, key) => {
|
|
||||||
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack))
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tag === setTag) {
|
|
||||||
value.forEach((subValue) => {
|
|
||||||
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack))
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isTypedArray(value)) {
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
const keysFunc = isFull
|
|
||||||
? (isFlat ? getAllKeysIn : getAllKeys)
|
|
||||||
: (isFlat ? keysIn : keys)
|
|
||||||
|
|
||||||
const props = isArr ? undefined : keysFunc(value)
|
|
||||||
arrayEach(props || value, (subValue, key) => {
|
|
||||||
if (props) {
|
|
||||||
key = subValue
|
|
||||||
subValue = value[key]
|
|
||||||
}
|
|
||||||
// Recursively populate clone (susceptible to call stack limits).
|
|
||||||
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack))
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseClone
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import baseConformsTo from './baseConformsTo.js'
|
|
||||||
import keys from '../keys.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `conforms` which doesn't clone `source`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} source The object of property predicates to conform to.
|
|
||||||
* @returns {Function} Returns the new spec function.
|
|
||||||
*/
|
|
||||||
function baseConforms(source) {
|
|
||||||
const props = keys(source)
|
|
||||||
return (object) => baseConformsTo(object, source, props)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseConforms
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `conformsTo` which accepts `props` to check.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to inspect.
|
|
||||||
* @param {Object} source The object of property predicates to conform to.
|
|
||||||
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
|
||||||
*/
|
|
||||||
function baseConformsTo(object, source, props) {
|
|
||||||
let length = props.length
|
|
||||||
if (object == null) {
|
|
||||||
return !length
|
|
||||||
}
|
|
||||||
object = Object(object)
|
|
||||||
while (length--) {
|
|
||||||
const key = props[length]
|
|
||||||
const predicate = source[key]
|
|
||||||
const value = object[key]
|
|
||||||
|
|
||||||
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseConformsTo
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
import SetCache from './SetCache.js'
|
|
||||||
import arrayIncludes from './arrayIncludes.js'
|
|
||||||
import arrayIncludesWith from './arrayIncludesWith.js'
|
|
||||||
import map from '../map.js'
|
|
||||||
import cacheHas from './cacheHas.js'
|
|
||||||
|
|
||||||
/** Used as the size to enable large array optimizations. */
|
|
||||||
const LARGE_ARRAY_SIZE = 200
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of methods like `difference` without support
|
|
||||||
* for excluding multiple arrays.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to inspect.
|
|
||||||
* @param {Array} values The values to exclude.
|
|
||||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
||||||
* @param {Function} [comparator] The comparator invoked per element.
|
|
||||||
* @returns {Array} Returns the new array of filtered values.
|
|
||||||
*/
|
|
||||||
function baseDifference(array, values, iteratee, comparator) {
|
|
||||||
let includes = arrayIncludes
|
|
||||||
let isCommon = true
|
|
||||||
const result = []
|
|
||||||
const valuesLength = values.length
|
|
||||||
|
|
||||||
if (!array.length) {
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
if (iteratee) {
|
|
||||||
values = map(values, (value) => iteratee(value))
|
|
||||||
}
|
|
||||||
if (comparator) {
|
|
||||||
includes = arrayIncludesWith
|
|
||||||
isCommon = false
|
|
||||||
}
|
|
||||||
else if (values.length >= LARGE_ARRAY_SIZE) {
|
|
||||||
includes = cacheHas
|
|
||||||
isCommon = false
|
|
||||||
values = new SetCache(values)
|
|
||||||
}
|
|
||||||
outer:
|
|
||||||
for (let value of array) {
|
|
||||||
const computed = iteratee == null ? value : iteratee(value)
|
|
||||||
|
|
||||||
value = (comparator || value !== 0) ? value : 0
|
|
||||||
if (isCommon && computed === computed) {
|
|
||||||
let valuesIndex = valuesLength
|
|
||||||
while (valuesIndex--) {
|
|
||||||
if (values[valuesIndex] === computed) {
|
|
||||||
continue outer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result.push(value)
|
|
||||||
}
|
|
||||||
else if (!includes(values, computed, comparator)) {
|
|
||||||
result.push(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseDifference
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import baseForOwn from './baseForOwn.js'
|
|
||||||
import isArrayLike from '../isArrayLike.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `forEach`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @returns {Array|Object} Returns `collection`.
|
|
||||||
*/
|
|
||||||
function baseEach(collection, iteratee) {
|
|
||||||
if (collection == null) {
|
|
||||||
return collection
|
|
||||||
}
|
|
||||||
if (!isArrayLike(collection)) {
|
|
||||||
return baseForOwn(collection, iteratee)
|
|
||||||
}
|
|
||||||
const length = collection.length
|
|
||||||
const iterable = Object(collection)
|
|
||||||
let index = -1
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
if (iteratee(iterable[index], index, iterable) === false) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return collection
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseEach
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import baseForOwnRight from './baseForOwnRight.js'
|
|
||||||
import isArrayLike from '../isArrayLike.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `forEachRight`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @returns {Array|Object} Returns `collection`.
|
|
||||||
*/
|
|
||||||
function baseEachRight(collection, iteratee) {
|
|
||||||
if (collection == null) {
|
|
||||||
return collection
|
|
||||||
}
|
|
||||||
if (!isArrayLike(collection)) {
|
|
||||||
return baseForOwnRight(collection, iteratee)
|
|
||||||
}
|
|
||||||
const iterable = Object(collection)
|
|
||||||
let length = collection.length
|
|
||||||
|
|
||||||
while (length--) {
|
|
||||||
if (iteratee(iterable[length], length, iterable) === false) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return collection
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseEachRight
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `findIndex` and `findLastIndex`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to inspect.
|
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
|
||||||
* @param {number} fromIndex The index to search from.
|
|
||||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
||||||
*/
|
|
||||||
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
||||||
const { length } = array
|
|
||||||
let index = fromIndex + (fromRight ? 1 : -1)
|
|
||||||
|
|
||||||
while ((fromRight ? index-- : ++index < length)) {
|
|
||||||
if (predicate(array[index], index, array)) {
|
|
||||||
return index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseFindIndex
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of methods like `findKey` and `findLastKey`
|
|
||||||
* which iterates over `collection` using `eachFunc`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array|Object} collection The collection to inspect.
|
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
|
||||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
||||||
* @returns {*} Returns the found element or its key, else `undefined`.
|
|
||||||
*/
|
|
||||||
function baseFindKey(collection, predicate, eachFunc) {
|
|
||||||
let result
|
|
||||||
eachFunc(collection, (value, key, collection) => {
|
|
||||||
if (predicate(value, key, collection)) {
|
|
||||||
result = key
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseFindKey
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import isFlattenable from './isFlattenable.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `flatten` with support for restricting flattening.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to flatten.
|
|
||||||
* @param {number} depth The maximum recursion depth.
|
|
||||||
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
||||||
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
||||||
* @param {Array} [result=[]] The initial result value.
|
|
||||||
* @returns {Array} Returns the new flattened array.
|
|
||||||
*/
|
|
||||||
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
||||||
predicate || (predicate = isFlattenable)
|
|
||||||
result || (result = [])
|
|
||||||
|
|
||||||
if (array == null) {
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const value of array) {
|
|
||||||
if (depth > 0 && predicate(value)) {
|
|
||||||
if (depth > 1) {
|
|
||||||
// Recursively flatten arrays (susceptible to call stack limits).
|
|
||||||
baseFlatten(value, depth - 1, predicate, isStrict, result)
|
|
||||||
} else {
|
|
||||||
result.push(...value)
|
|
||||||
}
|
|
||||||
} else if (!isStrict) {
|
|
||||||
result[result.length] = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseFlatten
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `baseForOwn` which iterates over `object`
|
|
||||||
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
||||||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function baseFor(object, iteratee, keysFunc) {
|
|
||||||
const iterable = Object(object)
|
|
||||||
const props = keysFunc(object)
|
|
||||||
let { length } = props
|
|
||||||
let index = -1
|
|
||||||
|
|
||||||
while (length--) {
|
|
||||||
const key = props[++index]
|
|
||||||
if (iteratee(iterable[key], key, iterable) === false) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return object
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseFor
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import baseFor from './baseFor.js'
|
|
||||||
import keys from '../keys.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `forOwn`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function baseForOwn(object, iteratee) {
|
|
||||||
return object && baseFor(object, iteratee, keys)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseForOwn
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import baseForRight from './baseForRight.js'
|
|
||||||
import keys from '../keys.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `forOwnRight`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function baseForOwnRight(object, iteratee) {
|
|
||||||
return object && baseForRight(object, iteratee, keys)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseForOwnRight
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* This function is like `baseFor` except that it iterates over properties
|
|
||||||
* in the opposite order.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function baseForRight(object, iteratee, keysFunc) {
|
|
||||||
const iterable = Object(object)
|
|
||||||
const props = keysFunc(object)
|
|
||||||
let { length } = props
|
|
||||||
|
|
||||||
while (length--) {
|
|
||||||
const key = props[length]
|
|
||||||
if (iteratee(iterable[key], key, iterable) === false) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return object
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseForRight
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import castPath from './castPath.js'
|
|
||||||
import toKey from './toKey.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `get` without support for default values.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to query.
|
|
||||||
* @param {Array|string} path The path of the property to get.
|
|
||||||
* @returns {*} Returns the resolved value.
|
|
||||||
*/
|
|
||||||
function baseGet(object, path) {
|
|
||||||
path = castPath(path, object)
|
|
||||||
|
|
||||||
let index = 0
|
|
||||||
const length = path.length
|
|
||||||
|
|
||||||
while (object != null && index < length) {
|
|
||||||
object = object[toKey(path[index++])]
|
|
||||||
}
|
|
||||||
return (index && index === length) ? object : undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseGet
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `inRange` which doesn't coerce arguments.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {number} number The number to check.
|
|
||||||
* @param {number} start The start of the range.
|
|
||||||
* @param {number} end The end of the range.
|
|
||||||
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
|
|
||||||
*/
|
|
||||||
function baseInRange(number, start, end) {
|
|
||||||
return number >= Math.min(start, end) && number < Math.max(start, end)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseInRange
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import baseFindIndex from './baseFindIndex.js'
|
|
||||||
import baseIsNaN from './baseIsNaN.js'
|
|
||||||
import strictIndexOf from './strictIndexOf.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `indexOf` without `fromIndex` bounds checks.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to inspect.
|
|
||||||
* @param {*} value The value to search for.
|
|
||||||
* @param {number} fromIndex The index to search from.
|
|
||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
||||||
*/
|
|
||||||
function baseIndexOf(array, value, fromIndex) {
|
|
||||||
return value === value
|
|
||||||
? strictIndexOf(array, value, fromIndex)
|
|
||||||
: baseFindIndex(array, baseIsNaN, fromIndex)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseIndexOf
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* This function is like `baseIndexOf` except that it accepts a comparator.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to inspect.
|
|
||||||
* @param {*} value The value to search for.
|
|
||||||
* @param {number} fromIndex The index to search from.
|
|
||||||
* @param {Function} comparator The comparator invoked per element.
|
|
||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
||||||
*/
|
|
||||||
function baseIndexOfWith(array, value, fromIndex, comparator) {
|
|
||||||
let index = fromIndex - 1
|
|
||||||
const { length } = array
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
if (comparator(array[index], value)) {
|
|
||||||
return index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseIndexOfWith
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import SetCache from './SetCache.js'
|
|
||||||
import arrayIncludes from './arrayIncludes.js'
|
|
||||||
import arrayIncludesWith from './arrayIncludesWith.js'
|
|
||||||
import map from '../map.js'
|
|
||||||
import cacheHas from './cacheHas.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of methods like `intersection` that accepts an
|
|
||||||
* array of arrays to inspect.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} arrays The arrays to inspect.
|
|
||||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
||||||
* @param {Function} [comparator] The comparator invoked per element.
|
|
||||||
* @returns {Array} Returns the new array of shared values.
|
|
||||||
*/
|
|
||||||
function baseIntersection(arrays, iteratee, comparator) {
|
|
||||||
const includes = comparator ? arrayIncludesWith : arrayIncludes
|
|
||||||
const length = arrays[0].length
|
|
||||||
const othLength = arrays.length
|
|
||||||
const caches = new Array(othLength)
|
|
||||||
const result = []
|
|
||||||
|
|
||||||
let array
|
|
||||||
let maxLength = Infinity
|
|
||||||
let othIndex = othLength
|
|
||||||
|
|
||||||
while (othIndex--) {
|
|
||||||
array = arrays[othIndex]
|
|
||||||
if (othIndex && iteratee) {
|
|
||||||
array = map(array, (value) => iteratee(value))
|
|
||||||
}
|
|
||||||
maxLength = Math.min(array.length, maxLength)
|
|
||||||
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
|
|
||||||
? new SetCache(othIndex && array)
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
array = arrays[0]
|
|
||||||
|
|
||||||
let index = -1
|
|
||||||
const seen = caches[0]
|
|
||||||
|
|
||||||
outer:
|
|
||||||
while (++index < length && result.length < maxLength) {
|
|
||||||
let value = array[index]
|
|
||||||
const computed = iteratee ? iteratee(value) : value
|
|
||||||
|
|
||||||
value = (comparator || value !== 0) ? value : 0
|
|
||||||
if (!(seen
|
|
||||||
? cacheHas(seen, computed)
|
|
||||||
: includes(result, computed, comparator)
|
|
||||||
)) {
|
|
||||||
othIndex = othLength
|
|
||||||
while (--othIndex) {
|
|
||||||
const cache = caches[othIndex]
|
|
||||||
if (!(cache
|
|
||||||
? cacheHas(cache, computed)
|
|
||||||
: includes(arrays[othIndex], computed, comparator))
|
|
||||||
) {
|
|
||||||
continue outer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (seen) {
|
|
||||||
seen.push(computed)
|
|
||||||
}
|
|
||||||
result.push(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseIntersection
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import baseIsEqualDeep from './baseIsEqualDeep.js'
|
|
||||||
import isObjectLike from '../isObjectLike.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `isEqual` which supports partial comparisons
|
|
||||||
* and tracks traversed objects.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {*} value The value to compare.
|
|
||||||
* @param {*} other The other value to compare.
|
|
||||||
* @param {boolean} bitmask The bitmask flags.
|
|
||||||
* 1 - Unordered comparison
|
|
||||||
* 2 - Partial comparison
|
|
||||||
* @param {Function} [customizer] The function to customize comparisons.
|
|
||||||
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
||||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
||||||
*/
|
|
||||||
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
||||||
if (value === other) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
|
||||||
return value !== value && other !== other
|
|
||||||
}
|
|
||||||
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseIsEqual
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
import Stack from './Stack.js'
|
|
||||||
import equalArrays from './equalArrays.js'
|
|
||||||
import equalByTag from './equalByTag.js'
|
|
||||||
import equalObjects from './equalObjects.js'
|
|
||||||
import getTag from './getTag.js'
|
|
||||||
import isBuffer from '../isBuffer.js'
|
|
||||||
import isTypedArray from '../isTypedArray.js'
|
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
|
||||||
const COMPARE_PARTIAL_FLAG = 1
|
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
|
||||||
const argsTag = '[object Arguments]'
|
|
||||||
const arrayTag = '[object Array]'
|
|
||||||
const objectTag = '[object Object]'
|
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
||||||
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
||||||
* references to be compared.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to compare.
|
|
||||||
* @param {Object} other The other object to compare.
|
|
||||||
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
||||||
* @param {Function} customizer The function to customize comparisons.
|
|
||||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
||||||
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
||||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
||||||
*/
|
|
||||||
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
||||||
let objIsArr = Array.isArray(object)
|
|
||||||
const othIsArr = Array.isArray(other)
|
|
||||||
let objTag = objIsArr ? arrayTag : getTag(object)
|
|
||||||
let othTag = othIsArr ? arrayTag : getTag(other)
|
|
||||||
|
|
||||||
objTag = objTag === argsTag ? objectTag : objTag
|
|
||||||
othTag = othTag === argsTag ? objectTag : othTag
|
|
||||||
|
|
||||||
let objIsObj = objTag === objectTag
|
|
||||||
const othIsObj = othTag === objectTag
|
|
||||||
const isSameTag = objTag === othTag
|
|
||||||
|
|
||||||
if (isSameTag && isBuffer(object)) {
|
|
||||||
if (!isBuffer(other)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
objIsArr = true
|
|
||||||
objIsObj = false
|
|
||||||
}
|
|
||||||
if (isSameTag && !objIsObj) {
|
|
||||||
stack || (stack = new Stack)
|
|
||||||
return (objIsArr || isTypedArray(object))
|
|
||||||
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
||||||
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack)
|
|
||||||
}
|
|
||||||
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
||||||
const objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__')
|
|
||||||
const othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__')
|
|
||||||
|
|
||||||
if (objIsWrapped || othIsWrapped) {
|
|
||||||
const objUnwrapped = objIsWrapped ? object.value() : object
|
|
||||||
const othUnwrapped = othIsWrapped ? other.value() : other
|
|
||||||
|
|
||||||
stack || (stack = new Stack)
|
|
||||||
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isSameTag) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
stack || (stack = new Stack)
|
|
||||||
return equalObjects(object, other, bitmask, customizer, equalFunc, stack)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseIsEqualDeep
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
import Stack from './Stack.js'
|
|
||||||
import baseIsEqual from './baseIsEqual.js'
|
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
|
||||||
const COMPARE_PARTIAL_FLAG = 1
|
|
||||||
const COMPARE_UNORDERED_FLAG = 2
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `isMatch`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to inspect.
|
|
||||||
* @param {Object} source The object of property values to match.
|
|
||||||
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
||||||
* @param {Function} [customizer] The function to customize comparisons.
|
|
||||||
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
||||||
*/
|
|
||||||
function baseIsMatch(object, source, matchData, customizer) {
|
|
||||||
let index = matchData.length
|
|
||||||
const length = index
|
|
||||||
const noCustomizer = !customizer
|
|
||||||
|
|
||||||
if (object == null) {
|
|
||||||
return !length
|
|
||||||
}
|
|
||||||
let data
|
|
||||||
let result
|
|
||||||
object = Object(object)
|
|
||||||
while (index--) {
|
|
||||||
data = matchData[index]
|
|
||||||
if ((noCustomizer && data[2])
|
|
||||||
? data[1] !== object[data[0]]
|
|
||||||
: !(data[0] in object)
|
|
||||||
) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (++index < length) {
|
|
||||||
data = matchData[index]
|
|
||||||
const key = data[0]
|
|
||||||
const objValue = object[key]
|
|
||||||
const srcValue = data[1]
|
|
||||||
|
|
||||||
if (noCustomizer && data[2]) {
|
|
||||||
if (objValue === undefined && !(key in object)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const stack = new Stack
|
|
||||||
if (customizer) {
|
|
||||||
result = customizer(objValue, srcValue, key, object, source, stack)
|
|
||||||
}
|
|
||||||
if (!(result === undefined
|
|
||||||
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
|
|
||||||
: result
|
|
||||||
)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseIsMatch
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `isNaN` without support for number objects.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {*} value The value to check.
|
|
||||||
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
|
||||||
*/
|
|
||||||
function baseIsNaN(value) {
|
|
||||||
return value !== value
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseIsNaN
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import baseIsMatch from './baseIsMatch.js'
|
|
||||||
import getMatchData from './getMatchData.js'
|
|
||||||
import matchesStrictComparable from './matchesStrictComparable.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `matches` which doesn't clone `source`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} source The object of property values to match.
|
|
||||||
* @returns {Function} Returns the new spec function.
|
|
||||||
*/
|
|
||||||
function baseMatches(source) {
|
|
||||||
const matchData = getMatchData(source)
|
|
||||||
if (matchData.length === 1 && matchData[0][2]) {
|
|
||||||
return matchesStrictComparable(matchData[0][0], matchData[0][1])
|
|
||||||
}
|
|
||||||
return (object) => object === source || baseIsMatch(object, source, matchData)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseMatches
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import baseIsEqual from './baseIsEqual.js'
|
|
||||||
import get from '../get.js'
|
|
||||||
import hasIn from '../hasIn.js'
|
|
||||||
import isKey from './isKey.js'
|
|
||||||
import isStrictComparable from './isStrictComparable.js'
|
|
||||||
import matchesStrictComparable from './matchesStrictComparable.js'
|
|
||||||
import toKey from './toKey.js'
|
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
|
||||||
const COMPARE_PARTIAL_FLAG = 1
|
|
||||||
const COMPARE_UNORDERED_FLAG = 2
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `matchesProperty` which doesn't clone `srcValue`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {string} path The path of the property to get.
|
|
||||||
* @param {*} srcValue The value to match.
|
|
||||||
* @returns {Function} Returns the new spec function.
|
|
||||||
*/
|
|
||||||
function baseMatchesProperty(path, srcValue) {
|
|
||||||
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
||||||
return matchesStrictComparable(toKey(path), srcValue)
|
|
||||||
}
|
|
||||||
return (object) => {
|
|
||||||
const objValue = get(object, path)
|
|
||||||
return (objValue === undefined && objValue === srcValue)
|
|
||||||
? hasIn(object, path)
|
|
||||||
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseMatchesProperty
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import Stack from './Stack.js'
|
|
||||||
import assignMergeValue from './assignMergeValue.js'
|
|
||||||
import baseFor from './baseFor.js'
|
|
||||||
import baseMergeDeep from './baseMergeDeep.js'
|
|
||||||
import isObject from '../isObject.js'
|
|
||||||
import keysIn from '../keysIn.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `merge` without support for multiple sources.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The destination object.
|
|
||||||
* @param {Object} source The source object.
|
|
||||||
* @param {number} srcIndex The index of `source`.
|
|
||||||
* @param {Function} [customizer] The function to customize merged values.
|
|
||||||
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
||||||
* counterparts.
|
|
||||||
*/
|
|
||||||
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
||||||
if (object === source) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
baseFor(source, (srcValue, key) => {
|
|
||||||
if (isObject(srcValue)) {
|
|
||||||
stack || (stack = new Stack)
|
|
||||||
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let newValue = customizer
|
|
||||||
? customizer(object[key], srcValue, `${key}`, object, source, stack)
|
|
||||||
: undefined
|
|
||||||
|
|
||||||
if (newValue === undefined) {
|
|
||||||
newValue = srcValue
|
|
||||||
}
|
|
||||||
assignMergeValue(object, key, newValue)
|
|
||||||
}
|
|
||||||
}, keysIn)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseMerge
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
import assignMergeValue from './assignMergeValue.js'
|
|
||||||
import cloneBuffer from './cloneBuffer.js'
|
|
||||||
import cloneTypedArray from './cloneTypedArray.js'
|
|
||||||
import copyArray from './copyArray.js'
|
|
||||||
import initCloneObject from './initCloneObject.js'
|
|
||||||
import isArguments from '../isArguments.js'
|
|
||||||
import isArrayLikeObject from '../isArrayLikeObject.js'
|
|
||||||
import isBuffer from '../isBuffer.js'
|
|
||||||
import isObject from '../isObject.js'
|
|
||||||
import isPlainObject from '../isPlainObject.js'
|
|
||||||
import isTypedArray from '../isTypedArray.js'
|
|
||||||
import toPlainObject from '../toPlainObject.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
||||||
* deep merges and tracks traversed objects enabling objects with circular
|
|
||||||
* references to be merged.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The destination object.
|
|
||||||
* @param {Object} source The source object.
|
|
||||||
* @param {string} key The key of the value to merge.
|
|
||||||
* @param {number} srcIndex The index of `source`.
|
|
||||||
* @param {Function} mergeFunc The function to merge values.
|
|
||||||
* @param {Function} [customizer] The function to customize assigned values.
|
|
||||||
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
||||||
* counterparts.
|
|
||||||
*/
|
|
||||||
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
||||||
const objValue = object[key]
|
|
||||||
const srcValue = source[key]
|
|
||||||
const stacked = stack.get(srcValue)
|
|
||||||
|
|
||||||
if (stacked) {
|
|
||||||
assignMergeValue(object, key, stacked)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let newValue = customizer
|
|
||||||
? customizer(objValue, srcValue, `${key}`, object, source, stack)
|
|
||||||
: undefined
|
|
||||||
|
|
||||||
let isCommon = newValue === undefined
|
|
||||||
|
|
||||||
if (isCommon) {
|
|
||||||
const isArr = Array.isArray(srcValue)
|
|
||||||
const isBuff = !isArr && isBuffer(srcValue)
|
|
||||||
const isTyped = !isArr && !isBuff && isTypedArray(srcValue)
|
|
||||||
|
|
||||||
newValue = srcValue
|
|
||||||
if (isArr || isBuff || isTyped) {
|
|
||||||
if (Array.isArray(objValue)) {
|
|
||||||
newValue = objValue
|
|
||||||
}
|
|
||||||
else if (isArrayLikeObject(objValue)) {
|
|
||||||
newValue = copyArray(objValue)
|
|
||||||
}
|
|
||||||
else if (isBuff) {
|
|
||||||
isCommon = false
|
|
||||||
newValue = cloneBuffer(srcValue, true)
|
|
||||||
}
|
|
||||||
else if (isTyped) {
|
|
||||||
isCommon = false
|
|
||||||
newValue = cloneTypedArray(srcValue, true)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
newValue = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
||||||
newValue = objValue
|
|
||||||
if (isArguments(objValue)) {
|
|
||||||
newValue = toPlainObject(objValue)
|
|
||||||
}
|
|
||||||
else if (typeof objValue === 'function' || !isObject(objValue)) {
|
|
||||||
newValue = initCloneObject(srcValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
isCommon = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isCommon) {
|
|
||||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
||||||
stack.set(srcValue, newValue)
|
|
||||||
mergeFunc(newValue, srcValue, srcIndex, customizer, stack)
|
|
||||||
stack['delete'](srcValue)
|
|
||||||
}
|
|
||||||
assignMergeValue(object, key, newValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseMergeDeep
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import baseEach from './baseEach.js'
|
|
||||||
import baseSortBy from './baseSortBy.js'
|
|
||||||
import baseGet from './baseGet.js'
|
|
||||||
import compareMultiple from './compareMultiple.js'
|
|
||||||
import isArrayLike from '../isArrayLike.js'
|
|
||||||
|
|
||||||
const identity = (value) => value
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `orderBy` without param guards.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
|
||||||
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
||||||
* @param {string[]} orders The sort orders of `iteratees`.
|
|
||||||
* @returns {Array} Returns the new sorted array.
|
|
||||||
*/
|
|
||||||
function baseOrderBy(collection, iteratees, orders) {
|
|
||||||
if (iteratees.length) {
|
|
||||||
iteratees = iteratees.map((iteratee) => {
|
|
||||||
if (Array.isArray(iteratee)) {
|
|
||||||
return (value) => baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee)
|
|
||||||
}
|
|
||||||
|
|
||||||
return iteratee
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
iteratees = [identity]
|
|
||||||
}
|
|
||||||
|
|
||||||
let criteriaIndex = -1
|
|
||||||
let eachIndex = -1
|
|
||||||
|
|
||||||
const result = isArrayLike(collection) ? new Array(collection.length) : []
|
|
||||||
|
|
||||||
baseEach(collection, (value) => {
|
|
||||||
const criteria = iteratees.map((iteratee) => iteratee(value))
|
|
||||||
|
|
||||||
result[++eachIndex] = {
|
|
||||||
criteria,
|
|
||||||
index: ++criteriaIndex,
|
|
||||||
value
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return baseSortBy(result, (object, other) => compareMultiple(object, other, orders))
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseOrderBy
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import basePickBy from './basePickBy.js'
|
|
||||||
import hasIn from '../hasIn.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `pick` without support for individual
|
|
||||||
* property identifiers.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The source object.
|
|
||||||
* @param {string[]} paths The property paths to pick.
|
|
||||||
* @returns {Object} Returns the new object.
|
|
||||||
*/
|
|
||||||
function basePick(object, paths) {
|
|
||||||
return basePickBy(object, paths, (value, path) => hasIn(object, path))
|
|
||||||
}
|
|
||||||
|
|
||||||
export default basePick
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import baseGet from './baseGet.js'
|
|
||||||
import baseSet from './baseSet.js'
|
|
||||||
import castPath from './castPath.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `pickBy`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The source object.
|
|
||||||
* @param {string[]} paths The property paths to pick.
|
|
||||||
* @param {Function} predicate The function invoked per property.
|
|
||||||
* @returns {Object} Returns the new object.
|
|
||||||
*/
|
|
||||||
function basePickBy(object, paths, predicate) {
|
|
||||||
let index = -1
|
|
||||||
const length = paths.length
|
|
||||||
const result = {}
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
const path = paths[index]
|
|
||||||
const value = baseGet(object, path)
|
|
||||||
if (predicate(value, path)) {
|
|
||||||
baseSet(result, castPath(path, object), value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default basePickBy
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `property` without support for deep paths.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {string} key The key of the property to get.
|
|
||||||
* @returns {Function} Returns the new accessor function.
|
|
||||||
*/
|
|
||||||
function baseProperty(key) {
|
|
||||||
return (object) => object == null ? undefined : object[key]
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseProperty
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import baseGet from './baseGet.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A specialized version of `baseProperty` which supports deep paths.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array|string} path The path of the property to get.
|
|
||||||
* @returns {Function} Returns the new accessor function.
|
|
||||||
*/
|
|
||||||
function basePropertyDeep(path) {
|
|
||||||
return (object) => baseGet(object, path)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default basePropertyDeep
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `propertyOf` without support for deep paths.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to query.
|
|
||||||
* @returns {Function} Returns the new accessor function.
|
|
||||||
*/
|
|
||||||
function basePropertyOf(object) {
|
|
||||||
return (key) => object == null ? undefined : object[key]
|
|
||||||
}
|
|
||||||
|
|
||||||
export default basePropertyOf
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import map from '../map.js'
|
|
||||||
import baseIndexOf from './baseIndexOf.js'
|
|
||||||
import baseIndexOfWith from './baseIndexOfWith.js'
|
|
||||||
import copyArray from './copyArray.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `pullAllBy`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to modify.
|
|
||||||
* @param {Array} values The values to remove.
|
|
||||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
||||||
* @param {Function} [comparator] The comparator invoked per element.
|
|
||||||
* @returns {Array} Returns `array`.
|
|
||||||
*/
|
|
||||||
function basePullAll(array, values, iteratee, comparator) {
|
|
||||||
const indexOf = comparator ? baseIndexOfWith : baseIndexOf
|
|
||||||
const length = values.length
|
|
||||||
|
|
||||||
let index = -1
|
|
||||||
let seen = array
|
|
||||||
|
|
||||||
if (array === values) {
|
|
||||||
values = copyArray(values)
|
|
||||||
}
|
|
||||||
if (iteratee) {
|
|
||||||
seen = map(array, (value) => iteratee(value))
|
|
||||||
}
|
|
||||||
while (++index < length) {
|
|
||||||
let fromIndex = 0
|
|
||||||
const value = values[index]
|
|
||||||
const computed = iteratee ? iteratee(value) : value
|
|
||||||
|
|
||||||
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
|
|
||||||
if (seen !== array) {
|
|
||||||
seen.splice(fromIndex, 1)
|
|
||||||
}
|
|
||||||
array.splice(fromIndex, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return array
|
|
||||||
}
|
|
||||||
|
|
||||||
export default basePullAll
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import baseUnset from './baseUnset.js'
|
|
||||||
import isIndex from './isIndex.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `pullAt` without support for individual
|
|
||||||
* indexes or capturing the removed elements.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to modify.
|
|
||||||
* @param {number[]} indexes The indexes of elements to remove.
|
|
||||||
* @returns {Array} Returns `array`.
|
|
||||||
*/
|
|
||||||
function basePullAt(array, indexes) {
|
|
||||||
let length = array ? indexes.length : 0
|
|
||||||
const lastIndex = length - 1
|
|
||||||
|
|
||||||
while (length--) {
|
|
||||||
let previous
|
|
||||||
const index = indexes[length]
|
|
||||||
if (length === lastIndex || index !== previous) {
|
|
||||||
previous = index
|
|
||||||
if (isIndex(index)) {
|
|
||||||
array.splice(index, 1)
|
|
||||||
} else {
|
|
||||||
baseUnset(array, index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return array
|
|
||||||
}
|
|
||||||
|
|
||||||
export default basePullAt
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `range` and `rangeRight` which doesn't
|
|
||||||
* coerce arguments.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {number} start The start of the range.
|
|
||||||
* @param {number} end The end of the range.
|
|
||||||
* @param {number} step The value to increment or decrement by.
|
|
||||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
||||||
* @returns {Array} Returns the range of numbers.
|
|
||||||
*/
|
|
||||||
function baseRange(start, end, step, fromRight) {
|
|
||||||
let index = -1
|
|
||||||
let length = Math.max(Math.ceil((end - start) / (step || 1)), 0)
|
|
||||||
const result = new Array(length)
|
|
||||||
|
|
||||||
while (length--) {
|
|
||||||
result[fromRight ? length : ++index] = start
|
|
||||||
start += step
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseRange
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `reduce` and `reduceRight` which iterates
|
|
||||||
* over `collection` using `eachFunc`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @param {*} accumulator The initial value.
|
|
||||||
* @param {boolean} initAccum Specify using the first or last element of
|
|
||||||
* `collection` as the initial value.
|
|
||||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
||||||
* @returns {*} Returns the accumulated value.
|
|
||||||
*/
|
|
||||||
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
|
||||||
eachFunc(collection, (value, index, collection) => {
|
|
||||||
accumulator = initAccum
|
|
||||||
? (initAccum = false, value)
|
|
||||||
: iteratee(accumulator, value, index, collection)
|
|
||||||
})
|
|
||||||
return accumulator
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseReduce
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import assignValue from './assignValue.js'
|
|
||||||
import castPath from './castPath.js'
|
|
||||||
import isIndex from './isIndex.js'
|
|
||||||
import isObject from '../isObject.js'
|
|
||||||
import toKey from './toKey.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `set`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to modify.
|
|
||||||
* @param {Array|string} path The path of the property to set.
|
|
||||||
* @param {*} value The value to set.
|
|
||||||
* @param {Function} [customizer] The function to customize path creation.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function baseSet(object, path, value, customizer) {
|
|
||||||
if (!isObject(object)) {
|
|
||||||
return object
|
|
||||||
}
|
|
||||||
path = castPath(path, object)
|
|
||||||
|
|
||||||
const length = path.length
|
|
||||||
const lastIndex = length - 1
|
|
||||||
|
|
||||||
let index = -1
|
|
||||||
let nested = object
|
|
||||||
|
|
||||||
while (nested != null && ++index < length) {
|
|
||||||
const key = toKey(path[index])
|
|
||||||
let newValue = value
|
|
||||||
|
|
||||||
if (index !== lastIndex) {
|
|
||||||
const objValue = nested[key]
|
|
||||||
newValue = customizer ? customizer(objValue, key, nested) : undefined
|
|
||||||
if (newValue === undefined) {
|
|
||||||
newValue = isObject(objValue)
|
|
||||||
? objValue
|
|
||||||
: (isIndex(path[index + 1]) ? [] : {})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assignValue(nested, key, newValue)
|
|
||||||
nested = nested[key]
|
|
||||||
}
|
|
||||||
return object
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseSet
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* The base implementation of `sortBy` which uses `comparer` to define the
|
|
||||||
* sort order of `array` and replaces criteria objects with their corresponding
|
|
||||||
* values.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to sort.
|
|
||||||
* @param {Function} comparer The function to define sort order.
|
|
||||||
* @returns {Array} Returns `array`.
|
|
||||||
*/
|
|
||||||
function baseSortBy(array, comparer) {
|
|
||||||
let { length } = array
|
|
||||||
|
|
||||||
array.sort(comparer)
|
|
||||||
while (length--) {
|
|
||||||
array[length] = array[length].value
|
|
||||||
}
|
|
||||||
return array
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseSortBy
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import baseSortedIndexBy from './baseSortedIndexBy.js'
|
|
||||||
import isSymbol from '../isSymbol.js'
|
|
||||||
|
|
||||||
/** Used as references for the maximum length and index of an array. */
|
|
||||||
const MAX_ARRAY_LENGTH = 4294967295
|
|
||||||
const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `sortedIndex` and `sortedLastIndex` which
|
|
||||||
* performs a binary search of `array` to determine the index at which `value`
|
|
||||||
* should be inserted into `array` in order to maintain its sort order.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The sorted array to inspect.
|
|
||||||
* @param {*} value The value to evaluate.
|
|
||||||
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
||||||
* @returns {number} Returns the index at which `value` should be inserted
|
|
||||||
* into `array`.
|
|
||||||
*/
|
|
||||||
function baseSortedIndex(array, value, retHighest) {
|
|
||||||
let low = 0
|
|
||||||
let high = array == null ? low : array.length
|
|
||||||
|
|
||||||
if (typeof value === 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
|
||||||
while (low < high) {
|
|
||||||
const mid = (low + high) >>> 1
|
|
||||||
const computed = array[mid]
|
|
||||||
if (computed !== null && !isSymbol(computed) &&
|
|
||||||
(retHighest ? (computed <= value) : (computed < value))) {
|
|
||||||
low = mid + 1
|
|
||||||
} else {
|
|
||||||
high = mid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return high
|
|
||||||
}
|
|
||||||
return baseSortedIndexBy(array, value, (value) => value, retHighest)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseSortedIndex
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
import isSymbol from '../isSymbol.js'
|
|
||||||
|
|
||||||
/** Used as references for the maximum length and index of an array. */
|
|
||||||
const MAX_ARRAY_LENGTH = 4294967295
|
|
||||||
const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `sortedIndexBy` and `sortedLastIndexBy`
|
|
||||||
* which invokes `iteratee` for `value` and each element of `array` to compute
|
|
||||||
* their sort ranking. The iteratee is invoked with one argument (value).
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The sorted array to inspect.
|
|
||||||
* @param {*} value The value to evaluate.
|
|
||||||
* @param {Function} iteratee The iteratee invoked per element.
|
|
||||||
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
||||||
* @returns {number} Returns the index at which `value` should be inserted
|
|
||||||
* into `array`.
|
|
||||||
*/
|
|
||||||
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
|
||||||
let low = 0
|
|
||||||
let high = array == null ? 0 : array.length
|
|
||||||
if (high === 0) {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
value = iteratee(value)
|
|
||||||
|
|
||||||
const valIsNaN = value !== value
|
|
||||||
const valIsNull = value === null
|
|
||||||
const valIsSymbol = isSymbol(value)
|
|
||||||
const valIsUndefined = value === undefined
|
|
||||||
|
|
||||||
while (low < high) {
|
|
||||||
let setLow
|
|
||||||
const mid = Math.floor((low + high) / 2)
|
|
||||||
const computed = iteratee(array[mid])
|
|
||||||
const othIsDefined = computed !== undefined
|
|
||||||
const othIsNull = computed === null
|
|
||||||
const othIsReflexive = computed === computed
|
|
||||||
const othIsSymbol = isSymbol(computed)
|
|
||||||
|
|
||||||
if (valIsNaN) {
|
|
||||||
setLow = retHighest || othIsReflexive
|
|
||||||
} else if (valIsUndefined) {
|
|
||||||
setLow = othIsReflexive && (retHighest || othIsDefined)
|
|
||||||
} else if (valIsNull) {
|
|
||||||
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull)
|
|
||||||
} else if (valIsSymbol) {
|
|
||||||
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol)
|
|
||||||
} else if (othIsNull || othIsSymbol) {
|
|
||||||
setLow = false
|
|
||||||
} else {
|
|
||||||
setLow = retHighest ? (computed <= value) : (computed < value)
|
|
||||||
}
|
|
||||||
if (setLow) {
|
|
||||||
low = mid + 1
|
|
||||||
} else {
|
|
||||||
high = mid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Math.min(high, MAX_ARRAY_INDEX)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default baseSortedIndexBy
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user