Fix bin/publish: copy docs.dist from project root

Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 02:08:33 +00:00
commit f6fac6c4bc
79758 changed files with 10547827 additions and 0 deletions

5
node_modules/collect.js/src/methods/all.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function all() {
return this.items;
};

15
node_modules/collect.js/src/methods/average.js generated vendored Executable file
View File

@@ -0,0 +1,15 @@
'use strict';
const { isFunction } = require('../helpers/is');
module.exports = function average(key) {
if (key === undefined) {
return this.sum() / this.items.length;
}
if (isFunction(key)) {
return new this.constructor(this.items).sum(key) / this.items.length;
}
return new this.constructor(this.items).pluck(key).sum() / this.items.length;
};

5
node_modules/collect.js/src/methods/avg.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
const average = require('./average');
module.exports = average;

32
node_modules/collect.js/src/methods/chunk.js generated vendored Executable file
View File

@@ -0,0 +1,32 @@
'use strict';
module.exports = function chunk(size) {
const chunks = [];
let index = 0;
if (Array.isArray(this.items)) {
do {
const items = this.items.slice(index, index + size);
const collection = new this.constructor(items);
chunks.push(collection);
index += size;
} while (index < this.items.length);
} else if (typeof this.items === 'object') {
const keys = Object.keys(this.items);
do {
const keysOfChunk = keys.slice(index, index + size);
const collection = new this.constructor({});
keysOfChunk.forEach(key => collection.put(key, this.items[key]));
chunks.push(collection);
index += size;
} while (index < keys.length);
} else {
chunks.push(new this.constructor([this.items]));
}
return new this.constructor(chunks);
};

5
node_modules/collect.js/src/methods/collapse.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function collapse() {
return new this.constructor([].concat(...this.items));
};

29
node_modules/collect.js/src/methods/combine.js generated vendored Executable file
View File

@@ -0,0 +1,29 @@
'use strict';
module.exports = function combine(array) {
let values = array;
if (values instanceof this.constructor) {
values = array.all();
}
const collection = {};
if (Array.isArray(this.items) && Array.isArray(values)) {
this.items.forEach((key, iterator) => {
collection[key] = values[iterator];
});
} else if (typeof this.items === 'object' && typeof values === 'object') {
Object.keys(this.items).forEach((key, index) => {
collection[this.items[key]] = values[Object.keys(values)[index]];
});
} else if (Array.isArray(this.items)) {
collection[this.items[0]] = values;
} else if (typeof this.items === 'string' && Array.isArray(values)) {
[collection[this.items]] = values;
} else if (typeof this.items === 'string') {
collection[this.items] = values;
}
return new this.constructor(collection);
};

28
node_modules/collect.js/src/methods/concat.js generated vendored Executable file
View File

@@ -0,0 +1,28 @@
'use strict';
const clone = require('../helpers/clone');
module.exports = function concat(collectionOrArrayOrObject) {
let list = collectionOrArrayOrObject;
if (collectionOrArrayOrObject instanceof this.constructor) {
list = collectionOrArrayOrObject.all();
} else if (typeof collectionOrArrayOrObject === 'object') {
list = [];
Object.keys(collectionOrArrayOrObject).forEach((property) => {
list.push(collectionOrArrayOrObject[property]);
});
}
const collection = clone(this.items);
list.forEach((item) => {
if (typeof item === 'object') {
Object.keys(item).forEach(key => collection.push(item[key]));
} else {
collection.push(item);
}
});
return new this.constructor(collection);
};

29
node_modules/collect.js/src/methods/contains.js generated vendored Executable file
View File

@@ -0,0 +1,29 @@
'use strict';
const values = require('../helpers/values');
const { isFunction } = require('../helpers/is');
module.exports = function contains(key, value) {
if (value !== undefined) {
if (Array.isArray(this.items)) {
return this.items
.filter(items => items[key] !== undefined && items[key] === value)
.length > 0;
}
return this.items[key] !== undefined && this.items[key] === value;
}
if (isFunction(key)) {
return (this.items.filter((item, index) => key(item, index)).length > 0);
}
if (Array.isArray(this.items)) {
return this.items.indexOf(key) !== -1;
}
const keysAndValues = values(this.items);
keysAndValues.push(...Object.keys(this.items));
return keysAndValues.indexOf(key) !== -1;
};

5
node_modules/collect.js/src/methods/containsOneItem.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function containsOneItem() {
return this.count() === 1;
};

11
node_modules/collect.js/src/methods/count.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function count() {
let arrayLength = 0;
if (Array.isArray(this.items)) {
arrayLength = this.items.length;
}
return Math.max(Object.keys(this.items).length, arrayLength);
};

7
node_modules/collect.js/src/methods/countBy.js generated vendored Executable file
View File

@@ -0,0 +1,7 @@
'use strict';
module.exports = function countBy(fn = value => value) {
return new this.constructor(this.items)
.groupBy(fn)
.map(value => value.count());
};

30
node_modules/collect.js/src/methods/crossJoin.js generated vendored Executable file
View File

@@ -0,0 +1,30 @@
'use strict';
module.exports = function crossJoin(...values) {
function join(collection, constructor, args) {
let current = args[0];
if (current instanceof constructor) {
current = current.all();
}
const rest = args.slice(1);
const last = !rest.length;
let result = [];
for (let i = 0; i < current.length; i += 1) {
const collectionCopy = collection.slice();
collectionCopy.push(current[i]);
if (last) {
result.push(collectionCopy);
} else {
result = result.concat(join(collectionCopy, constructor, rest));
}
}
return result;
}
return new this.constructor(join([], this.constructor, [].concat([this.items], values)));
};

9
node_modules/collect.js/src/methods/dd.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
'use strict';
module.exports = function dd() {
this.dump();
if (typeof process !== 'undefined') {
process.exit(1);
}
};

15
node_modules/collect.js/src/methods/diff.js generated vendored Executable file
View File

@@ -0,0 +1,15 @@
'use strict';
module.exports = function diff(values) {
let valuesToDiff;
if (values instanceof this.constructor) {
valuesToDiff = values.all();
} else {
valuesToDiff = values;
}
const collection = this.items.filter(item => valuesToDiff.indexOf(item) === -1);
return new this.constructor(collection);
};

19
node_modules/collect.js/src/methods/diffAssoc.js generated vendored Executable file
View File

@@ -0,0 +1,19 @@
'use strict';
module.exports = function diffAssoc(values) {
let diffValues = values;
if (values instanceof this.constructor) {
diffValues = values.all();
}
const collection = {};
Object.keys(this.items).forEach((key) => {
if (diffValues[key] === undefined || diffValues[key] !== this.items[key]) {
collection[key] = this.items[key];
}
});
return new this.constructor(collection);
};

20
node_modules/collect.js/src/methods/diffKeys.js generated vendored Executable file
View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = function diffKeys(object) {
let objectToDiff;
if (object instanceof this.constructor) {
objectToDiff = object.all();
} else {
objectToDiff = object;
}
const objectKeys = Object.keys(objectToDiff);
const remainingKeys = Object.keys(this.items)
.filter(item => objectKeys.indexOf(item) === -1);
return new this.constructor(this.items).only(
remainingKeys,
);
};

9
node_modules/collect.js/src/methods/diffUsing.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
'use strict';
module.exports = function diffUsing(values, callback) {
const collection = this.items.filter(item => (
!(values && values.some(otherItem => callback(item, otherItem) === 0))
));
return new this.constructor(collection);
};

5
node_modules/collect.js/src/methods/doesntContain.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function contains(key, value) {
return !this.contains(key, value);
};

8
node_modules/collect.js/src/methods/dump.js generated vendored Executable file
View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = function dump() {
// eslint-disable-next-line
console.log(this);
return this;
};

38
node_modules/collect.js/src/methods/duplicates.js generated vendored Executable file
View File

@@ -0,0 +1,38 @@
'use strict';
module.exports = function duplicates() {
const occuredValues = [];
const duplicateValues = {};
const stringifiedValue = (value) => {
if (Array.isArray(value) || typeof value === 'object') {
return JSON.stringify(value);
}
return value;
};
if (Array.isArray(this.items)) {
this.items.forEach((value, index) => {
const valueAsString = stringifiedValue(value);
if (occuredValues.indexOf(valueAsString) === -1) {
occuredValues.push(valueAsString);
} else {
duplicateValues[index] = value;
}
});
} else if (typeof this.items === 'object') {
Object.keys(this.items).forEach((key) => {
const valueAsString = stringifiedValue(this.items[key]);
if (occuredValues.indexOf(valueAsString) === -1) {
occuredValues.push(valueAsString);
} else {
duplicateValues[key] = this.items[key];
}
});
}
return new this.constructor(duplicateValues);
};

24
node_modules/collect.js/src/methods/each.js generated vendored Executable file
View File

@@ -0,0 +1,24 @@
'use strict';
module.exports = function each(fn) {
let stop = false;
if (Array.isArray(this.items)) {
const { length } = this.items;
for (let index = 0; index < length && !stop; index += 1) {
stop = fn(this.items[index], index, this.items) === false;
}
} else {
const keys = Object.keys(this.items);
const { length } = keys;
for (let index = 0; index < length && !stop; index += 1) {
const key = keys[index];
stop = fn(this.items[key], key, this.items) === false;
}
}
return this;
};

9
node_modules/collect.js/src/methods/eachSpread.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
'use strict';
module.exports = function eachSpread(fn) {
this.each((values, key) => {
fn(...values, key);
});
return this;
};

9
node_modules/collect.js/src/methods/every.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
'use strict';
const values = require('../helpers/values');
module.exports = function every(fn) {
const items = values(this.items);
return items.every(fn);
};

24
node_modules/collect.js/src/methods/except.js generated vendored Executable file
View File

@@ -0,0 +1,24 @@
'use strict';
const variadic = require('../helpers/variadic');
module.exports = function except(...args) {
const properties = variadic(args);
if (Array.isArray(this.items)) {
const collection = this.items
.filter(item => properties.indexOf(item) === -1);
return new this.constructor(collection);
}
const collection = {};
Object.keys(this.items).forEach((property) => {
if (properties.indexOf(property) === -1) {
collection[property] = this.items[property];
}
});
return new this.constructor(collection);
};

60
node_modules/collect.js/src/methods/filter.js generated vendored Executable file
View File

@@ -0,0 +1,60 @@
'use strict';
function falsyValue(item) {
if (Array.isArray(item)) {
if (item.length) {
return false;
}
} else if (item !== undefined && item !== null
&& typeof item === 'object') {
if (Object.keys(item).length) {
return false;
}
} else if (item) {
return false;
}
return true;
}
function filterObject(func, items) {
const result = {};
Object.keys(items).forEach((key) => {
if (func) {
if (func(items[key], key)) {
result[key] = items[key];
}
} else if (!falsyValue(items[key])) {
result[key] = items[key];
}
});
return result;
}
function filterArray(func, items) {
if (func) {
return items.filter(func);
}
const result = [];
for (let i = 0; i < items.length; i += 1) {
const item = items[i];
if (!falsyValue(item)) {
result.push(item);
}
}
return result;
}
module.exports = function filter(fn) {
const func = fn || false;
let filteredItems = null;
if (Array.isArray(this.items)) {
filteredItems = filterArray(func, this.items);
} else {
filteredItems = filterObject(func, this.items);
}
return new this.constructor(filteredItems);
};

40
node_modules/collect.js/src/methods/first.js generated vendored Executable file
View File

@@ -0,0 +1,40 @@
'use strict';
const { isFunction } = require('../helpers/is');
module.exports = function first(fn, defaultValue) {
if (isFunction(fn)) {
const keys = Object.keys(this.items);
for (let i = 0; i < keys.length; i += 1) {
const key = keys[i];
const item = this.items[key];
if (fn(item, key)) {
return item;
}
}
if (isFunction(defaultValue)) {
return defaultValue();
}
return defaultValue;
}
if ((Array.isArray(this.items) && this.items.length) || (Object.keys(this.items).length)) {
if (Array.isArray(this.items)) {
return this.items[0];
}
const firstKey = Object.keys(this.items)[0];
return this.items[firstKey];
}
if (isFunction(defaultValue)) {
return defaultValue();
}
return defaultValue;
};

19
node_modules/collect.js/src/methods/firstOrFail.js generated vendored Executable file
View File

@@ -0,0 +1,19 @@
'use strict';
const { isFunction } = require('../helpers/is');
module.exports = function firstOrFail(key, operator, value) {
if (isFunction(key)) {
return this.first(key, () => {
throw new Error('Item not found.');
});
}
const collection = this.where(key, operator, value);
if (collection.isEmpty()) {
throw new Error('Item not found.');
}
return collection.first();
};

5
node_modules/collect.js/src/methods/firstWhere.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function firstWhere(key, operator, value) {
return this.where(key, operator, value).first() || null;
};

5
node_modules/collect.js/src/methods/flatMap.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function flatMap(fn) {
return this.map(fn).collapse();
};

53
node_modules/collect.js/src/methods/flatten.js generated vendored Executable file
View File

@@ -0,0 +1,53 @@
'use strict';
const { isArray, isObject } = require('../helpers/is');
module.exports = function flatten(depth) {
let flattenDepth = depth || Infinity;
let fullyFlattened = false;
let collection = [];
const flat = function flat(items) {
collection = [];
if (isArray(items)) {
items.forEach((item) => {
if (isArray(item)) {
collection = collection.concat(item);
} else if (isObject(item)) {
Object.keys(item).forEach((property) => {
collection = collection.concat(item[property]);
});
} else {
collection.push(item);
}
});
} else {
Object.keys(items).forEach((property) => {
if (isArray(items[property])) {
collection = collection.concat(items[property]);
} else if (isObject(items[property])) {
Object.keys(items[property]).forEach((prop) => {
collection = collection.concat(items[property][prop]);
});
} else {
collection.push(items[property]);
}
});
}
fullyFlattened = collection.filter(item => isObject(item));
fullyFlattened = fullyFlattened.length === 0;
flattenDepth -= 1;
};
flat(this.items);
while (!fullyFlattened && flattenDepth > 0) {
flat(collection);
}
return new this.constructor(collection);
};

17
node_modules/collect.js/src/methods/flip.js generated vendored Executable file
View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = function flip() {
const collection = {};
if (Array.isArray(this.items)) {
Object.keys(this.items).forEach((key) => {
collection[this.items[key]] = Number(key);
});
} else {
Object.keys(this.items).forEach((key) => {
collection[this.items[key]] = key;
});
}
return new this.constructor(collection);
};

18
node_modules/collect.js/src/methods/forPage.js generated vendored Executable file
View File

@@ -0,0 +1,18 @@
'use strict';
module.exports = function forPage(page, chunk) {
let collection = {};
if (Array.isArray(this.items)) {
collection = this.items.slice((page * chunk) - chunk, page * chunk);
} else {
Object
.keys(this.items)
.slice((page * chunk) - chunk, page * chunk)
.forEach((key) => {
collection[key] = this.items[key];
});
}
return new this.constructor(collection);
};

11
node_modules/collect.js/src/methods/forget.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function forget(key) {
if (Array.isArray(this.items)) {
this.items.splice(key, 1);
} else {
delete this.items[key];
}
return this;
};

19
node_modules/collect.js/src/methods/get.js generated vendored Executable file
View File

@@ -0,0 +1,19 @@
'use strict';
const { isFunction } = require('../helpers/is');
module.exports = function get(key, defaultValue = null) {
if (this.items[key] !== undefined) {
return this.items[key];
}
if (isFunction(defaultValue)) {
return defaultValue();
}
if (defaultValue !== null) {
return defaultValue;
}
return null;
};

28
node_modules/collect.js/src/methods/groupBy.js generated vendored Executable file
View File

@@ -0,0 +1,28 @@
'use strict';
const nestedValue = require('../helpers/nestedValue');
const { isFunction } = require('../helpers/is');
module.exports = function groupBy(key) {
const collection = {};
this.items.forEach((item, index) => {
let resolvedKey;
if (isFunction(key)) {
resolvedKey = key(item, index);
} else if (nestedValue(item, key) || nestedValue(item, key) === 0) {
resolvedKey = nestedValue(item, key);
} else {
resolvedKey = '';
}
if (collection[resolvedKey] === undefined) {
collection[resolvedKey] = new this.constructor([]);
}
collection[resolvedKey].push(item);
});
return new this.constructor(collection);
};

10
node_modules/collect.js/src/methods/has.js generated vendored Executable file
View File

@@ -0,0 +1,10 @@
'use strict';
const variadic = require('../helpers/variadic');
module.exports = function has(...args) {
const properties = variadic(args);
return properties.filter(key => Object.hasOwnProperty.call(this.items, key)).length
=== properties.length;
};

9
node_modules/collect.js/src/methods/implode.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
'use strict';
module.exports = function implode(key, glue) {
if (glue === undefined) {
return this.items.join(key);
}
return new this.constructor(this.items).pluck(key).all().join(glue);
};

14
node_modules/collect.js/src/methods/intersect.js generated vendored Executable file
View File

@@ -0,0 +1,14 @@
'use strict';
module.exports = function intersect(values) {
let intersectValues = values;
if (values instanceof this.constructor) {
intersectValues = values.all();
}
const collection = this.items
.filter(item => intersectValues.indexOf(item) !== -1);
return new this.constructor(collection);
};

19
node_modules/collect.js/src/methods/intersectByKeys.js generated vendored Executable file
View File

@@ -0,0 +1,19 @@
'use strict';
module.exports = function intersectByKeys(values) {
let intersectKeys = Object.keys(values);
if (values instanceof this.constructor) {
intersectKeys = Object.keys(values.all());
}
const collection = {};
Object.keys(this.items).forEach((key) => {
if (intersectKeys.indexOf(key) !== -1) {
collection[key] = this.items[key];
}
});
return new this.constructor(collection);
};

9
node_modules/collect.js/src/methods/isEmpty.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
'use strict';
module.exports = function isEmpty() {
if (Array.isArray(this.items)) {
return !this.items.length;
}
return !Object.keys(this.items).length;
};

5
node_modules/collect.js/src/methods/isNotEmpty.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function isNotEmpty() {
return !this.isEmpty();
};

23
node_modules/collect.js/src/methods/join.js generated vendored Executable file
View File

@@ -0,0 +1,23 @@
'use strict';
module.exports = function join(glue, finalGlue) {
const collection = this.values();
if (finalGlue === undefined) {
return collection.implode(glue);
}
const count = collection.count();
if (count === 0) {
return '';
}
if (count === 1) {
return collection.last();
}
const finalItem = collection.pop();
return collection.implode(glue) + finalGlue + finalItem;
};

22
node_modules/collect.js/src/methods/keyBy.js generated vendored Executable file
View File

@@ -0,0 +1,22 @@
'use strict';
const nestedValue = require('../helpers/nestedValue');
const { isFunction } = require('../helpers/is');
module.exports = function keyBy(key) {
const collection = {};
if (isFunction(key)) {
this.items.forEach((item) => {
collection[key(item)] = item;
});
} else {
this.items.forEach((item) => {
const keyValue = nestedValue(item, key);
collection[keyValue || ''] = item;
});
}
return new this.constructor(collection);
};

11
node_modules/collect.js/src/methods/keys.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function keys() {
let collection = Object.keys(this.items);
if (Array.isArray(this.items)) {
collection = collection.map(Number);
}
return new this.constructor(collection);
};

26
node_modules/collect.js/src/methods/last.js generated vendored Executable file
View File

@@ -0,0 +1,26 @@
'use strict';
const { isFunction } = require('../helpers/is');
module.exports = function last(fn, defaultValue) {
let { items } = this;
if (isFunction(fn)) {
items = this.filter(fn).all();
}
if ((Array.isArray(items) && !items.length) || (!Object.keys(items).length)) {
if (isFunction(defaultValue)) {
return defaultValue();
}
return defaultValue;
}
if (Array.isArray(items)) {
return items[items.length - 1];
}
const keys = Object.keys(items);
return items[keys[keys.length - 1]];
};

5
node_modules/collect.js/src/methods/macro.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function macro(name, fn) {
this.constructor.prototype[name] = fn;
};

5
node_modules/collect.js/src/methods/make.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function make(items = []) {
return new this.constructor(items);
};

15
node_modules/collect.js/src/methods/map.js generated vendored Executable file
View File

@@ -0,0 +1,15 @@
'use strict';
module.exports = function map(fn) {
if (Array.isArray(this.items)) {
return new this.constructor(this.items.map(fn));
}
const collection = {};
Object.keys(this.items).forEach((key) => {
collection[key] = fn(this.items[key], key);
});
return new this.constructor(collection);
};

5
node_modules/collect.js/src/methods/mapInto.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function mapInto(ClassName) {
return this.map((value, key) => new ClassName(value, key));
};

5
node_modules/collect.js/src/methods/mapSpread.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function mapSpread(fn) {
return this.map((values, key) => fn(...values, key));
};

17
node_modules/collect.js/src/methods/mapToDictionary.js generated vendored Executable file
View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = function mapToDictionary(fn) {
const collection = {};
this.items.forEach((item, k) => {
const [key, value] = fn(item, k);
if (collection[key] === undefined) {
collection[key] = [value];
} else {
collection[key].push(value);
}
});
return new this.constructor(collection);
};

17
node_modules/collect.js/src/methods/mapToGroups.js generated vendored Executable file
View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = function mapToGroups(fn) {
const collection = {};
this.items.forEach((item, key) => {
const [keyed, value] = fn(item, key);
if (collection[keyed] === undefined) {
collection[keyed] = [value];
} else {
collection[keyed].push(value);
}
});
return new this.constructor(collection);
};

19
node_modules/collect.js/src/methods/mapWithKeys.js generated vendored Executable file
View File

@@ -0,0 +1,19 @@
'use strict';
module.exports = function mapWithKeys(fn) {
const collection = {};
if (Array.isArray(this.items)) {
this.items.forEach((item, index) => {
const [keyed, value] = fn(item, index);
collection[keyed] = value;
});
} else {
Object.keys(this.items).forEach((key) => {
const [keyed, value] = fn(this.items[key], key);
collection[keyed] = value;
});
}
return new this.constructor(collection);
};

11
node_modules/collect.js/src/methods/max.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function max(key) {
if (typeof key === 'string') {
const filtered = this.items.filter(item => item[key] !== undefined);
return Math.max(...filtered.map(item => item[key]));
}
return Math.max(...this.items);
};

20
node_modules/collect.js/src/methods/median.js generated vendored Executable file
View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = function median(key) {
const { length } = this.items;
if (key === undefined) {
if (length % 2 === 0) {
return (this.items[(length / 2) - 1] + this.items[length / 2]) / 2;
}
return this.items[Math.floor(length / 2)];
}
if (length % 2 === 0) {
return (this.items[(length / 2) - 1][key]
+ this.items[length / 2][key]) / 2;
}
return this.items[Math.floor(length / 2)][key];
};

21
node_modules/collect.js/src/methods/merge.js generated vendored Executable file
View File

@@ -0,0 +1,21 @@
'use strict';
module.exports = function merge(value) {
let arrayOrObject = value;
if (typeof arrayOrObject === 'string') {
arrayOrObject = [arrayOrObject];
}
if (Array.isArray(this.items) && Array.isArray(arrayOrObject)) {
return new this.constructor(this.items.concat(arrayOrObject));
}
const collection = JSON.parse(JSON.stringify(this.items));
Object.keys(arrayOrObject).forEach((key) => {
collection[key] = arrayOrObject[key];
});
return new this.constructor(collection);
};

40
node_modules/collect.js/src/methods/mergeRecursive.js generated vendored Executable file
View File

@@ -0,0 +1,40 @@
'use strict';
module.exports = function mergeRecursive(items) {
const merge = (target, source) => {
const merged = {};
const mergedKeys = Object.keys({ ...target, ...source });
mergedKeys.forEach((key) => {
if (target[key] === undefined && source[key] !== undefined) {
merged[key] = source[key];
} else if (target[key] !== undefined && source[key] === undefined) {
merged[key] = target[key];
} else if (target[key] !== undefined && source[key] !== undefined) {
if (target[key] === source[key]) {
merged[key] = target[key];
} else if (
(!Array.isArray(target[key]) && typeof target[key] === 'object')
&& (!Array.isArray(source[key]) && typeof source[key] === 'object')
) {
merged[key] = merge(target[key], source[key]);
} else {
merged[key] = [].concat(target[key], source[key]);
}
}
});
return merged;
};
if (!items) {
return this;
}
if (items.constructor.name === 'Collection') {
return new this.constructor(merge(this.items, items.all()));
}
return new this.constructor(merge(this.items, items));
};

11
node_modules/collect.js/src/methods/min.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function min(key) {
if (key !== undefined) {
const filtered = this.items.filter(item => item[key] !== undefined);
return Math.min(...filtered.map(item => item[key]));
}
return Math.min(...this.items);
};

39
node_modules/collect.js/src/methods/mode.js generated vendored Executable file
View File

@@ -0,0 +1,39 @@
'use strict';
module.exports = function mode(key) {
const values = [];
let highestCount = 1;
if (!this.items.length) {
return null;
}
this.items.forEach((item) => {
const tempValues = values.filter((value) => {
if (key !== undefined) {
return value.key === item[key];
}
return value.key === item;
});
if (!tempValues.length) {
if (key !== undefined) {
values.push({ key: item[key], count: 1 });
} else {
values.push({ key: item, count: 1 });
}
} else {
tempValues[0].count += 1;
const { count } = tempValues[0];
if (count > highestCount) {
highestCount = count;
}
}
});
return values
.filter(value => value.count === highestCount)
.map(value => value.key);
};

13
node_modules/collect.js/src/methods/nth.js generated vendored Executable file
View File

@@ -0,0 +1,13 @@
'use strict';
const values = require('../helpers/values');
module.exports = function nth(n, offset = 0) {
const items = values(this.items);
const collection = items
.slice(offset)
.filter((item, index) => index % n === 0);
return new this.constructor(collection);
};

24
node_modules/collect.js/src/methods/only.js generated vendored Executable file
View File

@@ -0,0 +1,24 @@
'use strict';
const variadic = require('../helpers/variadic');
module.exports = function only(...args) {
const properties = variadic(args);
if (Array.isArray(this.items)) {
const collection = this.items
.filter(item => properties.indexOf(item) !== -1);
return new this.constructor(collection);
}
const collection = {};
Object.keys(this.items).forEach((prop) => {
if (properties.indexOf(prop) !== -1) {
collection[prop] = this.items[prop];
}
});
return new this.constructor(collection);
};

35
node_modules/collect.js/src/methods/pad.js generated vendored Executable file
View File

@@ -0,0 +1,35 @@
'use strict';
const clone = require('../helpers/clone');
module.exports = function pad(size, value) {
const abs = Math.abs(size);
const count = this.count();
if (abs <= count) {
return this;
}
let diff = abs - count;
const items = clone(this.items);
const isArray = Array.isArray(this.items);
const prepend = size < 0;
for (let iterator = 0; iterator < diff;) {
if (!isArray) {
if (items[iterator] !== undefined) {
diff += 1;
} else {
items[iterator] = value;
}
} else if (prepend) {
items.unshift(value);
} else {
items.push(value);
}
iterator += 1;
}
return new this.constructor(items);
};

31
node_modules/collect.js/src/methods/partition.js generated vendored Executable file
View File

@@ -0,0 +1,31 @@
'use strict';
module.exports = function partition(fn) {
let arrays;
if (Array.isArray(this.items)) {
arrays = [new this.constructor([]), new this.constructor([])];
this.items.forEach((item) => {
if (fn(item) === true) {
arrays[0].push(item);
} else {
arrays[1].push(item);
}
});
} else {
arrays = [new this.constructor({}), new this.constructor({})];
Object.keys(this.items).forEach((prop) => {
const value = this.items[prop];
if (fn(value) === true) {
arrays[0].put(prop, value);
} else {
arrays[1].put(prop, value);
}
});
}
return new this.constructor(arrays);
};

5
node_modules/collect.js/src/methods/pipe.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function pipe(fn) {
return fn(this);
};

104
node_modules/collect.js/src/methods/pluck.js generated vendored Executable file
View File

@@ -0,0 +1,104 @@
'use strict';
const { isArray, isObject } = require('../helpers/is');
const nestedValue = require('../helpers/nestedValue');
const buildKeyPathMap = function buildKeyPathMap(items) {
const keyPaths = {};
items.forEach((item, index) => {
function buildKeyPath(val, keyPath) {
if (isObject(val)) {
Object.keys(val).forEach((prop) => {
buildKeyPath(val[prop], `${keyPath}.${prop}`);
});
} else if (isArray(val)) {
val.forEach((v, i) => {
buildKeyPath(v, `${keyPath}.${i}`);
});
}
keyPaths[keyPath] = val;
}
buildKeyPath(item, index);
});
return keyPaths;
};
module.exports = function pluck(value, key) {
if (value.indexOf('*') !== -1) {
const keyPathMap = buildKeyPathMap(this.items);
const keyMatches = [];
if (key !== undefined) {
const keyRegex = new RegExp(`0.${key}`, 'g');
const keyNumberOfLevels = `0.${key}`.split('.').length;
Object.keys(keyPathMap).forEach((k) => {
const matchingKey = k.match(keyRegex);
if (matchingKey) {
const match = matchingKey[0];
if (match.split('.').length === keyNumberOfLevels) {
keyMatches.push(keyPathMap[match]);
}
}
});
}
const valueMatches = [];
const valueRegex = new RegExp(`0.${value}`, 'g');
const valueNumberOfLevels = `0.${value}`.split('.').length;
Object.keys(keyPathMap).forEach((k) => {
const matchingValue = k.match(valueRegex);
if (matchingValue) {
const match = matchingValue[0];
if (match.split('.').length === valueNumberOfLevels) {
valueMatches.push(keyPathMap[match]);
}
}
});
if (key !== undefined) {
const collection = {};
this.items.forEach((item, index) => {
collection[keyMatches[index] || ''] = valueMatches;
});
return new this.constructor(collection);
}
return new this.constructor([valueMatches]);
}
if (key !== undefined) {
const collection = {};
this.items.forEach((item) => {
if (nestedValue(item, value) !== undefined) {
collection[item[key] || ''] = nestedValue(item, value);
} else {
collection[item[key] || ''] = null;
}
});
return new this.constructor(collection);
}
return this.map((item) => {
if (nestedValue(item, value) !== undefined) {
return nestedValue(item, value);
}
return null;
});
};

45
node_modules/collect.js/src/methods/pop.js generated vendored Executable file
View File

@@ -0,0 +1,45 @@
'use strict';
const { isArray, isObject } = require('../helpers/is');
const deleteKeys = require('../helpers/deleteKeys');
module.exports = function pop(count = 1) {
if (this.isEmpty()) {
return null;
}
if (isArray(this.items)) {
if (count === 1) {
return this.items.pop();
}
return new this.constructor(this.items.splice(-count));
}
if (isObject(this.items)) {
const keys = Object.keys(this.items);
if (count === 1) {
const key = keys[keys.length - 1];
const last = this.items[key];
deleteKeys(this.items, key);
return last;
}
const poppedKeys = keys.slice(-count);
const newObject = poppedKeys.reduce((acc, current) => {
acc[current] = this.items[current];
return acc;
}, {});
deleteKeys(this.items, poppedKeys);
return new this.constructor(newObject);
}
return null;
};

11
node_modules/collect.js/src/methods/prepend.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function prepend(value, key) {
if (key !== undefined) {
return this.put(key, value);
}
this.items.unshift(value);
return this;
};

19
node_modules/collect.js/src/methods/pull.js generated vendored Executable file
View File

@@ -0,0 +1,19 @@
'use strict';
const { isFunction } = require('../helpers/is');
module.exports = function pull(key, defaultValue) {
let returnValue = this.items[key] || null;
if (!returnValue && defaultValue !== undefined) {
if (isFunction(defaultValue)) {
returnValue = defaultValue();
} else {
returnValue = defaultValue;
}
}
delete this.items[key];
return returnValue;
};

7
node_modules/collect.js/src/methods/push.js generated vendored Executable file
View File

@@ -0,0 +1,7 @@
'use strict';
module.exports = function push(...items) {
this.items.push(...items);
return this;
};

7
node_modules/collect.js/src/methods/put.js generated vendored Executable file
View File

@@ -0,0 +1,7 @@
'use strict';
module.exports = function put(key, value) {
this.items[key] = value;
return this;
};

16
node_modules/collect.js/src/methods/random.js generated vendored Executable file
View File

@@ -0,0 +1,16 @@
'use strict';
const values = require('../helpers/values');
module.exports = function random(length = null) {
const items = values(this.items);
const collection = new this.constructor(items).shuffle();
// If not a length was specified
if (length !== parseInt(length, 10)) {
return collection.first();
}
return collection.take(length);
};

21
node_modules/collect.js/src/methods/reduce.js generated vendored Executable file
View File

@@ -0,0 +1,21 @@
'use strict';
module.exports = function reduce(fn, carry) {
let reduceCarry = null;
if (carry !== undefined) {
reduceCarry = carry;
}
if (Array.isArray(this.items)) {
this.items.forEach((item) => {
reduceCarry = fn(reduceCarry, item);
});
} else {
Object.keys(this.items).forEach((key) => {
reduceCarry = fn(reduceCarry, this.items[key], key);
});
}
return reduceCarry;
};

5
node_modules/collect.js/src/methods/reject.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function reject(fn) {
return new this.constructor(this.items).filter(item => !fn(item));
};

23
node_modules/collect.js/src/methods/replace.js generated vendored Executable file
View File

@@ -0,0 +1,23 @@
'use strict';
module.exports = function replace(items) {
if (!items) {
return this;
}
if (Array.isArray(items)) {
const replaced = this.items.map((value, index) => items[index] || value);
return new this.constructor(replaced);
}
if (items.constructor.name === 'Collection') {
const replaced = { ...this.items, ...items.all() };
return new this.constructor(replaced);
}
const replaced = { ...this.items, ...items };
return new this.constructor(replaced);
};

49
node_modules/collect.js/src/methods/replaceRecursive.js generated vendored Executable file
View File

@@ -0,0 +1,49 @@
'use strict';
module.exports = function replaceRecursive(items) {
const replace = (target, source) => {
const replaced = { ...target };
const mergedKeys = Object.keys({ ...target, ...source });
mergedKeys.forEach((key) => {
if (!Array.isArray(source[key]) && typeof source[key] === 'object') {
replaced[key] = replace(target[key], source[key]);
} else if (target[key] === undefined && source[key] !== undefined) {
if (typeof target[key] === 'object') {
replaced[key] = { ...source[key] };
} else {
replaced[key] = source[key];
}
} else if (target[key] !== undefined && source[key] === undefined) {
if (typeof target[key] === 'object') {
replaced[key] = { ...target[key] };
} else {
replaced[key] = target[key];
}
} else if (target[key] !== undefined && source[key] !== undefined) {
if (typeof source[key] === 'object') {
replaced[key] = { ...source[key] };
} else {
replaced[key] = source[key];
}
}
});
return replaced;
};
if (!items) {
return this;
}
if (!Array.isArray(items) && typeof items !== 'object') {
return new this.constructor(replace(this.items, [items]));
}
if (items.constructor.name === 'Collection') {
return new this.constructor(replace(this.items, items.all()));
}
return new this.constructor(replace(this.items, items));
};

7
node_modules/collect.js/src/methods/reverse.js generated vendored Executable file
View File

@@ -0,0 +1,7 @@
'use strict';
module.exports = function reverse() {
const collection = [].concat(this.items).reverse();
return new this.constructor(collection);
};

33
node_modules/collect.js/src/methods/search.js generated vendored Executable file
View File

@@ -0,0 +1,33 @@
'use strict';
/* eslint-disable eqeqeq */
const { isArray, isObject, isFunction } = require('../helpers/is');
module.exports = function search(valueOrFunction, strict) {
let result;
const find = (item, key) => {
if (isFunction(valueOrFunction)) {
return valueOrFunction(this.items[key], key);
}
if (strict) {
return this.items[key] === valueOrFunction;
}
return this.items[key] == valueOrFunction;
};
if (isArray(this.items)) {
result = this.items.findIndex(find);
} else if (isObject(this.items)) {
result = Object.keys(this.items).find(key => find(this.items[key], key));
}
if (result === undefined || result < 0) {
return false;
}
return result;
};

43
node_modules/collect.js/src/methods/shift.js generated vendored Executable file
View File

@@ -0,0 +1,43 @@
'use strict';
const { isArray, isObject } = require('../helpers/is');
const deleteKeys = require('../helpers/deleteKeys');
module.exports = function shift(count = 1) {
if (this.isEmpty()) {
return null;
}
if (isArray(this.items)) {
if (count === 1) {
return this.items.shift();
}
return new this.constructor(this.items.splice(0, count));
}
if (isObject(this.items)) {
if (count === 1) {
const key = Object.keys(this.items)[0];
const value = this.items[key];
delete this.items[key];
return value;
}
const keys = Object.keys(this.items);
const poppedKeys = keys.slice(0, count);
const newObject = poppedKeys.reduce((acc, current) => {
acc[current] = this.items[current];
return acc;
}, {});
deleteKeys(this.items, poppedKeys);
return new this.constructor(newObject);
}
return null;
};

22
node_modules/collect.js/src/methods/shuffle.js generated vendored Executable file
View File

@@ -0,0 +1,22 @@
'use strict';
const values = require('../helpers/values');
module.exports = function shuffle() {
const items = values(this.items);
let j;
let x;
let i;
for (i = items.length; i; i -= 1) {
j = Math.floor(Math.random() * i);
x = items[i - 1];
items[i - 1] = items[j];
items[j] = x;
}
this.items = items;
return this;
};

20
node_modules/collect.js/src/methods/skip.js generated vendored Executable file
View File

@@ -0,0 +1,20 @@
'use strict';
const { isObject } = require('../helpers/is');
module.exports = function skip(number) {
if (isObject(this.items)) {
return new this.constructor(
Object.keys(this.items)
.reduce((accumulator, key, index) => {
if ((index + 1) > number) {
accumulator[key] = this.items[key];
}
return accumulator;
}, {}),
);
}
return new this.constructor(this.items.slice(number));
};

39
node_modules/collect.js/src/methods/skipUntil.js generated vendored Executable file
View File

@@ -0,0 +1,39 @@
'use strict';
const { isArray, isObject, isFunction } = require('../helpers/is');
module.exports = function skipUntil(valueOrFunction) {
let previous = null;
let items;
let callback = value => value === valueOrFunction;
if (isFunction(valueOrFunction)) {
callback = valueOrFunction;
}
if (isArray(this.items)) {
items = this.items.filter((item) => {
if (previous !== true) {
previous = callback(item);
}
return previous;
});
}
if (isObject(this.items)) {
items = Object.keys(this.items).reduce((acc, key) => {
if (previous !== true) {
previous = callback(this.items[key]);
}
if (previous !== false) {
acc[key] = this.items[key];
}
return acc;
}, {});
}
return new this.constructor(items);
};

39
node_modules/collect.js/src/methods/skipWhile.js generated vendored Executable file
View File

@@ -0,0 +1,39 @@
'use strict';
const { isArray, isObject, isFunction } = require('../helpers/is');
module.exports = function skipWhile(valueOrFunction) {
let previous = null;
let items;
let callback = value => value === valueOrFunction;
if (isFunction(valueOrFunction)) {
callback = valueOrFunction;
}
if (isArray(this.items)) {
items = this.items.filter((item) => {
if (previous !== true) {
previous = !callback(item);
}
return previous;
});
}
if (isObject(this.items)) {
items = Object.keys(this.items).reduce((acc, key) => {
if (previous !== true) {
previous = !callback(this.items[key]);
}
if (previous !== false) {
acc[key] = this.items[key];
}
return acc;
}, {});
}
return new this.constructor(items);
};

11
node_modules/collect.js/src/methods/slice.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function slice(remove, limit) {
let collection = this.items.slice(remove);
if (limit !== undefined) {
collection = collection.slice(0, limit);
}
return new this.constructor(collection);
};

23
node_modules/collect.js/src/methods/sole.js generated vendored Executable file
View File

@@ -0,0 +1,23 @@
'use strict';
const { isFunction } = require('../helpers/is');
module.exports = function sole(key, operator, value) {
let collection;
if (isFunction(key)) {
collection = this.filter(key);
} else {
collection = this.where(key, operator, value);
}
if (collection.isEmpty()) {
throw new Error('Item not found.');
}
if (collection.count() > 1) {
throw new Error('Multiple items found.');
}
return collection.first();
};

5
node_modules/collect.js/src/methods/some.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
const contains = require('./contains');
module.exports = contains;

17
node_modules/collect.js/src/methods/sort.js generated vendored Executable file
View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = function sort(fn) {
const collection = [].concat(this.items);
if (fn === undefined) {
if (this.every(item => typeof item === 'number')) {
collection.sort((a, b) => a - b);
} else {
collection.sort();
}
} else {
collection.sort(fn);
}
return new this.constructor(collection);
};

38
node_modules/collect.js/src/methods/sortBy.js generated vendored Executable file
View File

@@ -0,0 +1,38 @@
'use strict';
const nestedValue = require('../helpers/nestedValue');
const { isFunction } = require('../helpers/is');
module.exports = function sortBy(valueOrFunction) {
const collection = [].concat(this.items);
const getValue = (item) => {
if (isFunction(valueOrFunction)) {
return valueOrFunction(item);
}
return nestedValue(item, valueOrFunction);
};
collection.sort((a, b) => {
const valueA = getValue(a);
const valueB = getValue(b);
if (valueA === null || valueA === undefined) {
return 1;
}
if (valueB === null || valueB === undefined) {
return -1;
}
if (valueA < valueB) {
return -1;
}
if (valueA > valueB) {
return 1;
}
return 0;
});
return new this.constructor(collection);
};

5
node_modules/collect.js/src/methods/sortByDesc.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function sortByDesc(valueOrFunction) {
return this.sortBy(valueOrFunction).reverse();
};

5
node_modules/collect.js/src/methods/sortDesc.js generated vendored Executable file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function sortDesc() {
return this.sort().reverse();
};

11
node_modules/collect.js/src/methods/sortKeys.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function sortKeys() {
const ordered = {};
Object.keys(this.items).sort().forEach((key) => {
ordered[key] = this.items[key];
});
return new this.constructor(ordered);
};

11
node_modules/collect.js/src/methods/sortKeysDesc.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function sortKeysDesc() {
const ordered = {};
Object.keys(this.items).sort().reverse().forEach((key) => {
ordered[key] = this.items[key];
});
return new this.constructor(ordered);
};

16
node_modules/collect.js/src/methods/splice.js generated vendored Executable file
View File

@@ -0,0 +1,16 @@
'use strict';
module.exports = function splice(index, limit, replace) {
const slicedCollection = this.slice(index, limit);
this.items = this.diff(slicedCollection.all()).all();
if (Array.isArray(replace)) {
for (let iterator = 0, { length } = replace;
iterator < length; iterator += 1) {
this.items.splice(index + iterator, 0, replace[iterator]);
}
}
return slicedCollection;
};

14
node_modules/collect.js/src/methods/split.js generated vendored Executable file
View File

@@ -0,0 +1,14 @@
'use strict';
module.exports = function split(numberOfGroups) {
const itemsPerGroup = Math.round(this.items.length / numberOfGroups);
const items = JSON.parse(JSON.stringify(this.items));
const collection = [];
for (let iterator = 0; iterator < numberOfGroups; iterator += 1) {
collection.push(new this.constructor(items.splice(0, itemsPerGroup)));
}
return new this.constructor(collection);
};

27
node_modules/collect.js/src/methods/sum.js generated vendored Executable file
View File

@@ -0,0 +1,27 @@
'use strict';
const values = require('../helpers/values');
const { isFunction } = require('../helpers/is');
module.exports = function sum(key) {
const items = values(this.items);
let total = 0;
if (key === undefined) {
for (let i = 0, { length } = items; i < length; i += 1) {
total += parseFloat(items[i]);
}
} else if (isFunction(key)) {
for (let i = 0, { length } = items; i < length; i += 1) {
total += parseFloat(key(items[i]));
}
} else {
for (let i = 0, { length } = items; i < length; i += 1) {
total += parseFloat(items[i][key]);
}
}
return parseFloat(total.toPrecision(12));
};

16
node_modules/collect.js/src/methods/symbol.iterator.js generated vendored Executable file
View File

@@ -0,0 +1,16 @@
'use strict';
module.exports = function SymbolIterator() {
let index = -1;
return {
next: () => {
index += 1;
return {
value: this.items[index],
done: index >= this.items.length,
};
},
};
};

30
node_modules/collect.js/src/methods/take.js generated vendored Executable file
View File

@@ -0,0 +1,30 @@
'use strict';
module.exports = function take(length) {
if (!Array.isArray(this.items) && typeof this.items === 'object') {
const keys = Object.keys(this.items);
let slicedKeys;
if (length < 0) {
slicedKeys = keys.slice(length);
} else {
slicedKeys = keys.slice(0, length);
}
const collection = {};
keys.forEach((prop) => {
if (slicedKeys.indexOf(prop) !== -1) {
collection[prop] = this.items[prop];
}
});
return new this.constructor(collection);
}
if (length < 0) {
return new this.constructor(this.items.slice(length));
}
return new this.constructor(this.items.slice(0, length));
};

39
node_modules/collect.js/src/methods/takeUntil.js generated vendored Executable file
View File

@@ -0,0 +1,39 @@
'use strict';
const { isArray, isObject, isFunction } = require('../helpers/is');
module.exports = function takeUntil(valueOrFunction) {
let previous = null;
let items;
let callback = value => value === valueOrFunction;
if (isFunction(valueOrFunction)) {
callback = valueOrFunction;
}
if (isArray(this.items)) {
items = this.items.filter((item) => {
if (previous !== false) {
previous = !callback(item);
}
return previous;
});
}
if (isObject(this.items)) {
items = Object.keys(this.items).reduce((acc, key) => {
if (previous !== false) {
previous = !callback(this.items[key]);
}
if (previous !== false) {
acc[key] = this.items[key];
}
return acc;
}, {});
}
return new this.constructor(items);
};

39
node_modules/collect.js/src/methods/takeWhile.js generated vendored Executable file
View File

@@ -0,0 +1,39 @@
'use strict';
const { isArray, isObject, isFunction } = require('../helpers/is');
module.exports = function takeWhile(valueOrFunction) {
let previous = null;
let items;
let callback = value => value === valueOrFunction;
if (isFunction(valueOrFunction)) {
callback = valueOrFunction;
}
if (isArray(this.items)) {
items = this.items.filter((item) => {
if (previous !== false) {
previous = callback(item);
}
return previous;
});
}
if (isObject(this.items)) {
items = Object.keys(this.items).reduce((acc, key) => {
if (previous !== false) {
previous = callback(this.items[key]);
}
if (previous !== false) {
acc[key] = this.items[key];
}
return acc;
}, {});
}
return new this.constructor(items);
};

7
node_modules/collect.js/src/methods/tap.js generated vendored Executable file
View File

@@ -0,0 +1,7 @@
'use strict';
module.exports = function tap(fn) {
fn(this);
return this;
};

9
node_modules/collect.js/src/methods/times.js generated vendored Executable file
View File

@@ -0,0 +1,9 @@
'use strict';
module.exports = function times(n, fn) {
for (let iterator = 1; iterator <= n; iterator += 1) {
this.items.push(fn(iterator));
}
return this;
};

Some files were not shown because too many files have changed in this diff Show More