fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

20
node_modules/webpack-merge/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2015 Juho Vepsalainen
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

314
node_modules/webpack-merge/README.md generated vendored Normal file
View File

@@ -0,0 +1,314 @@
[![Financial Contributors on Open Collective](https://opencollective.com/webpack-merge/all/badge.svg?label=financial+contributors)](https://opencollective.com/webpack-merge) [![Test](https://github.com/survivejs/webpack-merge/actions/workflows/test.yml/badge.svg?branch=develop&event=push)](https://github.com/survivejs/webpack-merge/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/survivejs/webpack-merge/branch/master/graph/badge.svg)](https://codecov.io/gh/survivejs/webpack-merge)
# webpack-merge - Merge designed for Webpack
**webpack-merge** provides a `merge` function that concatenates arrays and merges objects creating a new object. If functions are encountered, it will execute them, run the results through the algorithm, and then wrap the returned values within a function again.
This behavior is particularly useful in configuring webpack although it has uses beyond it. Whenever you need to merge configuration objects, **webpack-merge** can come in handy.
## **`merge(...configuration | [...configuration])`**
`merge` is the core, and the most important idea, of the API. Often this is all you need unless you want further customization.
```javascript
const { merge } = require('webpack-merge');
// Default API
const output = merge(object1, object2, object3, ...);
// You can pass an array of objects directly.
// This works with all available functions.
const output = merge([object1, object2, object3]);
// Keys matching to the right take precedence:
const output = merge(
{ fruit: "apple", color: "red" },
{ fruit: "strawberries" }
);
console.log(output);
// { color: "red", fruit: "strawberries"}
```
### Limitations
Note that `Promise`s are not supported! If you want to return a configuration wrapped within a `Promise`, `merge` inside one. Example: `Promise.resolve(merge({ ... }, { ... }))`.
The same goes for configuration level functions as in the example below:
**webpack.config.js**
```javascript
const commonConfig = { ... };
const productionConfig = { ... };
const developmentConfig = { ... };
module.exports = (env, args) => {
switch(args.mode) {
case 'development':
return merge(commonConfig, developmentConfig);
case 'production':
return merge(commonConfig, productionConfig);
default:
throw new Error('No matching configuration was found!');
}
}
```
You can choose the configuration you want by using `webpack --mode development` assuming you are using _webpack-cli_.
## **`mergeWithCustomize({ customizeArray, customizeObject })(...configuration | [...configuration])`**
In case you need more flexibility, `merge` behavior can be customized per field as below:
```javascript
const { mergeWithCustomize } = require('webpack-merge');
const output = mergeWithCustomize(
{
customizeArray(a, b, key) {
if (key === 'extensions') {
return _.uniq([...a, ...b]);
}
// Fall back to default merging
return undefined;
},
customizeObject(a, b, key) {
if (key === 'module') {
// Custom merging
return _.merge({}, a, b);
}
// Fall back to default merging
return undefined;
}
}
)(object1, object2, object3, ...);
```
For example, if the previous code was invoked with only `object1` and `object2`
with `object1` as:
```javascript
{
foo1: ['object1'],
foo2: ['object1'],
bar1: { object1: {} },
bar2: { object1: {} },
}
```
and `object2` as:
```javascript
{
foo1: ['object2'],
foo2: ['object2'],
bar1: { object2: {} },
bar2: { object2: {} },
}
```
then `customizeArray` will be invoked for each property of `Array` type, i.e:
```javascript
customizeArray(["object1"], ["object2"], "foo1");
customizeArray(["object1"], ["object2"], "foo2");
```
and `customizeObject` will be invoked for each property of `Object` type, i.e:
```javascript
customizeObject({ object1: {} }, { object2: {} }, bar1);
customizeObject({ object1: {} }, { object2: {} }, bar2);
```
## **`customizeArray`** and **`customizeObject`**
`customizeArray` and `customizeObject` provide small strategies to for `mergeWithCustomize`. They support `append`, `prepend`, `replace`, and wildcards for field names.
```javascript
const { mergeWithCustomize, customizeArray, customizeObject } = require('webpack-merge');
const output = mergeWithCustomize({
customizeArray: customizeArray({
'entry.*': 'prepend'
}),
customizeObject: customizeObject({
entry: 'prepend'
})
})(object1, object2, object3, ...);
```
## **`unique(<field>, <fields>, field => field)`**
`unique` is a strategy used for forcing uniqueness within configuration. It's most useful with plugins when you want to make sure there's only one in place.
The first `<field>` is the config property to look through for duplicates.
`<fields>` represents the values that should be unique when you run the field => field function on each duplicate.
When the order of elements of the `<field>` in the first configuration differs from the order in the second configuration, the latter is preserved.
```javascript
const { mergeWithCustomize, unique } = require("webpack-merge");
const output = mergeWithCustomize({
customizeArray: unique(
"plugins",
["HotModuleReplacementPlugin"],
(plugin) => plugin.constructor && plugin.constructor.name
),
})(
{
plugins: [new webpack.HotModuleReplacementPlugin()],
},
{
plugins: [new webpack.HotModuleReplacementPlugin()],
}
);
// Output contains only single HotModuleReplacementPlugin now and it's
// going to be the last plugin instance.
```
## **`mergeWithRules`**
To support advanced merging needs (i.e. merging within loaders), `mergeWithRules` includes additional syntax that allows you to match fields and apply strategies to match. Consider the full example below:
```javascript
const a = {
module: {
rules: [
{
test: /\.css$/,
use: [{ loader: "style-loader" }, { loader: "sass-loader" }],
},
],
},
};
const b = {
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: "style-loader",
options: {
modules: true,
},
},
],
},
],
},
};
const result = {
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: "style-loader",
options: {
modules: true,
},
},
{ loader: "sass-loader" },
],
},
],
},
};
assert.deepStrictEqual(
mergeWithRules({
module: {
rules: {
test: "match",
use: {
loader: "match",
options: "replace",
},
},
},
})(a, b),
result
);
```
The way it works is that you should annotate fields to match using `match` (or `CustomizeRule.Match` if you are using TypeScript) matching your configuration structure and then use specific strategies to define how particular fields should be transformed. If a match doesn't exist above a rule, then it will apply the rule automatically.
**Supported annotations:**
- `match` (`CustomizeRule.Match`) - Optional matcher that scopes merging behavior to a specific part based on similarity (think DOM or jQuery selectors)
- `append` (`CustomizeRule.Append`) - Appends items
- `prepend` (`CustomizeRule.Prepend`) - Prepends items
- `replace` (`CustomizeRule.Replace`) - Replaces items
- `merge` (`CustomizeRule.Merge`) - Merges objects (shallow merge)
## Using with TypeScript
**webpack-merge** supports TypeScript out of the box. You should pass `Configuration` type from webpack to it as follows:
```typescript
import { Configuration } from "webpack";
import { merge } from "webpack-merge";
const config = merge<Configuration>({...}, {...});
...
```
## Development
1. `nvm use`
1. `npm i`
1. `npm run build -- --watch` in one terminal
1. `npm t -- --watch` in another one
Before contributing, please [open an issue](https://github.com/survivejs/webpack-merge/issues/new) where to discuss.
## Further Information and Support
Check out [SurviveJS - Webpack 5](http://survivejs.com/) to dig deeper into webpack. The free book uses **webpack-merge** extensively and shows you how to compose your configuration to keep it maintainable.
I am also available as a consultant in case you require specific assistance. I can contribute particularly in terms of improving maintainability of the setup while speeding it up and pointing out better practices. In addition to improving developer productivity, the work has impact on the end users of the product in terms of reduced application size and loading times.
## Contributors
### Code Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/survivejs/webpack-merge/graphs/contributors"><img src="https://opencollective.com/webpack-merge/contributors.svg?width=890&button=false" /></a>
### Financial Contributors
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/webpack-merge/contribute)]
#### Individuals
<a href="https://opencollective.com/webpack-merge"><img src="https://opencollective.com/webpack-merge/individuals.svg?width=890"></a>
#### Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/webpack-merge/contribute)]
<a href="https://opencollective.com/webpack-merge/organization/0/website"><img src="https://opencollective.com/webpack-merge/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/1/website"><img src="https://opencollective.com/webpack-merge/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/2/website"><img src="https://opencollective.com/webpack-merge/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/3/website"><img src="https://opencollective.com/webpack-merge/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/4/website"><img src="https://opencollective.com/webpack-merge/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/5/website"><img src="https://opencollective.com/webpack-merge/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/6/website"><img src="https://opencollective.com/webpack-merge/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/7/website"><img src="https://opencollective.com/webpack-merge/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/8/website"><img src="https://opencollective.com/webpack-merge/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/webpack-merge/organization/9/website"><img src="https://opencollective.com/webpack-merge/organization/9/avatar.svg"></a>
## License
**webpack-merge** is available under MIT. See LICENSE for more details.

15
node_modules/webpack-merge/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import unique from "./unique";
import { CustomizeRule, CustomizeRuleString, ICustomizeOptions, Key } from "./types";
declare function merge<Configuration extends object>(firstConfiguration: Configuration | Configuration[], ...configurations: Configuration[]): Configuration;
declare function mergeWithCustomize<Configuration extends object>(options: ICustomizeOptions): (firstConfiguration: Configuration | Configuration[], ...configurations: Configuration[]) => Configuration;
declare function customizeArray(rules: {
[s: string]: CustomizeRule | CustomizeRuleString;
}): (a: any, b: any, key: Key) => any;
declare type Rules = {
[s: string]: CustomizeRule | CustomizeRuleString | Rules;
};
declare function mergeWithRules(rules: Rules): (firstConfiguration: object | object[], ...configurations: object[]) => object;
declare function customizeObject(rules: {
[s: string]: CustomizeRule | CustomizeRuleString;
}): (a: any, b: any, key: Key) => any;
export { customizeArray, customizeObject, CustomizeRule, merge, merge as default, mergeWithCustomize, mergeWithRules, unique, };

252
node_modules/webpack-merge/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,252 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
exports.__esModule = true;
exports.unique = exports.mergeWithRules = exports.mergeWithCustomize = exports["default"] = exports.merge = exports.CustomizeRule = exports.customizeObject = exports.customizeArray = void 0;
var wildcard_1 = __importDefault(require("wildcard"));
var merge_with_1 = __importDefault(require("./merge-with"));
var join_arrays_1 = __importDefault(require("./join-arrays"));
var unique_1 = __importDefault(require("./unique"));
exports.unique = unique_1["default"];
var types_1 = require("./types");
exports.CustomizeRule = types_1.CustomizeRule;
var utils_1 = require("./utils");
function merge(firstConfiguration) {
var configurations = [];
for (var _i = 1; _i < arguments.length; _i++) {
configurations[_i - 1] = arguments[_i];
}
return mergeWithCustomize({}).apply(void 0, __spreadArray([firstConfiguration], __read(configurations)));
}
exports.merge = merge;
exports["default"] = merge;
function mergeWithCustomize(options) {
return function mergeWithOptions(firstConfiguration) {
var configurations = [];
for (var _i = 1; _i < arguments.length; _i++) {
configurations[_i - 1] = arguments[_i];
}
if (utils_1.isUndefined(firstConfiguration) || configurations.some(utils_1.isUndefined)) {
throw new TypeError("Merging undefined is not supported");
}
// @ts-ignore
if (firstConfiguration.then) {
throw new TypeError("Promises are not supported");
}
// No configuration at all
if (!firstConfiguration) {
return {};
}
if (configurations.length === 0) {
if (Array.isArray(firstConfiguration)) {
// Empty array
if (firstConfiguration.length === 0) {
return {};
}
if (firstConfiguration.some(utils_1.isUndefined)) {
throw new TypeError("Merging undefined is not supported");
}
// @ts-ignore
if (firstConfiguration[0].then) {
throw new TypeError("Promises are not supported");
}
return merge_with_1["default"](firstConfiguration, join_arrays_1["default"](options));
}
return firstConfiguration;
}
return merge_with_1["default"]([firstConfiguration].concat(configurations), join_arrays_1["default"](options));
};
}
exports.mergeWithCustomize = mergeWithCustomize;
function customizeArray(rules) {
return function (a, b, key) {
var matchedRule = Object.keys(rules).find(function (rule) { return wildcard_1["default"](rule, key); }) || "";
if (matchedRule) {
switch (rules[matchedRule]) {
case types_1.CustomizeRule.Prepend:
return __spreadArray(__spreadArray([], __read(b)), __read(a));
case types_1.CustomizeRule.Replace:
return b;
case types_1.CustomizeRule.Append:
default:
return __spreadArray(__spreadArray([], __read(a)), __read(b));
}
}
};
}
exports.customizeArray = customizeArray;
function mergeWithRules(rules) {
return mergeWithCustomize({
customizeArray: function (a, b, key) {
var currentRule = rules;
key.split(".").forEach(function (k) {
if (!currentRule) {
return;
}
currentRule = currentRule[k];
});
if (utils_1.isPlainObject(currentRule)) {
return mergeWithRule({ currentRule: currentRule, a: a, b: b });
}
if (typeof currentRule === "string") {
return mergeIndividualRule({ currentRule: currentRule, a: a, b: b });
}
return undefined;
}
});
}
exports.mergeWithRules = mergeWithRules;
var isArray = Array.isArray;
function mergeWithRule(_a) {
var currentRule = _a.currentRule, a = _a.a, b = _a.b;
if (!isArray(a)) {
return a;
}
var bAllMatches = [];
var ret = a.map(function (ao) {
if (!utils_1.isPlainObject(currentRule)) {
return ao;
}
var ret = {};
var rulesToMatch = [];
var operations = {};
Object.entries(currentRule).forEach(function (_a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
if (v === types_1.CustomizeRule.Match) {
rulesToMatch.push(k);
}
else {
operations[k] = v;
}
});
var bMatches = b.filter(function (o) {
var matches = rulesToMatch.every(function (rule) { return utils_1.isSameCondition(ao[rule], o[rule]); });
if (matches) {
bAllMatches.push(o);
}
return matches;
});
if (!utils_1.isPlainObject(ao)) {
return ao;
}
Object.entries(ao).forEach(function (_a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
var rule = currentRule;
switch (currentRule[k]) {
case types_1.CustomizeRule.Match:
ret[k] = v;
Object.entries(rule).forEach(function (_a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
if (v === types_1.CustomizeRule.Replace && bMatches.length > 0) {
var val = last(bMatches)[k];
if (typeof val !== "undefined") {
ret[k] = val;
}
}
});
break;
case types_1.CustomizeRule.Append:
if (!bMatches.length) {
ret[k] = v;
break;
}
var appendValue = last(bMatches)[k];
if (!isArray(v) || !isArray(appendValue)) {
throw new TypeError("Trying to append non-arrays");
}
ret[k] = v.concat(appendValue);
break;
case types_1.CustomizeRule.Merge:
if (!bMatches.length) {
ret[k] = v;
break;
}
var lastValue = last(bMatches)[k];
if (!utils_1.isPlainObject(v) || !utils_1.isPlainObject(lastValue)) {
throw new TypeError("Trying to merge non-objects");
}
// deep merge
ret[k] = merge(v, lastValue);
break;
case types_1.CustomizeRule.Prepend:
if (!bMatches.length) {
ret[k] = v;
break;
}
var prependValue = last(bMatches)[k];
if (!isArray(v) || !isArray(prependValue)) {
throw new TypeError("Trying to prepend non-arrays");
}
ret[k] = prependValue.concat(v);
break;
case types_1.CustomizeRule.Replace:
ret[k] = bMatches.length > 0 ? last(bMatches)[k] : v;
break;
default:
var currentRule_1 = operations[k];
// Use .flat(); starting from Node 12
var b_1 = bMatches
.map(function (o) { return o[k]; })
.reduce(function (acc, val) {
return isArray(acc) && isArray(val) ? __spreadArray(__spreadArray([], __read(acc)), __read(val)) : acc;
}, []);
ret[k] = mergeWithRule({ currentRule: currentRule_1, a: v, b: b_1 });
break;
}
});
return ret;
});
return ret.concat(b.filter(function (o) { return !bAllMatches.includes(o); }));
}
function mergeIndividualRule(_a) {
var currentRule = _a.currentRule, a = _a.a, b = _a.b;
// What if there's no match?
switch (currentRule) {
case types_1.CustomizeRule.Append:
return a.concat(b);
case types_1.CustomizeRule.Prepend:
return b.concat(a);
case types_1.CustomizeRule.Replace:
return b;
}
return a;
}
function last(arr) {
return arr[arr.length - 1];
}
function customizeObject(rules) {
return function (a, b, key) {
switch (rules[key]) {
case types_1.CustomizeRule.Prepend:
return merge_with_1["default"]([b, a], join_arrays_1["default"]());
case types_1.CustomizeRule.Replace:
return b;
case types_1.CustomizeRule.Append:
return merge_with_1["default"]([a, b], join_arrays_1["default"]());
}
};
}
exports.customizeObject = customizeObject;
//# sourceMappingURL=index.js.map

1
node_modules/webpack-merge/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

6
node_modules/webpack-merge/dist/join-arrays.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { Customize, Key } from "./types";
export default function joinArrays({ customizeArray, customizeObject, key, }?: {
customizeArray?: Customize;
customizeObject?: Customize;
key?: Key;
}): (a: any, b: any, k: Key) => any;

70
node_modules/webpack-merge/dist/join-arrays.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
exports.__esModule = true;
var clone_deep_1 = __importDefault(require("clone-deep"));
var merge_with_1 = __importDefault(require("./merge-with"));
var utils_1 = require("./utils");
var isArray = Array.isArray;
function joinArrays(_a) {
var _b = _a === void 0 ? {} : _a, customizeArray = _b.customizeArray, customizeObject = _b.customizeObject, key = _b.key;
return function _joinArrays(a, b, k) {
var newKey = key ? key + "." + k : k;
if (utils_1.isFunction(a) && utils_1.isFunction(b)) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return _joinArrays(a.apply(void 0, __spreadArray([], __read(args))), b.apply(void 0, __spreadArray([], __read(args))), k);
};
}
if (isArray(a) && isArray(b)) {
var customResult = customizeArray && customizeArray(a, b, newKey);
return customResult || __spreadArray(__spreadArray([], __read(a)), __read(b));
}
if (utils_1.isRegex(b)) {
return b;
}
if (utils_1.isPlainObject(a) && utils_1.isPlainObject(b)) {
var customResult = customizeObject && customizeObject(a, b, newKey);
return (customResult ||
merge_with_1["default"]([a, b], joinArrays({
customizeArray: customizeArray,
customizeObject: customizeObject,
key: newKey
})));
}
if (utils_1.isPlainObject(b)) {
return clone_deep_1["default"](b);
}
if (isArray(b)) {
return __spreadArray([], __read(b));
}
return b;
};
}
exports["default"] = joinArrays;
//# sourceMappingURL=join-arrays.js.map

1
node_modules/webpack-merge/dist/join-arrays.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"join-arrays.js","sourceRoot":"","sources":["../src/join-arrays.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AAEnC,4DAAqC;AACrC,iCAA6D;AAE7D,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAE9B,SAAwB,UAAU,CAAC,EAQ7B;QAR6B,qBAQ/B,EAAE,KAAA,EAPJ,cAAc,oBAAA,EACd,eAAe,qBAAA,EACf,GAAG,SAAA;IAMH,OAAO,SAAS,WAAW,CAAC,CAAM,EAAE,CAAM,EAAE,CAAM;QAChD,IAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAI,GAAG,SAAI,CAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvC,IAAI,kBAAU,CAAC,CAAC,CAAC,IAAI,kBAAU,CAAC,CAAC,CAAC,EAAE;YAClC,OAAO;gBAAC,cAAc;qBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;oBAAd,yBAAc;;gBAAK,OAAA,WAAW,CAAC,CAAC,wCAAI,IAAI,KAAG,CAAC,wCAAI,IAAI,KAAG,CAAC,CAAC;YAAtC,CAAsC,CAAC;SACnE;QAED,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;YAC5B,IAAM,YAAY,GAAG,cAAc,IAAI,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;YAEpE,OAAO,YAAY,2CAAQ,CAAC,WAAK,CAAC,EAAC,CAAC;SACrC;QAED,IAAI,eAAO,CAAC,CAAC,CAAC,EAAE;YACd,OAAO,CAAC,CAAC;SACV;QAED,IAAI,qBAAa,CAAC,CAAC,CAAC,IAAI,qBAAa,CAAC,CAAC,CAAC,EAAE;YACxC,IAAM,YAAY,GAAG,eAAe,IAAI,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;YAEtE,OAAO,CACL,YAAY;gBACZ,uBAAS,CACP,CAAC,CAAC,EAAE,CAAC,CAAC,EACN,UAAU,CAAC;oBACT,cAAc,gBAAA;oBACd,eAAe,iBAAA;oBACf,GAAG,EAAE,MAAM;iBACZ,CAAC,CACH,CACF,CAAC;SACH;QAED,IAAI,qBAAa,CAAC,CAAC,CAAC,EAAE;YACpB,OAAO,uBAAS,CAAC,CAAC,CAAC,CAAC;SACrB;QAED,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;YACd,gCAAW,CAAC,GAAE;SACf;QAED,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;AACJ,CAAC;AApDD,gCAoDC"}

2
node_modules/webpack-merge/dist/merge-with.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function mergeWith(objects: object[], customizer: any): object;
export default mergeWith;

38
node_modules/webpack-merge/dist/merge-with.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
exports.__esModule = true;
function mergeWith(objects, customizer) {
var _a = __read(objects), first = _a[0], rest = _a.slice(1);
var ret = first;
rest.forEach(function (a) {
ret = mergeTo(ret, a, customizer);
});
return ret;
}
function mergeTo(a, b, customizer) {
var ret = {};
Object.keys(a)
.concat(Object.keys(b))
.forEach(function (k) {
var v = customizer(a[k], b[k], k);
ret[k] = typeof v === "undefined" ? a[k] : v;
});
return ret;
}
exports["default"] = mergeWith;
//# sourceMappingURL=merge-with.js.map

1
node_modules/webpack-merge/dist/merge-with.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"merge-with.js","sourceRoot":"","sources":["../src/merge-with.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,CAAC,OAAiB,EAAE,UAAU;IACxC,IAAA,KAAA,OAAmB,OAAO,CAAA,EAAzB,KAAK,QAAA,EAAK,IAAI,cAAW,CAAC;IACjC,IAAI,GAAG,GAAG,KAAK,CAAC;IAEhB,IAAI,CAAC,OAAO,CAAC,UAAC,CAAC;QACb,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU;IAC/B,IAAM,GAAG,GAAG,EAAE,CAAC;IAEf,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACtB,OAAO,CAAC,UAAC,CAAC;QACT,IAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEpC,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC;AAED,qBAAe,SAAS,CAAC"}

14
node_modules/webpack-merge/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export declare type Key = string;
export declare type Customize = (a: any, b: any, key: Key) => any;
export interface ICustomizeOptions {
customizeArray?: Customize;
customizeObject?: Customize;
}
export declare enum CustomizeRule {
Match = "match",
Merge = "merge",
Append = "append",
Prepend = "prepend",
Replace = "replace"
}
export declare type CustomizeRuleString = "match" | "merge" | "append" | "prepend" | "replace";

12
node_modules/webpack-merge/dist/types.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
exports.__esModule = true;
exports.CustomizeRule = void 0;
var CustomizeRule;
(function (CustomizeRule) {
CustomizeRule["Match"] = "match";
CustomizeRule["Merge"] = "merge";
CustomizeRule["Append"] = "append";
CustomizeRule["Prepend"] = "prepend";
CustomizeRule["Replace"] = "replace";
})(CustomizeRule = exports.CustomizeRule || (exports.CustomizeRule = {}));
//# sourceMappingURL=types.js.map

1
node_modules/webpack-merge/dist/types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AASA,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,gCAAe,CAAA;IACf,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;AACrB,CAAC,EANW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAMxB"}

2
node_modules/webpack-merge/dist/unique.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function mergeUnique(key: string, uniques: string[], getter: (a: object) => string): (a: [], b: [], k: string) => false | any[];
export default mergeUnique;

41
node_modules/webpack-merge/dist/unique.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
exports.__esModule = true;
function mergeUnique(key, uniques, getter) {
var uniquesSet = new Set(uniques);
return function (a, b, k) {
return (k === key) && Array.from(__spreadArray(__spreadArray([], __read(a)), __read(b)).map(function (it) { return ({ key: getter(it), value: it }); })
.map(function (_a) {
var key = _a.key, value = _a.value;
return ({ key: (uniquesSet.has(key) ? key : value), value: value });
})
.reduce(function (m, _a) {
var key = _a.key, value = _a.value;
m["delete"](key); // This is required to preserve backward compatible order of elements after a merge.
return m.set(key, value);
}, new Map())
.values());
};
}
exports["default"] = mergeUnique;
//# sourceMappingURL=unique.js.map

1
node_modules/webpack-merge/dist/unique.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"unique.js","sourceRoot":"","sources":["../src/unique.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,CAClB,GAAW,EACX,OAAiB,EACjB,MAA6B;IAE7B,IAAI,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,UAAC,CAAK,EAAE,CAAK,EAAE,CAAS;QAC7B,OAAA,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CACvB,uCAAI,CAAC,WAAK,CAAC,GACN,GAAG,CAAC,UAAC,EAAU,IAAK,OAAA,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,EAAhC,CAAgC,CAAC;aACrD,GAAG,CAAC,UAAC,EAAc;gBAAZ,GAAG,SAAA,EAAE,KAAK,WAAA;YAAO,OAAA,CAAC,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC;QAA3D,CAA2D,CAAC;aACpF,MAAM,CACH,UAAC,CAAC,EAAE,EAAa;gBAAX,GAAG,SAAA,EAAE,KAAK,WAAA;YACd,CAAC,CAAC,QAAM,CAAA,CAAC,GAAG,CAAC,CAAC,CAAC,oFAAoF;YACnG,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAC1B,CAAC,EACD,IAAI,GAAG,EAAY,CAAC;aACvB,MAAM,EAAE,CAAC;IAVhB,CAUgB,CAAA;AACpB,CAAC;AAED,qBAAe,WAAW,CAAC"}

17
node_modules/webpack-merge/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
declare function isRegex(o: any): boolean;
declare function isFunction(functionToCheck: any): any;
declare function isPlainObject(a: any): boolean;
declare function isUndefined(a: any): boolean;
/**
* According to Webpack docs, a "test" should be the following:
*
* - A string
* - A RegExp
* - A function
* - An array of conditions (may be nested)
* - An object of conditions (may be nested)
*
* https://webpack.js.org/configuration/module/#condition
*/
declare function isSameCondition(a: any, b: any): boolean;
export { isRegex, isFunction, isPlainObject, isUndefined, isSameCondition };

98
node_modules/webpack-merge/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,98 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
exports.__esModule = true;
exports.isSameCondition = exports.isUndefined = exports.isPlainObject = exports.isFunction = exports.isRegex = void 0;
var flat_1 = require("flat");
function isRegex(o) {
return o instanceof RegExp;
}
exports.isRegex = isRegex;
// https://stackoverflow.com/a/7356528/228885
function isFunction(functionToCheck) {
return (functionToCheck && {}.toString.call(functionToCheck) === "[object Function]");
}
exports.isFunction = isFunction;
function isPlainObject(a) {
if (a === null || Array.isArray(a)) {
return false;
}
return typeof a === "object";
}
exports.isPlainObject = isPlainObject;
function isUndefined(a) {
return typeof a === "undefined";
}
exports.isUndefined = isUndefined;
/**
* According to Webpack docs, a "test" should be the following:
*
* - A string
* - A RegExp
* - A function
* - An array of conditions (may be nested)
* - An object of conditions (may be nested)
*
* https://webpack.js.org/configuration/module/#condition
*/
function isSameCondition(a, b) {
var _a, _b;
if (!a || !b) {
return a === b;
}
if (typeof a === 'string' || typeof b === 'string' ||
isRegex(a) || isRegex(b) ||
isFunction(a) || isFunction(b)) {
return a.toString() === b.toString();
}
var entriesA = Object.entries(flat_1.flatten(a));
var entriesB = Object.entries(flat_1.flatten(b));
if (entriesA.length !== entriesB.length) {
return false;
}
for (var i = 0; i < entriesA.length; i++) {
entriesA[i][0] = entriesA[i][0].replace(/\b\d+\b/g, "[]");
entriesB[i][0] = entriesB[i][0].replace(/\b\d+\b/g, "[]");
}
function cmp(_a, _b) {
var _c = __read(_a, 2), k1 = _c[0], v1 = _c[1];
var _d = __read(_b, 2), k2 = _d[0], v2 = _d[1];
if (k1 < k2)
return -1;
if (k1 > k2)
return 1;
if (v1 < v2)
return -1;
if (v1 > v2)
return 1;
return 0;
}
;
entriesA.sort(cmp);
entriesB.sort(cmp);
if (entriesA.length !== entriesB.length) {
return false;
}
for (var i = 0; i < entriesA.length; i++) {
if (entriesA[i][0] !== entriesB[i][0] || ((_a = entriesA[i][1]) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = entriesB[i][1]) === null || _b === void 0 ? void 0 : _b.toString())) {
return false;
}
}
return true;
}
exports.isSameCondition = isSameCondition;
//# sourceMappingURL=utils.js.map

1
node_modules/webpack-merge/dist/utils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,6BAA+B;AAE/B,SAAS,OAAO,CAAC,CAAC;IAChB,OAAO,CAAC,YAAY,MAAM,CAAC;AAC7B,CAAC;AA4EQ,0BAAO;AA1EhB,6CAA6C;AAC7C,SAAS,UAAU,CAAC,eAAe;IACjC,OAAO,CACL,eAAe,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,mBAAmB,CAC7E,CAAC;AACJ,CAAC;AAqEiB,gCAAU;AAnE5B,SAAS,aAAa,CAAC,CAAC;IACtB,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAClC,OAAO,KAAK,CAAC;KACd;IAED,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC/B,CAAC;AA6D6B,sCAAa;AA3D3C,SAAS,WAAW,CAAC,CAAC;IACpB,OAAO,OAAO,CAAC,KAAK,WAAW,CAAC;AAClC,CAAC;AAyD4C,kCAAW;AAvDxD;;;;;;;;;;GAUG;AACH,SAAS,eAAe,CAAC,CAAC,EAAE,CAAC;;IAC3B,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,CAAC;KAChB;IACD,IACE,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ;QAC9C,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC;QACxB,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,EAC9B;QACA,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;KACtC;IAED,IAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,cAAO,CAAc,CAAC,CAAC,CAAC,CAAC;IACzD,IAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,cAAO,CAAc,CAAC,CAAC,CAAC,CAAC;IACzD,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC1D,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;KAC3D;IAED,SAAS,GAAG,CAAC,EAAQ,EAAE,EAAQ;YAAlB,KAAA,aAAQ,EAAP,EAAE,QAAA,EAAE,EAAE,QAAA;YAAG,KAAA,aAAQ,EAAP,EAAE,QAAA,EAAE,EAAE,QAAA;QAC5B,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC;QACtB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IAAA,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEnB,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,MAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0CAAE,QAAQ,EAAE,OAAK,MAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0CAAE,QAAQ,EAAE,CAAA,EAAE;YAClG,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAEyD,0CAAe"}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2018, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,106 @@
# clone-deep [![NPM version](https://img.shields.io/npm/v/clone-deep.svg?style=flat)](https://www.npmjs.com/package/clone-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/clone-deep.svg?style=flat)](https://npmjs.org/package/clone-deep) [![NPM total downloads](https://img.shields.io/npm/dt/clone-deep.svg?style=flat)](https://npmjs.org/package/clone-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/clone-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/clone-deep)
> Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save clone-deep
```
## Usage
```js
const cloneDeep = require('clone-deep');
let obj = { a: 'b' };
let arr = [obj];
let copy = cloneDeep(arr);
obj.c = 'd';
console.log(copy);
//=> [{ a: 'b' }]
console.log(arr);
//=> [{ a: 'b', c: 'd' }]
```
## Heads up!
The last argument specifies whether or not to clone instances (objects that are from a custom class or are not created by the `Object` constructor. This value may be `true` or the function use for cloning instances.
When an `instanceClone` function is provided, it will be invoked to clone objects that are not "plain" objects (as defined by [isPlainObject](#isPlainObject)`isPlainObject`). If `instanceClone` is not specified, this library will not attempt to clone non-plain objects, and will simply copy the object reference.
## Attribution
Initially based on [mout's](https://github.com/mout/mout) implementation of deepClone.
## About
<details>
<summary><strong>Contributing</strong></summary>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
</details>
<details>
<summary><strong>Running Tests</strong></summary>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
</details>
<details>
<summary><strong>Building docs</strong></summary>
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
</details>
### Related projects
You might also be interested in these projects:
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
* [shallow-clone](https://www.npmjs.com/package/shallow-clone): Creates a shallow clone of any JavaScript value. | [homepage](https://github.com/jonschlinkert/shallow-clone "Creates a shallow clone of any JavaScript value.")
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 46 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [yujunlong2000](https://github.com/yujunlong2000) |
### Author
**Jon Schlinkert**
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
### License
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on November 21, 2018._

View File

@@ -0,0 +1,49 @@
'use strict';
/**
* Module dependenices
*/
const clone = require('shallow-clone');
const typeOf = require('kind-of');
const isPlainObject = require('is-plain-object');
function cloneDeep(val, instanceClone) {
switch (typeOf(val)) {
case 'object':
return cloneObjectDeep(val, instanceClone);
case 'array':
return cloneArrayDeep(val, instanceClone);
default: {
return clone(val);
}
}
}
function cloneObjectDeep(val, instanceClone) {
if (typeof instanceClone === 'function') {
return instanceClone(val);
}
if (instanceClone || isPlainObject(val)) {
const res = new val.constructor();
for (let key in val) {
res[key] = cloneDeep(val[key], instanceClone);
}
return res;
}
return val;
}
function cloneArrayDeep(val, instanceClone) {
const res = new val.constructor(val.length);
for (let i = 0; i < val.length; i++) {
res[i] = cloneDeep(val[i], instanceClone);
}
return res;
}
/**
* Expose `cloneDeep`
*/
module.exports = cloneDeep;

View File

@@ -0,0 +1,81 @@
{
"name": "clone-deep",
"description": "Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.",
"version": "4.0.1",
"homepage": "https://github.com/jonschlinkert/clone-deep",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"repository": "jonschlinkert/clone-deep",
"bugs": {
"url": "https://github.com/jonschlinkert/clone-deep/issues"
},
"license": "MIT",
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=6"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
"is-plain-object": "^2.0.4",
"kind-of": "^6.0.2",
"shallow-clone": "^3.0.0"
},
"devDependencies": {
"gulp-format-md": "^2.0.0",
"mocha": "^5.2.0"
},
"keywords": [
"array",
"assign",
"buffer",
"clamped",
"clone",
"clone-array",
"clone-array-deep",
"clone-buffer",
"clone-date",
"clone-deep",
"clone-map",
"clone-object",
"clone-object-deep",
"clone-reg-exp",
"clone-regex",
"clone-regexp",
"clone-set",
"date",
"deep",
"extend",
"mixin",
"mixin-object",
"object",
"regex",
"regexp",
"shallow",
"symbol"
],
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"is-plain-object",
"isobject",
"kind-of",
"shallow-clone"
]
},
"lint": {
"reflinks": true
}
}
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,104 @@
# is-plain-object [![NPM version](https://img.shields.io/npm/v/is-plain-object.svg?style=flat)](https://www.npmjs.com/package/is-plain-object) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![NPM total downloads](https://img.shields.io/npm/dt/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-plain-object.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-plain-object)
> Returns true if an object was created by the `Object` constructor.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save is-plain-object
```
Use [isobject](https://github.com/jonschlinkert/isobject) if you only want to check if the value is an object and not an array or null.
## Usage
```js
var isPlainObject = require('is-plain-object');
```
**true** when created by the `Object` constructor.
```js
isPlainObject(Object.create({}));
//=> true
isPlainObject(Object.create(Object.prototype));
//=> true
isPlainObject({foo: 'bar'});
//=> true
isPlainObject({});
//=> true
```
**false** when not created by the `Object` constructor.
```js
isPlainObject(1);
//=> false
isPlainObject(['foo', 'bar']);
//=> false
isPlainObject([]);
//=> false
isPlainObject(new Foo);
//=> false
isPlainObject(null);
//=> false
isPlainObject(Object.create(null));
//=> false
```
## About
### Related projects
* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.")
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 17 | [jonschlinkert](https://github.com/jonschlinkert) |
| 6 | [stevenvachon](https://github.com/stevenvachon) |
| 3 | [onokumus](https://github.com/onokumus) |
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 11, 2017._

View File

@@ -0,0 +1,5 @@
export = isPlainObject;
declare function isPlainObject(o: any): boolean;
declare namespace isPlainObject {}

View File

@@ -0,0 +1,37 @@
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
var isObject = require('isobject');
function isObjectObject(o) {
return isObject(o) === true
&& Object.prototype.toString.call(o) === '[object Object]';
}
module.exports = function isPlainObject(o) {
var ctor,prot;
if (isObjectObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (typeof ctor !== 'function') return false;
// If has modified prototype
prot = ctor.prototype;
if (isObjectObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
};

View File

@@ -0,0 +1,79 @@
{
"name": "is-plain-object",
"description": "Returns true if an object was created by the `Object` constructor.",
"version": "2.0.4",
"homepage": "https://github.com/jonschlinkert/is-plain-object",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
"Osman Nuri Okumuş (http://onokumus.com)",
"Steven Vachon (https://svachon.com)",
"(https://github.com/wtgtybhertgeghgtwtg)"
],
"repository": "jonschlinkert/is-plain-object",
"bugs": {
"url": "https://github.com/jonschlinkert/is-plain-object/issues"
},
"license": "MIT",
"files": [
"index.d.ts",
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"browserify": "browserify index.js --standalone isPlainObject | uglifyjs --compress --mangle -o browser/is-plain-object.js",
"test_browser": "mocha-phantomjs test/browser.html",
"test_node": "mocha",
"test": "npm run test_node && npm run browserify && npm run test_browser"
},
"dependencies": {
"isobject": "^3.0.1"
},
"devDependencies": {
"browserify": "^14.4.0",
"chai": "^4.0.2",
"gulp-format-md": "^1.0.0",
"mocha": "^3.4.2",
"mocha-phantomjs": "^4.1.0",
"phantomjs": "^2.1.7",
"uglify-js": "^3.0.24"
},
"keywords": [
"check",
"is",
"is-object",
"isobject",
"javascript",
"kind",
"kind-of",
"object",
"plain",
"type",
"typeof",
"value"
],
"types": "index.d.ts",
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"is-number",
"isobject",
"kind-of"
]
},
"lint": {
"reflinks": true
}
}
}

View File

@@ -0,0 +1,160 @@
# Release history
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
<details>
<summary><strong>Guiding Principles</strong></summary>
- Changelogs are for humans, not machines.
- There should be an entry for every single version.
- The same types of changes should be grouped.
- Versions and sections should be linkable.
- The latest version comes first.
- The release date of each versions is displayed.
- Mention whether you follow Semantic Versioning.
</details>
<details>
<summary><strong>Types of changes</strong></summary>
Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_):
- `Added` for new features.
- `Changed` for changes in existing functionality.
- `Deprecated` for soon-to-be removed features.
- `Removed` for now removed features.
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.
</details>
## [6.0.3] - 2020-01-16
- Merge pull request #31 for issue #30
## [6.0.0] - 2017-10-13
- refactor code to be more performant
- refactor benchmarks
## [5.1.0] - 2017-10-13
**Added**
- Merge pull request #15 from aretecode/patch-1
- adds support and tests for string & array iterators
**Changed**
- updates benchmarks
## [5.0.2] - 2017-08-02
- Merge pull request #14 from struct78/master
- Added `undefined` check
## [5.0.0] - 2017-06-21
- Merge pull request #12 from aretecode/iterator
- Set Iterator + Map Iterator
- streamline `isbuffer`, minor edits
## [4.0.0] - 2017-05-19
- Merge pull request #8 from tunnckoCore/master
- update deps
## [3.2.2] - 2017-05-16
- fix version
## [3.2.1] - 2017-05-16
- add browserify
## [3.2.0] - 2017-04-25
- Merge pull request #10 from ksheedlo/unrequire-buffer
- add `promise` support and tests
- Remove unnecessary `Buffer` check
## [3.1.0] - 2016-12-07
- Merge pull request #7 from laggingreflex/err
- add support for `error` and tests
- run update
## [3.0.4] - 2016-07-29
- move tests
- run update
## [3.0.3] - 2016-05-03
- fix prepublish script
- remove unused dep
## [3.0.0] - 2015-11-17
- add typed array support
- Merge pull request #5 from miguelmota/typed-arrays
- adds new tests
## [2.0.1] - 2015-08-21
- use `is-buffer` module
## [2.0.0] - 2015-05-31
- Create fallback for `Array.isArray` if used as a browser package
- Merge pull request #2 from dtothefp/patch-1
- Merge pull request #3 from pdehaan/patch-1
- Merge branch 'master' of https://github.com/chorks/kind-of into chorks-master
- optimizations, mostly date and regex
## [1.1.0] - 2015-02-09
- adds `buffer` support
- adds tests for `buffer`
## [1.0.0] - 2015-01-19
- update benchmarks
- optimizations based on benchmarks
## [0.1.2] - 2014-10-26
- return `typeof` value if it's not an object. very slight speed improvement
- use `.slice`
- adds benchmarks
## [0.1.0] - 2014-9-26
- first commit
[6.0.0]: https://github.com/jonschlinkert/kind-of/compare/5.1.0...6.0.0
[5.1.0]: https://github.com/jonschlinkert/kind-of/compare/5.0.2...5.1.0
[5.0.2]: https://github.com/jonschlinkert/kind-of/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/jonschlinkert/kind-of/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/jonschlinkert/kind-of/compare/4.0.0...5.0.0
[4.0.0]: https://github.com/jonschlinkert/kind-of/compare/3.2.2...4.0.0
[3.2.2]: https://github.com/jonschlinkert/kind-of/compare/3.2.1...3.2.2
[3.2.1]: https://github.com/jonschlinkert/kind-of/compare/3.2.0...3.2.1
[3.2.0]: https://github.com/jonschlinkert/kind-of/compare/3.1.0...3.2.0
[3.1.0]: https://github.com/jonschlinkert/kind-of/compare/3.0.4...3.1.0
[3.0.4]: https://github.com/jonschlinkert/kind-of/compare/3.0.3...3.0.4
[3.0.3]: https://github.com/jonschlinkert/kind-of/compare/3.0.0...3.0.3
[3.0.0]: https://github.com/jonschlinkert/kind-of/compare/2.0.1...3.0.0
[2.0.1]: https://github.com/jonschlinkert/kind-of/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/jonschlinkert/kind-of/compare/1.1.0...2.0.0
[1.1.0]: https://github.com/jonschlinkert/kind-of/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/jonschlinkert/kind-of/compare/0.1.2...1.0.0
[0.1.2]: https://github.com/jonschlinkert/kind-of/compare/0.1.0...0.1.2
[0.1.0]: https://github.com/jonschlinkert/kind-of/commit/2fae09b0b19b1aadb558e9be39f0c3ef6034eb87
[Unreleased]: https://github.com/jonschlinkert/kind-of/compare/0.1.2...HEAD
[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,367 @@
# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of)
> Get the native type of a value.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save kind-of
```
Install with [bower](https://bower.io/)
```sh
$ bower install kind-of --save
```
## Why use this?
1. [it's fast](#benchmarks) | [optimizations](#optimizations)
2. [better type checking](#better-type-checking)
## Usage
> es5, es6, and browser ready
```js
var kindOf = require('kind-of');
kindOf(undefined);
//=> 'undefined'
kindOf(null);
//=> 'null'
kindOf(true);
//=> 'boolean'
kindOf(false);
//=> 'boolean'
kindOf(new Buffer(''));
//=> 'buffer'
kindOf(42);
//=> 'number'
kindOf('str');
//=> 'string'
kindOf(arguments);
//=> 'arguments'
kindOf({});
//=> 'object'
kindOf(Object.create(null));
//=> 'object'
kindOf(new Test());
//=> 'object'
kindOf(new Date());
//=> 'date'
kindOf([1, 2, 3]);
//=> 'array'
kindOf(/foo/);
//=> 'regexp'
kindOf(new RegExp('foo'));
//=> 'regexp'
kindOf(new Error('error'));
//=> 'error'
kindOf(function () {});
//=> 'function'
kindOf(function * () {});
//=> 'generatorfunction'
kindOf(Symbol('str'));
//=> 'symbol'
kindOf(new Map());
//=> 'map'
kindOf(new WeakMap());
//=> 'weakmap'
kindOf(new Set());
//=> 'set'
kindOf(new WeakSet());
//=> 'weakset'
kindOf(new Int8Array());
//=> 'int8array'
kindOf(new Uint8Array());
//=> 'uint8array'
kindOf(new Uint8ClampedArray());
//=> 'uint8clampedarray'
kindOf(new Int16Array());
//=> 'int16array'
kindOf(new Uint16Array());
//=> 'uint16array'
kindOf(new Int32Array());
//=> 'int32array'
kindOf(new Uint32Array());
//=> 'uint32array'
kindOf(new Float32Array());
//=> 'float32array'
kindOf(new Float64Array());
//=> 'float64array'
```
## Benchmarks
Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of).
```bash
# arguments (32 bytes)
kind-of x 17,024,098 ops/sec ±1.90% (86 runs sampled)
lib-type-of x 11,926,235 ops/sec ±1.34% (83 runs sampled)
lib-typeof x 9,245,257 ops/sec ±1.22% (87 runs sampled)
fastest is kind-of (by 161% avg)
# array (22 bytes)
kind-of x 17,196,492 ops/sec ±1.07% (88 runs sampled)
lib-type-of x 8,838,283 ops/sec ±1.02% (87 runs sampled)
lib-typeof x 8,677,848 ops/sec ±0.87% (87 runs sampled)
fastest is kind-of (by 196% avg)
# boolean (24 bytes)
kind-of x 16,841,600 ops/sec ±1.10% (86 runs sampled)
lib-type-of x 8,096,787 ops/sec ±0.95% (87 runs sampled)
lib-typeof x 8,423,345 ops/sec ±1.15% (86 runs sampled)
fastest is kind-of (by 204% avg)
# buffer (38 bytes)
kind-of x 14,848,060 ops/sec ±1.05% (86 runs sampled)
lib-type-of x 3,671,577 ops/sec ±1.49% (87 runs sampled)
lib-typeof x 8,360,236 ops/sec ±1.24% (86 runs sampled)
fastest is kind-of (by 247% avg)
# date (30 bytes)
kind-of x 16,067,761 ops/sec ±1.58% (86 runs sampled)
lib-type-of x 8,954,436 ops/sec ±1.40% (87 runs sampled)
lib-typeof x 8,488,307 ops/sec ±1.51% (84 runs sampled)
fastest is kind-of (by 184% avg)
# error (36 bytes)
kind-of x 9,634,090 ops/sec ±1.12% (89 runs sampled)
lib-type-of x 7,735,624 ops/sec ±1.32% (86 runs sampled)
lib-typeof x 7,442,160 ops/sec ±1.11% (90 runs sampled)
fastest is kind-of (by 127% avg)
# function (34 bytes)
kind-of x 10,031,494 ops/sec ±1.27% (86 runs sampled)
lib-type-of x 9,502,757 ops/sec ±1.17% (89 runs sampled)
lib-typeof x 8,278,985 ops/sec ±1.08% (88 runs sampled)
fastest is kind-of (by 113% avg)
# null (24 bytes)
kind-of x 18,159,808 ops/sec ±1.92% (86 runs sampled)
lib-type-of x 12,927,635 ops/sec ±1.01% (88 runs sampled)
lib-typeof x 7,958,234 ops/sec ±1.21% (89 runs sampled)
fastest is kind-of (by 174% avg)
# number (22 bytes)
kind-of x 17,846,779 ops/sec ±0.91% (85 runs sampled)
lib-type-of x 3,316,636 ops/sec ±1.19% (86 runs sampled)
lib-typeof x 2,329,477 ops/sec ±2.21% (85 runs sampled)
fastest is kind-of (by 632% avg)
# object-plain (47 bytes)
kind-of x 7,085,155 ops/sec ±1.05% (88 runs sampled)
lib-type-of x 8,870,930 ops/sec ±1.06% (83 runs sampled)
lib-typeof x 8,716,024 ops/sec ±1.05% (87 runs sampled)
fastest is lib-type-of (by 112% avg)
# regex (25 bytes)
kind-of x 14,196,052 ops/sec ±1.65% (84 runs sampled)
lib-type-of x 9,554,164 ops/sec ±1.25% (88 runs sampled)
lib-typeof x 8,359,691 ops/sec ±1.07% (87 runs sampled)
fastest is kind-of (by 158% avg)
# string (33 bytes)
kind-of x 16,131,428 ops/sec ±1.41% (85 runs sampled)
lib-type-of x 7,273,172 ops/sec ±1.05% (87 runs sampled)
lib-typeof x 7,382,635 ops/sec ±1.17% (85 runs sampled)
fastest is kind-of (by 220% avg)
# symbol (34 bytes)
kind-of x 17,011,537 ops/sec ±1.24% (86 runs sampled)
lib-type-of x 3,492,454 ops/sec ±1.23% (89 runs sampled)
lib-typeof x 7,471,235 ops/sec ±2.48% (87 runs sampled)
fastest is kind-of (by 310% avg)
# template-strings (36 bytes)
kind-of x 15,434,250 ops/sec ±1.46% (83 runs sampled)
lib-type-of x 7,157,907 ops/sec ±0.97% (87 runs sampled)
lib-typeof x 7,517,986 ops/sec ±0.92% (86 runs sampled)
fastest is kind-of (by 210% avg)
# undefined (29 bytes)
kind-of x 19,167,115 ops/sec ±1.71% (87 runs sampled)
lib-type-of x 15,477,740 ops/sec ±1.63% (85 runs sampled)
lib-typeof x 19,075,495 ops/sec ±1.17% (83 runs sampled)
fastest is lib-typeof,kind-of
```
## Optimizations
In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library:
1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot.
2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it.
3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'`
4. There is no reason to make the code in a microlib as terse as possible, just to win points for making it shorter. It's always better to favor performant code over terse code. You will always only be using a single `require()` statement to use the library anyway, regardless of how the code is written.
## Better type checking
kind-of seems to be more consistently "correct" than other type checking libs I've looked at. For example, here are some differing results from other popular libs:
### [typeof](https://github.com/CodingFu/typeof) lib
Incorrectly identifies instances of custom constructors (pretty common):
```js
var typeOf = require('typeof');
function Test() {}
console.log(typeOf(new Test()));
//=> 'test'
```
Returns `object` instead of `arguments`:
```js
function foo() {
console.log(typeOf(arguments)) //=> 'object'
}
foo();
```
### [type-of](https://github.com/ForbesLindesay/type-of) lib
Incorrectly returns `object` for generator functions, buffers, `Map`, `Set`, `WeakMap` and `WeakSet`:
```js
function * foo() {}
console.log(typeOf(foo));
//=> 'object'
console.log(typeOf(new Buffer('')));
//=> 'object'
console.log(typeOf(new Map()));
//=> 'object'
console.log(typeOf(new Set()));
//=> 'object'
console.log(typeOf(new WeakMap()));
//=> 'object'
console.log(typeOf(new WeakSet()));
//=> 'object'
```
## About
<details>
<summary><strong>Contributing</strong></summary>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
</details>
<details>
<summary><strong>Running Tests</strong></summary>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
</details>
<details>
<summary><strong>Building docs</strong></summary>
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
</details>
### Related projects
You might also be interested in these projects:
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/micromatch/is-glob) | [homepage](https://github.com/micromatch/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
* [is-number](https://www.npmjs.com/package/is-number): Returns true if a number or string value is a finite number. Useful for regex… [more](https://github.com/jonschlinkert/is-number) | [homepage](https://github.com/jonschlinkert/is-number "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.")
* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ")
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 102 | [jonschlinkert](https://github.com/jonschlinkert) |
| 3 | [aretecode](https://github.com/aretecode) |
| 2 | [miguelmota](https://github.com/miguelmota) |
| 1 | [doowb](https://github.com/doowb) |
| 1 | [dtothefp](https://github.com/dtothefp) |
| 1 | [ianstormtaylor](https://github.com/ianstormtaylor) |
| 1 | [ksheedlo](https://github.com/ksheedlo) |
| 1 | [pdehaan](https://github.com/pdehaan) |
| 1 | [laggingreflex](https://github.com/laggingreflex) |
| 1 | [tunnckoCore](https://github.com/tunnckoCore) |
| 1 | [xiaofen9](https://github.com/xiaofen9) |
### Author
**Jon Schlinkert**
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
### License
Copyright © 2020, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on January 16, 2020._

View File

@@ -0,0 +1,129 @@
var toString = Object.prototype.toString;
module.exports = function kindOf(val) {
if (val === void 0) return 'undefined';
if (val === null) return 'null';
var type = typeof val;
if (type === 'boolean') return 'boolean';
if (type === 'string') return 'string';
if (type === 'number') return 'number';
if (type === 'symbol') return 'symbol';
if (type === 'function') {
return isGeneratorFn(val) ? 'generatorfunction' : 'function';
}
if (isArray(val)) return 'array';
if (isBuffer(val)) return 'buffer';
if (isArguments(val)) return 'arguments';
if (isDate(val)) return 'date';
if (isError(val)) return 'error';
if (isRegexp(val)) return 'regexp';
switch (ctorName(val)) {
case 'Symbol': return 'symbol';
case 'Promise': return 'promise';
// Set, Map, WeakSet, WeakMap
case 'WeakMap': return 'weakmap';
case 'WeakSet': return 'weakset';
case 'Map': return 'map';
case 'Set': return 'set';
// 8-bit typed arrays
case 'Int8Array': return 'int8array';
case 'Uint8Array': return 'uint8array';
case 'Uint8ClampedArray': return 'uint8clampedarray';
// 16-bit typed arrays
case 'Int16Array': return 'int16array';
case 'Uint16Array': return 'uint16array';
// 32-bit typed arrays
case 'Int32Array': return 'int32array';
case 'Uint32Array': return 'uint32array';
case 'Float32Array': return 'float32array';
case 'Float64Array': return 'float64array';
}
if (isGeneratorObj(val)) {
return 'generator';
}
// Non-plain objects
type = toString.call(val);
switch (type) {
case '[object Object]': return 'object';
// iterators
case '[object Map Iterator]': return 'mapiterator';
case '[object Set Iterator]': return 'setiterator';
case '[object String Iterator]': return 'stringiterator';
case '[object Array Iterator]': return 'arrayiterator';
}
// other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
};
function ctorName(val) {
return typeof val.constructor === 'function' ? val.constructor.name : null;
}
function isArray(val) {
if (Array.isArray) return Array.isArray(val);
return val instanceof Array;
}
function isError(val) {
return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
}
function isDate(val) {
if (val instanceof Date) return true;
return typeof val.toDateString === 'function'
&& typeof val.getDate === 'function'
&& typeof val.setDate === 'function';
}
function isRegexp(val) {
if (val instanceof RegExp) return true;
return typeof val.flags === 'string'
&& typeof val.ignoreCase === 'boolean'
&& typeof val.multiline === 'boolean'
&& typeof val.global === 'boolean';
}
function isGeneratorFn(name, val) {
return ctorName(name) === 'GeneratorFunction';
}
function isGeneratorObj(val) {
return typeof val.throw === 'function'
&& typeof val.return === 'function'
&& typeof val.next === 'function';
}
function isArguments(val) {
try {
if (typeof val.length === 'number' && typeof val.callee === 'function') {
return true;
}
} catch (err) {
if (err.message.indexOf('callee') !== -1) {
return true;
}
}
return false;
}
/**
* If you need to support Safari 5-7 (8-10 yr-old browser),
* take a look at https://github.com/feross/is-buffer
*/
function isBuffer(val) {
if (val.constructor && typeof val.constructor.isBuffer === 'function') {
return val.constructor.isBuffer(val);
}
return false;
}

View File

@@ -0,0 +1,88 @@
{
"name": "kind-of",
"description": "Get the native type of a value.",
"version": "6.0.3",
"homepage": "https://github.com/jonschlinkert/kind-of",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"David Fox-Powell (https://dtothefp.github.io/me)",
"James (https://twitter.com/aretecode)",
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
"Ken Sheedlo (kensheedlo.com)",
"laggingreflex (https://github.com/laggingreflex)",
"Miguel Mota (https://miguelmota.com)",
"Peter deHaan (http://about.me/peterdehaan)",
"tunnckoCore (https://i.am.charlike.online)"
],
"repository": "jonschlinkert/kind-of",
"bugs": {
"url": "https://github.com/jonschlinkert/kind-of/issues"
},
"license": "MIT",
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha",
"prepublish": "browserify -o browser.js -e index.js -s index --bare"
},
"devDependencies": {
"benchmarked": "^2.0.0",
"browserify": "^14.4.0",
"gulp-format-md": "^1.0.0",
"mocha": "^4.0.1",
"write": "^1.0.3"
},
"keywords": [
"arguments",
"array",
"boolean",
"check",
"date",
"function",
"is",
"is-type",
"is-type-of",
"kind",
"kind-of",
"number",
"object",
"of",
"regexp",
"string",
"test",
"type",
"type-of",
"typeof",
"types"
],
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"related": {
"list": [
"is-glob",
"is-number",
"is-primitive"
]
},
"reflinks": [
"type-of",
"typeof",
"verb"
]
}
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015-present, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,153 @@
# shallow-clone [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/shallow-clone.svg?style=flat)](https://www.npmjs.com/package/shallow-clone) [![NPM monthly downloads](https://img.shields.io/npm/dm/shallow-clone.svg?style=flat)](https://npmjs.org/package/shallow-clone) [![NPM total downloads](https://img.shields.io/npm/dt/shallow-clone.svg?style=flat)](https://npmjs.org/package/shallow-clone) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/shallow-clone.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/shallow-clone)
> Creates a shallow clone of any JavaScript value.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save shallow-clone
```
## Usage
```js
const clone = require('shallow-clone');
```
**Supports**
* array buffers
* arrays
* buffers
* dates
* errors
* float32 arrays
* float64 arrays
* int16 arrays
* int32 arrays
* int8 arrays
* maps
* objects
* primitives
* regular expressions
* sets
* symbols
* uint16 arrays
* uint32 arrays
* uint8 arrays
* uint8clamped arrays
## Arrays
By default, only the array itself is cloned (shallow), use [clone-deep](https://github.com/jonschlinkert/clone-deep) if you also need the elements in the array to be cloned.
```js
const arr = [{ a: 0 }, { b: 1 }];
const foo = clone(arr);
// foo => [{ 'a': 0 }, { 'b': 1 }]
// array is cloned
assert(actual === expected); // false
// array elements are not
assert.deepEqual(actual[0], expected[0]); // true
```
## Objects
Only the object is shallow cloned, use [clone-deep](https://github.com/jonschlinkert/clone-deep) if you also need the values in the object to be cloned.
```js
console.log(clone({ a: 1, b: 2, c: 3 }));
//=> {a: 1, b: 2, c: 3 }
```
## RegExp
Clones regular expressions and flags, and preserves the `.lastIndex`.
```js
const regex = clone(/foo/g); //=> /foo/g
// you can manually reset lastIndex if necessary
regex.lastIndex = 0;
```
## Primitives
Simply returns primitives unchanged.
```js
clone(0); //=> 0
clone('foo'); //=> 'foo'
```
## About
<details>
<summary><strong>Contributing</strong></summary>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
</details>
<details>
<summary><strong>Running Tests</strong></summary>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
</details>
<details>
<summary><strong>Building docs</strong></summary>
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
</details>
### Related projects
You might also be interested in these projects:
* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects to a target object. Returns the target object.")
* [clone-deep](https://www.npmjs.com/package/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. | [homepage](https://github.com/jonschlinkert/clone-deep "Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.")
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 20 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [doowb](https://github.com/doowb) |
| 1 | [jakub-g](https://github.com/jakub-g) |
### Author
**Jon Schlinkert**
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
### License
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 15, 2019._

View File

@@ -0,0 +1,83 @@
/*!
* shallow-clone <https://github.com/jonschlinkert/shallow-clone>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
const valueOf = Symbol.prototype.valueOf;
const typeOf = require('kind-of');
function clone(val, deep) {
switch (typeOf(val)) {
case 'array':
return val.slice();
case 'object':
return Object.assign({}, val);
case 'date':
return new val.constructor(Number(val));
case 'map':
return new Map(val);
case 'set':
return new Set(val);
case 'buffer':
return cloneBuffer(val);
case 'symbol':
return cloneSymbol(val);
case 'arraybuffer':
return cloneArrayBuffer(val);
case 'float32array':
case 'float64array':
case 'int16array':
case 'int32array':
case 'int8array':
case 'uint16array':
case 'uint32array':
case 'uint8clampedarray':
case 'uint8array':
return cloneTypedArray(val);
case 'regexp':
return cloneRegExp(val);
case 'error':
return Object.create(val);
default: {
return val;
}
}
}
function cloneRegExp(val) {
const flags = val.flags !== void 0 ? val.flags : (/\w+$/.exec(val) || void 0);
const re = new val.constructor(val.source, flags);
re.lastIndex = val.lastIndex;
return re;
}
function cloneArrayBuffer(val) {
const res = new val.constructor(val.byteLength);
new Uint8Array(res).set(new Uint8Array(val));
return res;
}
function cloneTypedArray(val, deep) {
return new val.constructor(val.buffer, val.byteOffset, val.length);
}
function cloneBuffer(val) {
const len = val.length;
const buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);
val.copy(buf);
return buf;
}
function cloneSymbol(val) {
return valueOf ? Object(valueOf.call(val)) : {};
}
/**
* Expose `clone`
*/
module.exports = clone;

View File

@@ -0,0 +1,64 @@
{
"name": "shallow-clone",
"description": "Creates a shallow clone of any JavaScript value.",
"version": "3.0.1",
"homepage": "https://github.com/jonschlinkert/shallow-clone",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"Brian Woodward (https://twitter.com/doowb)",
"Jon Schlinkert (http://twitter.com/jonschlinkert)"
],
"repository": "jonschlinkert/shallow-clone",
"bugs": {
"url": "https://github.com/jonschlinkert/shallow-clone/issues"
},
"license": "MIT",
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=8"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
"kind-of": "^6.0.2"
},
"devDependencies": {
"gulp-format-md": "^2.0.0",
"mocha": "^6.1.3"
},
"keywords": [
"array",
"clone",
"copy",
"extend",
"mixin",
"object",
"primitive",
"shallow"
],
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"related": {
"list": [
"assign-deep",
"clone-deep",
"is-plain-object",
"kind-of"
]
}
}
}

60
node_modules/webpack-merge/package.json generated vendored Normal file
View File

@@ -0,0 +1,60 @@
{
"name": "webpack-merge",
"description": "Variant of merge that's useful for webpack configuration",
"author": "Juho Vepsalainen <bebraw@gmail.com>",
"version": "5.10.0",
"scripts": {
"build": "tsc",
"format": "prettier . --write --ignore-path .gitignore",
"start": "tsdx watch",
"test": "tsdx test",
"prepare": "npm run build"
},
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"clone-deep": "^4.0.1",
"flat": "^5.0.2",
"wildcard": "^2.0.0"
},
"devDependencies": {
"@types/estree": "0.0.48",
"@types/flat": "^5.0.3",
"husky": "^6.0.0",
"prettier": "^2.3.1",
"tsdx": "^0.14.1",
"tslib": "^2.2.0",
"typescript": "^4.3.2",
"webpack": "^5.38.1"
},
"repository": {
"type": "git",
"url": "https://github.com/survivejs/webpack-merge.git"
},
"homepage": "https://github.com/survivejs/webpack-merge",
"bugs": {
"url": "https://github.com/survivejs/webpack-merge/issues"
},
"keywords": [
"webpack",
"merge"
],
"engines": {
"node": ">=10.0.0"
},
"jest": {
"collectCoverage": true,
"collectCoverageFrom": [
"dist/*.js"
]
},
"license": "MIT",
"husky": {
"hooks": {
"pre-commit": "npm run test"
}
}
}