diff --git a/node_modules/es-toolkit/compat.d.ts b/node_modules/es-toolkit/compat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..da697abed72620dfbfb78c6b3ea1a8af3d808179 --- /dev/null +++ b/node_modules/es-toolkit/compat.d.ts @@ -0,0 +1 @@ +export * from './dist/compat'; diff --git a/node_modules/es-toolkit/compat.js b/node_modules/es-toolkit/compat.js new file mode 100644 index 0000000000000000000000000000000000000000..347ee5dfc35331597d518e802ba9de08f4a59b15 --- /dev/null +++ b/node_modules/es-toolkit/compat.js @@ -0,0 +1 @@ +module.exports = require('./dist/compat'); diff --git a/node_modules/es-toolkit/compat/pull.d.ts b/node_modules/es-toolkit/compat/pull.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..513e14ffecaa0638e55ef65bf2ac8a0f14b80ef3 --- /dev/null +++ b/node_modules/es-toolkit/compat/pull.d.ts @@ -0,0 +1 @@ +export { pull as default } from '../dist/compat/array/pull.js'; diff --git a/node_modules/es-toolkit/compat/pull.js b/node_modules/es-toolkit/compat/pull.js new file mode 100644 index 0000000000000000000000000000000000000000..6d7b5626f1bac72fc66b7e68532d7606f252eb27 --- /dev/null +++ b/node_modules/es-toolkit/compat/pull.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/pull.js').pull; diff --git a/node_modules/es-toolkit/compat/pullAll.d.ts b/node_modules/es-toolkit/compat/pullAll.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f782bb83b3a7c255e11d276ac4d0821170b2d301 --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAll.d.ts @@ -0,0 +1 @@ +export { pullAll as default } from '../dist/compat/array/pullAll.js'; diff --git a/node_modules/es-toolkit/compat/pullAll.js b/node_modules/es-toolkit/compat/pullAll.js new file mode 100644 index 0000000000000000000000000000000000000000..74b7119cec2c7d8ef2cf59a3f4beadee0b62121f --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAll.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/pullAll.js').pullAll; diff --git a/node_modules/es-toolkit/compat/pullAllBy.d.ts b/node_modules/es-toolkit/compat/pullAllBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7c5f977137b1b0cb0ac8623df6d03a24b4756fb0 --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAllBy.d.ts @@ -0,0 +1 @@ +export { pullAllBy as default } from '../dist/compat/array/pullAllBy.js'; diff --git a/node_modules/es-toolkit/compat/pullAllBy.js b/node_modules/es-toolkit/compat/pullAllBy.js new file mode 100644 index 0000000000000000000000000000000000000000..67cbbc50fc5d15c74f609ccce3323e3ed76bdf11 --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAllBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/pullAllBy.js').pullAllBy; diff --git a/node_modules/es-toolkit/compat/pullAllWith.d.ts b/node_modules/es-toolkit/compat/pullAllWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..405f773d6c541e5e884eb22c78a53f6dbbb7c5cd --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAllWith.d.ts @@ -0,0 +1 @@ +export { pullAllWith as default } from '../dist/compat/array/pullAllWith.js'; diff --git a/node_modules/es-toolkit/compat/pullAllWith.js b/node_modules/es-toolkit/compat/pullAllWith.js new file mode 100644 index 0000000000000000000000000000000000000000..21f2d67c8b297bf23922f1536f963e61eb7e9cdf --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAllWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/pullAllWith.js').pullAllWith; diff --git a/node_modules/es-toolkit/compat/pullAt.d.ts b/node_modules/es-toolkit/compat/pullAt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e89b0e1973ee2fba53f7c8ffe6ac6717c8cc7b4 --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAt.d.ts @@ -0,0 +1 @@ +export { pullAt as default } from '../dist/compat/array/pullAt.js'; diff --git a/node_modules/es-toolkit/compat/pullAt.js b/node_modules/es-toolkit/compat/pullAt.js new file mode 100644 index 0000000000000000000000000000000000000000..165f5609d9799ebc1b3d281c45c4b8367477c00a --- /dev/null +++ b/node_modules/es-toolkit/compat/pullAt.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/pullAt.js').pullAt; diff --git a/node_modules/es-toolkit/compat/random.d.ts b/node_modules/es-toolkit/compat/random.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd03d9deb7e5d0895bd18283ecbcc2d3865101dc --- /dev/null +++ b/node_modules/es-toolkit/compat/random.d.ts @@ -0,0 +1 @@ +export { random as default } from '../dist/compat/math/random.js'; diff --git a/node_modules/es-toolkit/compat/random.js b/node_modules/es-toolkit/compat/random.js new file mode 100644 index 0000000000000000000000000000000000000000..0311ff2f1a5d2d75aa8102ce7d517836b67116d7 --- /dev/null +++ b/node_modules/es-toolkit/compat/random.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/math/random.js').random; diff --git a/node_modules/es-toolkit/compat/range.d.ts b/node_modules/es-toolkit/compat/range.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..57c0bf060a14913803bc896a5a6903d62cd20fae --- /dev/null +++ b/node_modules/es-toolkit/compat/range.d.ts @@ -0,0 +1 @@ +export { range as default } from '../dist/compat/math/range.js'; diff --git a/node_modules/es-toolkit/compat/range.js b/node_modules/es-toolkit/compat/range.js new file mode 100644 index 0000000000000000000000000000000000000000..11df1306a38cfd38dd3a2fe8582732a59d90a7d7 --- /dev/null +++ b/node_modules/es-toolkit/compat/range.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/math/range.js').range; diff --git a/node_modules/es-toolkit/compat/rangeRight.d.ts b/node_modules/es-toolkit/compat/rangeRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..beb5a7cce9ce6fb361e8846e1ae25e5be7a92607 --- /dev/null +++ b/node_modules/es-toolkit/compat/rangeRight.d.ts @@ -0,0 +1 @@ +export { rangeRight as default } from '../dist/compat/math/rangeRight.js'; diff --git a/node_modules/es-toolkit/compat/rangeRight.js b/node_modules/es-toolkit/compat/rangeRight.js new file mode 100644 index 0000000000000000000000000000000000000000..e78efb8323dc8bb8a322ab78e0d8443edd4ac0c0 --- /dev/null +++ b/node_modules/es-toolkit/compat/rangeRight.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/math/rangeRight.js').rangeRight; diff --git a/node_modules/es-toolkit/compat/rearg.d.ts b/node_modules/es-toolkit/compat/rearg.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3da0599e35ccc57e88d4fc9bfe1c6e6600a467a7 --- /dev/null +++ b/node_modules/es-toolkit/compat/rearg.d.ts @@ -0,0 +1 @@ +export { rearg as default } from '../dist/compat/function/rearg.js'; diff --git a/node_modules/es-toolkit/compat/rearg.js b/node_modules/es-toolkit/compat/rearg.js new file mode 100644 index 0000000000000000000000000000000000000000..4e626c528714eed8125fe82f99326c63a97d164f --- /dev/null +++ b/node_modules/es-toolkit/compat/rearg.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/function/rearg.js').rearg; diff --git a/node_modules/es-toolkit/compat/reduce.d.ts b/node_modules/es-toolkit/compat/reduce.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..18af9640e3fb712b1bbf88cc8211c067038be578 --- /dev/null +++ b/node_modules/es-toolkit/compat/reduce.d.ts @@ -0,0 +1 @@ +export { reduce as default } from '../dist/compat/array/reduce.js'; diff --git a/node_modules/es-toolkit/compat/reduce.js b/node_modules/es-toolkit/compat/reduce.js new file mode 100644 index 0000000000000000000000000000000000000000..3efd4e7f9fab40b707cd042118bd530c495de1e9 --- /dev/null +++ b/node_modules/es-toolkit/compat/reduce.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/reduce.js').reduce; diff --git a/node_modules/es-toolkit/compat/reduceRight.d.ts b/node_modules/es-toolkit/compat/reduceRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf94a64c62795398d5ecd26368945b895468b366 --- /dev/null +++ b/node_modules/es-toolkit/compat/reduceRight.d.ts @@ -0,0 +1 @@ +export { reduceRight as default } from '../dist/compat/array/reduceRight.js'; diff --git a/node_modules/es-toolkit/compat/reduceRight.js b/node_modules/es-toolkit/compat/reduceRight.js new file mode 100644 index 0000000000000000000000000000000000000000..a4ac52958d48f7b0569770c9815f25c087de84eb --- /dev/null +++ b/node_modules/es-toolkit/compat/reduceRight.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/reduceRight.js').reduceRight; diff --git a/node_modules/es-toolkit/compat/reject.d.ts b/node_modules/es-toolkit/compat/reject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c04da12f6da1a330331319b2f1e8a5cc1964927b --- /dev/null +++ b/node_modules/es-toolkit/compat/reject.d.ts @@ -0,0 +1 @@ +export { reject as default } from '../dist/compat/array/reject.js'; diff --git a/node_modules/es-toolkit/compat/reject.js b/node_modules/es-toolkit/compat/reject.js new file mode 100644 index 0000000000000000000000000000000000000000..d70874d995279292a35bacb9a88b7babe45b54c7 --- /dev/null +++ b/node_modules/es-toolkit/compat/reject.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/reject.js').reject; diff --git a/node_modules/es-toolkit/compat/remove.d.ts b/node_modules/es-toolkit/compat/remove.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..064fa3f3e750cd5639a0b4a79fcbea66d75e0eb5 --- /dev/null +++ b/node_modules/es-toolkit/compat/remove.d.ts @@ -0,0 +1 @@ +export { remove as default } from '../dist/compat/array/remove.js'; diff --git a/node_modules/es-toolkit/compat/remove.js b/node_modules/es-toolkit/compat/remove.js new file mode 100644 index 0000000000000000000000000000000000000000..dbf3a154c0a6641d9f2de2267eed07dcd7f9a2c2 --- /dev/null +++ b/node_modules/es-toolkit/compat/remove.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/remove.js').remove; diff --git a/node_modules/es-toolkit/compat/repeat.d.ts b/node_modules/es-toolkit/compat/repeat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e29fe3a5bcd92273b051f7a6a16633dbdbbdd274 --- /dev/null +++ b/node_modules/es-toolkit/compat/repeat.d.ts @@ -0,0 +1 @@ +export { repeat as default } from '../dist/compat/string/repeat.js'; diff --git a/node_modules/es-toolkit/compat/repeat.js b/node_modules/es-toolkit/compat/repeat.js new file mode 100644 index 0000000000000000000000000000000000000000..455a103aff1c04d7c559da96a31cd889f74a8b01 --- /dev/null +++ b/node_modules/es-toolkit/compat/repeat.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/repeat.js').repeat; diff --git a/node_modules/es-toolkit/compat/replace.d.ts b/node_modules/es-toolkit/compat/replace.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a47c96ced7ebca7f13c937b1a43e03f0282f475f --- /dev/null +++ b/node_modules/es-toolkit/compat/replace.d.ts @@ -0,0 +1 @@ +export { replace as default } from '../dist/compat/string/replace.js'; diff --git a/node_modules/es-toolkit/compat/replace.js b/node_modules/es-toolkit/compat/replace.js new file mode 100644 index 0000000000000000000000000000000000000000..cb7b35633db17400d0160a5e6ae506e98c5be0e7 --- /dev/null +++ b/node_modules/es-toolkit/compat/replace.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/replace.js').replace; diff --git a/node_modules/es-toolkit/compat/rest.d.ts b/node_modules/es-toolkit/compat/rest.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c862f952f0181f021dc8e55a3df5ea42b39e4999 --- /dev/null +++ b/node_modules/es-toolkit/compat/rest.d.ts @@ -0,0 +1 @@ +export { rest as default } from '../dist/compat/function/rest.js'; diff --git a/node_modules/es-toolkit/compat/rest.js b/node_modules/es-toolkit/compat/rest.js new file mode 100644 index 0000000000000000000000000000000000000000..f306f6a34db94c70a1f62bd3dbc23c4bca5edff6 --- /dev/null +++ b/node_modules/es-toolkit/compat/rest.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/function/rest.js').rest; diff --git a/node_modules/es-toolkit/compat/result.d.ts b/node_modules/es-toolkit/compat/result.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a974e11bc012a0aa463db738caccc8b2e74ccd6 --- /dev/null +++ b/node_modules/es-toolkit/compat/result.d.ts @@ -0,0 +1 @@ +export { result as default } from '../dist/compat/object/result.js'; diff --git a/node_modules/es-toolkit/compat/result.js b/node_modules/es-toolkit/compat/result.js new file mode 100644 index 0000000000000000000000000000000000000000..257a89f64ef45ca77b425f668923573c014cd177 --- /dev/null +++ b/node_modules/es-toolkit/compat/result.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/result.js').result; diff --git a/node_modules/es-toolkit/compat/reverse.d.ts b/node_modules/es-toolkit/compat/reverse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..72980fa5c1f03adfb608d72cba83b2ea9e047e6a --- /dev/null +++ b/node_modules/es-toolkit/compat/reverse.d.ts @@ -0,0 +1 @@ +export { reverse as default } from '../dist/compat/array/reverse.js'; diff --git a/node_modules/es-toolkit/compat/reverse.js b/node_modules/es-toolkit/compat/reverse.js new file mode 100644 index 0000000000000000000000000000000000000000..d4bcc9048a938d6a2cdbeb6eaf82a4f9b2e5eeb9 --- /dev/null +++ b/node_modules/es-toolkit/compat/reverse.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/reverse.js').reverse; diff --git a/node_modules/es-toolkit/compat/round.d.ts b/node_modules/es-toolkit/compat/round.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc3ffc2a5d3f16602804afcaef08947315ae429a --- /dev/null +++ b/node_modules/es-toolkit/compat/round.d.ts @@ -0,0 +1 @@ +export { round as default } from '../dist/compat/math/round.js'; diff --git a/node_modules/es-toolkit/compat/round.js b/node_modules/es-toolkit/compat/round.js new file mode 100644 index 0000000000000000000000000000000000000000..a6771377844fe34bbf18c1a7dfaaddd2100cac55 --- /dev/null +++ b/node_modules/es-toolkit/compat/round.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/math/round.js').round; diff --git a/node_modules/es-toolkit/compat/sample.d.ts b/node_modules/es-toolkit/compat/sample.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..982693f7a955455a0214b748ecc8099fa8cd21d9 --- /dev/null +++ b/node_modules/es-toolkit/compat/sample.d.ts @@ -0,0 +1 @@ +export { sample as default } from '../dist/compat/array/sample.js'; diff --git a/node_modules/es-toolkit/compat/sample.js b/node_modules/es-toolkit/compat/sample.js new file mode 100644 index 0000000000000000000000000000000000000000..303d021cf3d139433f376bd51d15a9ba36688ead --- /dev/null +++ b/node_modules/es-toolkit/compat/sample.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sample.js').sample; diff --git a/node_modules/es-toolkit/compat/sampleSize.d.ts b/node_modules/es-toolkit/compat/sampleSize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c72b45e4be098a0f07cbede53c20dc44d4e5b469 --- /dev/null +++ b/node_modules/es-toolkit/compat/sampleSize.d.ts @@ -0,0 +1 @@ +export { sampleSize as default } from '../dist/compat/array/sampleSize.js'; diff --git a/node_modules/es-toolkit/compat/sampleSize.js b/node_modules/es-toolkit/compat/sampleSize.js new file mode 100644 index 0000000000000000000000000000000000000000..3d7cb5d405e24b6c1fde70d1e99f7f2337dc898e --- /dev/null +++ b/node_modules/es-toolkit/compat/sampleSize.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sampleSize.js').sampleSize; diff --git a/node_modules/es-toolkit/compat/set.d.ts b/node_modules/es-toolkit/compat/set.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2331a9d99f81dacd8a2380a5d653d8a501dcbb8e --- /dev/null +++ b/node_modules/es-toolkit/compat/set.d.ts @@ -0,0 +1 @@ +export { set as default } from '../dist/compat/object/set.js'; diff --git a/node_modules/es-toolkit/compat/set.js b/node_modules/es-toolkit/compat/set.js new file mode 100644 index 0000000000000000000000000000000000000000..d81682b5aeb5d1641d53c0d8124a7a6daad753c1 --- /dev/null +++ b/node_modules/es-toolkit/compat/set.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/set.js').set; diff --git a/node_modules/es-toolkit/compat/setWith.d.ts b/node_modules/es-toolkit/compat/setWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f48f1149dada894057e1817b47f4cf471cc37670 --- /dev/null +++ b/node_modules/es-toolkit/compat/setWith.d.ts @@ -0,0 +1 @@ +export { setWith as default } from '../dist/compat/object/setWith.js'; diff --git a/node_modules/es-toolkit/compat/setWith.js b/node_modules/es-toolkit/compat/setWith.js new file mode 100644 index 0000000000000000000000000000000000000000..40c536ec14554f96af7c645082970d1ee8ee067b --- /dev/null +++ b/node_modules/es-toolkit/compat/setWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/setWith.js').setWith; diff --git a/node_modules/es-toolkit/compat/shuffle.d.ts b/node_modules/es-toolkit/compat/shuffle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b0a941553c9b89755e3bf3b513858a9e9ad1d5d --- /dev/null +++ b/node_modules/es-toolkit/compat/shuffle.d.ts @@ -0,0 +1 @@ +export { shuffle as default } from '../dist/compat/array/shuffle.js'; diff --git a/node_modules/es-toolkit/compat/shuffle.js b/node_modules/es-toolkit/compat/shuffle.js new file mode 100644 index 0000000000000000000000000000000000000000..2f8edfd64e97796ba75b56bbe568c17b643ebd2c --- /dev/null +++ b/node_modules/es-toolkit/compat/shuffle.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/shuffle.js').shuffle; diff --git a/node_modules/es-toolkit/compat/size.d.ts b/node_modules/es-toolkit/compat/size.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ff6f608cefde963d861301920fd3ecbab75cbcc --- /dev/null +++ b/node_modules/es-toolkit/compat/size.d.ts @@ -0,0 +1 @@ +export { size as default } from '../dist/compat/array/size.js'; diff --git a/node_modules/es-toolkit/compat/size.js b/node_modules/es-toolkit/compat/size.js new file mode 100644 index 0000000000000000000000000000000000000000..37d2a7419c8f8dd488dc012df27946a02275e786 --- /dev/null +++ b/node_modules/es-toolkit/compat/size.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/size.js').size; diff --git a/node_modules/es-toolkit/compat/slice.d.ts b/node_modules/es-toolkit/compat/slice.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f93c7b93099c579ed991246d06ee8248abd8e975 --- /dev/null +++ b/node_modules/es-toolkit/compat/slice.d.ts @@ -0,0 +1 @@ +export { slice as default } from '../dist/compat/array/slice.js'; diff --git a/node_modules/es-toolkit/compat/slice.js b/node_modules/es-toolkit/compat/slice.js new file mode 100644 index 0000000000000000000000000000000000000000..43f7c0cc617f2f7531cd76065a94e8c903344e4e --- /dev/null +++ b/node_modules/es-toolkit/compat/slice.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/slice.js').slice; diff --git a/node_modules/es-toolkit/compat/snakeCase.d.ts b/node_modules/es-toolkit/compat/snakeCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ae9fd1dec28a292431f0a2f1e67a9882d419a35 --- /dev/null +++ b/node_modules/es-toolkit/compat/snakeCase.d.ts @@ -0,0 +1 @@ +export { snakeCase as default } from '../dist/compat/string/snakeCase.js'; diff --git a/node_modules/es-toolkit/compat/snakeCase.js b/node_modules/es-toolkit/compat/snakeCase.js new file mode 100644 index 0000000000000000000000000000000000000000..e68134877f361cd9955338a6f2db5e6f979d73ba --- /dev/null +++ b/node_modules/es-toolkit/compat/snakeCase.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/snakeCase.js').snakeCase; diff --git a/node_modules/es-toolkit/compat/some.d.ts b/node_modules/es-toolkit/compat/some.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd7a126aa6e79b8613c5f37d0fcd77c919bce671 --- /dev/null +++ b/node_modules/es-toolkit/compat/some.d.ts @@ -0,0 +1 @@ +export { some as default } from '../dist/compat/array/some.js'; diff --git a/node_modules/es-toolkit/compat/some.js b/node_modules/es-toolkit/compat/some.js new file mode 100644 index 0000000000000000000000000000000000000000..2fd9a06cd3201e803ae2c0dc854082bb72857b53 --- /dev/null +++ b/node_modules/es-toolkit/compat/some.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/some.js').some; diff --git a/node_modules/es-toolkit/compat/sortBy.d.ts b/node_modules/es-toolkit/compat/sortBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..19bb251c66e55f668e3405615571f0dd07e18e52 --- /dev/null +++ b/node_modules/es-toolkit/compat/sortBy.d.ts @@ -0,0 +1 @@ +export { sortBy as default } from '../dist/compat/array/sortBy.js'; diff --git a/node_modules/es-toolkit/compat/sortBy.js b/node_modules/es-toolkit/compat/sortBy.js new file mode 100644 index 0000000000000000000000000000000000000000..c7b8c8c80196f61ca6685b4591af07f7a0ee1444 --- /dev/null +++ b/node_modules/es-toolkit/compat/sortBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sortBy.js').sortBy; diff --git a/node_modules/es-toolkit/compat/sortedIndex.d.ts b/node_modules/es-toolkit/compat/sortedIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2977e1e7a9592e98ac6fa62ebc3cba39ee85ae80 --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedIndex.d.ts @@ -0,0 +1 @@ +export { sortedIndex as default } from '../dist/compat/array/sortedIndex.js'; diff --git a/node_modules/es-toolkit/compat/sortedIndex.js b/node_modules/es-toolkit/compat/sortedIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..a24030df05f328c1cd8824e4eb3bee398bb83f9f --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedIndex.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sortedIndex.js').sortedIndex; diff --git a/node_modules/es-toolkit/compat/sortedIndexBy.d.ts b/node_modules/es-toolkit/compat/sortedIndexBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d74ccf4849f12c315cbfbe95cfda38ada7a583aa --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedIndexBy.d.ts @@ -0,0 +1 @@ +export { sortedIndexBy as default } from '../dist/compat/array/sortedIndexBy.js'; diff --git a/node_modules/es-toolkit/compat/sortedIndexBy.js b/node_modules/es-toolkit/compat/sortedIndexBy.js new file mode 100644 index 0000000000000000000000000000000000000000..1417ca16239214fd4d405c51eb5c3d12764688b1 --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedIndexBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sortedIndexBy.js').sortedIndexBy; diff --git a/node_modules/es-toolkit/compat/sortedIndexOf.d.ts b/node_modules/es-toolkit/compat/sortedIndexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..695468b94ebb1f6724494f570d8a38c85119d3ee --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedIndexOf.d.ts @@ -0,0 +1 @@ +export { sortedIndexOf as default } from '../dist/compat/array/sortedIndexOf.js'; diff --git a/node_modules/es-toolkit/compat/sortedIndexOf.js b/node_modules/es-toolkit/compat/sortedIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..89784a9ff007b3a36293dea8cc787ebdc28b4e6b --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedIndexOf.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sortedIndexOf.js').sortedIndexOf; diff --git a/node_modules/es-toolkit/compat/sortedLastIndex.d.ts b/node_modules/es-toolkit/compat/sortedLastIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..59c4ee050d79a021f6cde743fc55b351615dd43a --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndex.d.ts @@ -0,0 +1 @@ +export { sortedLastIndex as default } from '../dist/compat/array/sortedLastIndex.js'; diff --git a/node_modules/es-toolkit/compat/sortedLastIndex.js b/node_modules/es-toolkit/compat/sortedLastIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..b0028c33a02bdfc0680467f003828c361c74d3f3 --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndex.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sortedLastIndex.js').sortedLastIndex; diff --git a/node_modules/es-toolkit/compat/sortedLastIndexBy.d.ts b/node_modules/es-toolkit/compat/sortedLastIndexBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b4d67791c9e73509cb8e1d3a1db1934a722fc0d --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexBy.d.ts @@ -0,0 +1 @@ +export { sortedLastIndexBy as default } from '../dist/compat/array/sortedLastIndexBy.js'; diff --git a/node_modules/es-toolkit/compat/sortedLastIndexBy.js b/node_modules/es-toolkit/compat/sortedLastIndexBy.js new file mode 100644 index 0000000000000000000000000000000000000000..d86c26bdfb89a8f8b7a548ec9d8d60e0ff5beb5b --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sortedLastIndexBy.js').sortedLastIndexBy; diff --git a/node_modules/es-toolkit/compat/sortedLastIndexOf.d.ts b/node_modules/es-toolkit/compat/sortedLastIndexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..73a7796186b089e0d5c2e7d06a9eaeebdfb21fc2 --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexOf.d.ts @@ -0,0 +1 @@ +export { sortedLastIndexOf as default } from '../dist/compat/array/sortedLastIndexOf.js'; diff --git a/node_modules/es-toolkit/compat/sortedLastIndexOf.js b/node_modules/es-toolkit/compat/sortedLastIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..3a99b19806f010bdeec01e28b1069c29d3f3b041 --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexOf.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/sortedLastIndexOf.js').sortedLastIndexOf; diff --git a/node_modules/es-toolkit/compat/split.d.ts b/node_modules/es-toolkit/compat/split.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea83627d2f4b867b18bd677abb1d66b4086fbd97 --- /dev/null +++ b/node_modules/es-toolkit/compat/split.d.ts @@ -0,0 +1 @@ +export { split as default } from '../dist/compat/string/split.js'; diff --git a/node_modules/es-toolkit/compat/split.js b/node_modules/es-toolkit/compat/split.js new file mode 100644 index 0000000000000000000000000000000000000000..9d23ed3907d97415afe3e04e697fa951db3e5718 --- /dev/null +++ b/node_modules/es-toolkit/compat/split.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/split.js').split; diff --git a/node_modules/es-toolkit/compat/spread.d.ts b/node_modules/es-toolkit/compat/spread.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f4125d909f9a31da1f4d513618acb9e4fce4b60 --- /dev/null +++ b/node_modules/es-toolkit/compat/spread.d.ts @@ -0,0 +1 @@ +export { spread as default } from '../dist/compat/function/spread.js'; diff --git a/node_modules/es-toolkit/compat/spread.js b/node_modules/es-toolkit/compat/spread.js new file mode 100644 index 0000000000000000000000000000000000000000..9e7d58ec20df5fea323b9c5ddea4cbd202710f65 --- /dev/null +++ b/node_modules/es-toolkit/compat/spread.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/function/spread.js').spread; diff --git a/node_modules/es-toolkit/compat/startCase.d.ts b/node_modules/es-toolkit/compat/startCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a0ff2eb092ec877fc9073eaf8b37199d76d04c8 --- /dev/null +++ b/node_modules/es-toolkit/compat/startCase.d.ts @@ -0,0 +1 @@ +export { startCase as default } from '../dist/compat/string/startCase.js'; diff --git a/node_modules/es-toolkit/compat/startCase.js b/node_modules/es-toolkit/compat/startCase.js new file mode 100644 index 0000000000000000000000000000000000000000..4a4f6da959dca0298bd0fa6ae1b6d803456dfe48 --- /dev/null +++ b/node_modules/es-toolkit/compat/startCase.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/startCase.js').startCase; diff --git a/node_modules/es-toolkit/compat/startsWith.d.ts b/node_modules/es-toolkit/compat/startsWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..045ba5a23b3d1bb6ecdbd59ffa0ed794e39d3b37 --- /dev/null +++ b/node_modules/es-toolkit/compat/startsWith.d.ts @@ -0,0 +1 @@ +export { startsWith as default } from '../dist/compat/string/startsWith.js'; diff --git a/node_modules/es-toolkit/compat/startsWith.js b/node_modules/es-toolkit/compat/startsWith.js new file mode 100644 index 0000000000000000000000000000000000000000..955b1c9da1d0787208545b7ecaa026bdbcef9872 --- /dev/null +++ b/node_modules/es-toolkit/compat/startsWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/startsWith.js').startsWith; diff --git a/node_modules/es-toolkit/compat/stubArray.d.ts b/node_modules/es-toolkit/compat/stubArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ca7bfc6d82a4c877cefa9cde1a5fe89c864b563 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubArray.d.ts @@ -0,0 +1 @@ +export { stubArray as default } from '../dist/compat/util/stubArray.js'; diff --git a/node_modules/es-toolkit/compat/stubArray.js b/node_modules/es-toolkit/compat/stubArray.js new file mode 100644 index 0000000000000000000000000000000000000000..c7ab651ee61b4fca8c11690eb4a01113a3309bbd --- /dev/null +++ b/node_modules/es-toolkit/compat/stubArray.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/stubArray.js').stubArray; diff --git a/node_modules/es-toolkit/compat/stubFalse.d.ts b/node_modules/es-toolkit/compat/stubFalse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..34d79bf9cfc8d9b3c39514cf350138754f6ad85a --- /dev/null +++ b/node_modules/es-toolkit/compat/stubFalse.d.ts @@ -0,0 +1 @@ +export { stubFalse as default } from '../dist/compat/util/stubFalse.js'; diff --git a/node_modules/es-toolkit/compat/stubFalse.js b/node_modules/es-toolkit/compat/stubFalse.js new file mode 100644 index 0000000000000000000000000000000000000000..e8729a92ed713cf61893ce23d9840793939ddab9 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubFalse.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/stubFalse.js').stubFalse; diff --git a/node_modules/es-toolkit/compat/stubObject.d.ts b/node_modules/es-toolkit/compat/stubObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7f7022a7e9f355af15c77c05d8e295d2fce31bff --- /dev/null +++ b/node_modules/es-toolkit/compat/stubObject.d.ts @@ -0,0 +1 @@ +export { stubObject as default } from '../dist/compat/util/stubObject.js'; diff --git a/node_modules/es-toolkit/compat/stubObject.js b/node_modules/es-toolkit/compat/stubObject.js new file mode 100644 index 0000000000000000000000000000000000000000..e9cfc7ed539ed3aa5218576c94fd01ba69862619 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubObject.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/stubObject.js').stubObject; diff --git a/node_modules/es-toolkit/compat/stubString.d.ts b/node_modules/es-toolkit/compat/stubString.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..80d7ed51bcc2bd35885d1296b89f9ece70bcd928 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubString.d.ts @@ -0,0 +1 @@ +export { stubString as default } from '../dist/compat/util/stubString.js'; diff --git a/node_modules/es-toolkit/compat/stubString.js b/node_modules/es-toolkit/compat/stubString.js new file mode 100644 index 0000000000000000000000000000000000000000..de98be922c11997ffe32641468f0f88f9d5f1c71 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubString.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/stubString.js').stubString; diff --git a/node_modules/es-toolkit/compat/stubTrue.d.ts b/node_modules/es-toolkit/compat/stubTrue.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dac1d68ebf5ae08151e0a9fdc9ec4934cf980aac --- /dev/null +++ b/node_modules/es-toolkit/compat/stubTrue.d.ts @@ -0,0 +1 @@ +export { stubTrue as default } from '../dist/compat/util/stubTrue.js'; diff --git a/node_modules/es-toolkit/compat/stubTrue.js b/node_modules/es-toolkit/compat/stubTrue.js new file mode 100644 index 0000000000000000000000000000000000000000..283b3b2cb3a9d484d0806156479df07e44f37d6f --- /dev/null +++ b/node_modules/es-toolkit/compat/stubTrue.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/stubTrue.js').stubTrue; diff --git a/node_modules/es-toolkit/compat/subtract.d.ts b/node_modules/es-toolkit/compat/subtract.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7d1288c1f568ad4ea1adb66fae55fb48edb9a76 --- /dev/null +++ b/node_modules/es-toolkit/compat/subtract.d.ts @@ -0,0 +1 @@ +export { subtract as default } from '../dist/compat/math/subtract.js'; diff --git a/node_modules/es-toolkit/compat/subtract.js b/node_modules/es-toolkit/compat/subtract.js new file mode 100644 index 0000000000000000000000000000000000000000..797b728f1ee70740f0d588c5f175ec2f75524c21 --- /dev/null +++ b/node_modules/es-toolkit/compat/subtract.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/math/subtract.js').subtract; diff --git a/node_modules/es-toolkit/compat/sum.d.ts b/node_modules/es-toolkit/compat/sum.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..986fe02a7ed18cd79fb9c1081ebd6ca6d5db76fc --- /dev/null +++ b/node_modules/es-toolkit/compat/sum.d.ts @@ -0,0 +1 @@ +export { sum as default } from '../dist/compat/math/sum.js'; diff --git a/node_modules/es-toolkit/compat/sum.js b/node_modules/es-toolkit/compat/sum.js new file mode 100644 index 0000000000000000000000000000000000000000..cbabc918a07117faf11e9a6f91d1f3b6bed8e1b9 --- /dev/null +++ b/node_modules/es-toolkit/compat/sum.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/math/sum.js').sum; diff --git a/node_modules/es-toolkit/compat/sumBy.d.ts b/node_modules/es-toolkit/compat/sumBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..04a679c48b303554fd07e35f7eadb58494ee3bd3 --- /dev/null +++ b/node_modules/es-toolkit/compat/sumBy.d.ts @@ -0,0 +1 @@ +export { sumBy as default } from '../dist/compat/math/sumBy.js'; diff --git a/node_modules/es-toolkit/compat/sumBy.js b/node_modules/es-toolkit/compat/sumBy.js new file mode 100644 index 0000000000000000000000000000000000000000..3bb12d43dfe140f4a728dd6dab929262f6287a72 --- /dev/null +++ b/node_modules/es-toolkit/compat/sumBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/math/sumBy.js').sumBy; diff --git a/node_modules/es-toolkit/compat/tail.d.ts b/node_modules/es-toolkit/compat/tail.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb2a11e26d95c262cf3baf2adaf790470939ce48 --- /dev/null +++ b/node_modules/es-toolkit/compat/tail.d.ts @@ -0,0 +1 @@ +export { tail as default } from '../dist/compat/array/tail.js'; diff --git a/node_modules/es-toolkit/compat/tail.js b/node_modules/es-toolkit/compat/tail.js new file mode 100644 index 0000000000000000000000000000000000000000..857cae49cef69dbd1fa95e1dae74644456620fe3 --- /dev/null +++ b/node_modules/es-toolkit/compat/tail.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/tail.js').tail; diff --git a/node_modules/es-toolkit/compat/take.d.ts b/node_modules/es-toolkit/compat/take.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..39eef6dea7f3f546de057b47f77e992cfc8035d1 --- /dev/null +++ b/node_modules/es-toolkit/compat/take.d.ts @@ -0,0 +1 @@ +export { take as default } from '../dist/compat/array/take.js'; diff --git a/node_modules/es-toolkit/compat/take.js b/node_modules/es-toolkit/compat/take.js new file mode 100644 index 0000000000000000000000000000000000000000..e839acfe6b645a4f083ddea61afccbdf2b74b4b7 --- /dev/null +++ b/node_modules/es-toolkit/compat/take.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/take.js').take; diff --git a/node_modules/es-toolkit/compat/takeRight.d.ts b/node_modules/es-toolkit/compat/takeRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..166a8af5d58fe86cd6b98ae1aaea2849d1025435 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRight.d.ts @@ -0,0 +1 @@ +export { takeRight as default } from '../dist/compat/array/takeRight.js'; diff --git a/node_modules/es-toolkit/compat/takeRight.js b/node_modules/es-toolkit/compat/takeRight.js new file mode 100644 index 0000000000000000000000000000000000000000..159f9f3a0e922aaf6c9c5fed19516dd8d66cb6fa --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRight.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/takeRight.js').takeRight; diff --git a/node_modules/es-toolkit/compat/takeRightWhile.d.ts b/node_modules/es-toolkit/compat/takeRightWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b47c1db94883aa0ac9008dfc06ed68aaf9df7feb --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRightWhile.d.ts @@ -0,0 +1 @@ +export { takeRightWhile as default } from '../dist/compat/array/takeRightWhile.js'; diff --git a/node_modules/es-toolkit/compat/takeRightWhile.js b/node_modules/es-toolkit/compat/takeRightWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..d8a8c1e8a51e74e3f75bfad53ca67c3d07a1d377 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRightWhile.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/takeRightWhile.js').takeRightWhile; diff --git a/node_modules/es-toolkit/compat/takeWhile.d.ts b/node_modules/es-toolkit/compat/takeWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..286e83b6ef0ed047f8c05d0cca3fb882de1e9322 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeWhile.d.ts @@ -0,0 +1 @@ +export { takeWhile as default } from '../dist/compat/array/takeWhile.js'; diff --git a/node_modules/es-toolkit/compat/takeWhile.js b/node_modules/es-toolkit/compat/takeWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..77ccab63c3f20e856d4c0ef0f7c4894ede44d7d6 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeWhile.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/takeWhile.js').takeWhile; diff --git a/node_modules/es-toolkit/compat/template.d.ts b/node_modules/es-toolkit/compat/template.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9fe5e399253f4a91dfd3d35f698b2c7f57303e0 --- /dev/null +++ b/node_modules/es-toolkit/compat/template.d.ts @@ -0,0 +1 @@ +export { template as default } from '../dist/compat/string/template.js'; diff --git a/node_modules/es-toolkit/compat/template.js b/node_modules/es-toolkit/compat/template.js new file mode 100644 index 0000000000000000000000000000000000000000..b14c31ea7ca8d2c7504bb04742a86f7f01dea663 --- /dev/null +++ b/node_modules/es-toolkit/compat/template.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/template.js').template; diff --git a/node_modules/es-toolkit/compat/templateSettings.d.ts b/node_modules/es-toolkit/compat/templateSettings.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ef95640dd4069a26355bb177c682e8278f5e796 --- /dev/null +++ b/node_modules/es-toolkit/compat/templateSettings.d.ts @@ -0,0 +1 @@ +export { templateSettings as default } from '../dist/compat/string/templateSettings.js'; diff --git a/node_modules/es-toolkit/compat/templateSettings.js b/node_modules/es-toolkit/compat/templateSettings.js new file mode 100644 index 0000000000000000000000000000000000000000..358d7129a5a316eca038ffbf57802b667bd10422 --- /dev/null +++ b/node_modules/es-toolkit/compat/templateSettings.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/templateSettings.js').templateSettings; diff --git a/node_modules/es-toolkit/compat/throttle.d.ts b/node_modules/es-toolkit/compat/throttle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d541b24c09c51cbd49b694791fbbc7db73af38a2 --- /dev/null +++ b/node_modules/es-toolkit/compat/throttle.d.ts @@ -0,0 +1 @@ +export { throttle as default } from '../dist/compat/function/throttle.js'; diff --git a/node_modules/es-toolkit/compat/throttle.js b/node_modules/es-toolkit/compat/throttle.js new file mode 100644 index 0000000000000000000000000000000000000000..1bde2c23208facbd449cd506e28f432874ec7abb --- /dev/null +++ b/node_modules/es-toolkit/compat/throttle.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/function/throttle.js').throttle; diff --git a/node_modules/es-toolkit/compat/times.d.ts b/node_modules/es-toolkit/compat/times.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d3ecd94579097f68fee931bc7785f37695a276df --- /dev/null +++ b/node_modules/es-toolkit/compat/times.d.ts @@ -0,0 +1 @@ +export { times as default } from '../dist/compat/util/times.js'; diff --git a/node_modules/es-toolkit/compat/times.js b/node_modules/es-toolkit/compat/times.js new file mode 100644 index 0000000000000000000000000000000000000000..6bc05c0aca67377bbc6cec4942fdf8261f6f8525 --- /dev/null +++ b/node_modules/es-toolkit/compat/times.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/times.js').times; diff --git a/node_modules/es-toolkit/compat/toArray.d.ts b/node_modules/es-toolkit/compat/toArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d4e0cd46a50c78ce643895cc4584df5336e4102 --- /dev/null +++ b/node_modules/es-toolkit/compat/toArray.d.ts @@ -0,0 +1 @@ +export { toArray as default } from '../dist/compat/util/toArray.js'; diff --git a/node_modules/es-toolkit/compat/toArray.js b/node_modules/es-toolkit/compat/toArray.js new file mode 100644 index 0000000000000000000000000000000000000000..b4a488889607bdc8471d976c27fb84201f6fcfb5 --- /dev/null +++ b/node_modules/es-toolkit/compat/toArray.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toArray.js').toArray; diff --git a/node_modules/es-toolkit/compat/toDefaulted.d.ts b/node_modules/es-toolkit/compat/toDefaulted.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..428c1202fe91da9d3f04b5519b9838812c0cd0fc --- /dev/null +++ b/node_modules/es-toolkit/compat/toDefaulted.d.ts @@ -0,0 +1 @@ +export { toDefaulted as default } from '../dist/compat/object/toDefaulted.js'; diff --git a/node_modules/es-toolkit/compat/toDefaulted.js b/node_modules/es-toolkit/compat/toDefaulted.js new file mode 100644 index 0000000000000000000000000000000000000000..a68c209ae4785d2f44c6a1e01ac1b4d690e9d7be --- /dev/null +++ b/node_modules/es-toolkit/compat/toDefaulted.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/toDefaulted.js').toDefaulted; diff --git a/node_modules/es-toolkit/compat/toFinite.d.ts b/node_modules/es-toolkit/compat/toFinite.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6117405e863baaa7d891ea58619f69580672d4d7 --- /dev/null +++ b/node_modules/es-toolkit/compat/toFinite.d.ts @@ -0,0 +1 @@ +export { toFinite as default } from '../dist/compat/util/toFinite.js'; diff --git a/node_modules/es-toolkit/compat/toFinite.js b/node_modules/es-toolkit/compat/toFinite.js new file mode 100644 index 0000000000000000000000000000000000000000..eadf074f591c9226a3e01c0b6107011342d8cc55 --- /dev/null +++ b/node_modules/es-toolkit/compat/toFinite.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toFinite.js').toFinite; diff --git a/node_modules/es-toolkit/compat/toInteger.d.ts b/node_modules/es-toolkit/compat/toInteger.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa2a0214c03bace642c7383e50cd1fd1dd58e4cd --- /dev/null +++ b/node_modules/es-toolkit/compat/toInteger.d.ts @@ -0,0 +1 @@ +export { toInteger as default } from '../dist/compat/util/toInteger.js'; diff --git a/node_modules/es-toolkit/compat/toInteger.js b/node_modules/es-toolkit/compat/toInteger.js new file mode 100644 index 0000000000000000000000000000000000000000..74b23b1024b846b1be7afbce6237d0306b792453 --- /dev/null +++ b/node_modules/es-toolkit/compat/toInteger.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toInteger.js').toInteger; diff --git a/node_modules/es-toolkit/compat/toLength.d.ts b/node_modules/es-toolkit/compat/toLength.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7de8e6fc095f7548db557bccd2ddc0680ffa133 --- /dev/null +++ b/node_modules/es-toolkit/compat/toLength.d.ts @@ -0,0 +1 @@ +export { toLength as default } from '../dist/compat/util/toLength.js'; diff --git a/node_modules/es-toolkit/compat/toLength.js b/node_modules/es-toolkit/compat/toLength.js new file mode 100644 index 0000000000000000000000000000000000000000..ad7c11de2955d126ca17e4ba32c9567d5bd388e6 --- /dev/null +++ b/node_modules/es-toolkit/compat/toLength.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toLength.js').toLength; diff --git a/node_modules/es-toolkit/compat/toLower.d.ts b/node_modules/es-toolkit/compat/toLower.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f3e5df99dd024303bd661c7e21812cc7500e8aa --- /dev/null +++ b/node_modules/es-toolkit/compat/toLower.d.ts @@ -0,0 +1 @@ +export { toLower as default } from '../dist/compat/string/toLower.js'; diff --git a/node_modules/es-toolkit/compat/toLower.js b/node_modules/es-toolkit/compat/toLower.js new file mode 100644 index 0000000000000000000000000000000000000000..283e933c09f65ee7ff1ffd6592d778b5d2511e6a --- /dev/null +++ b/node_modules/es-toolkit/compat/toLower.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/toLower.js').toLower; diff --git a/node_modules/es-toolkit/compat/toNumber.d.ts b/node_modules/es-toolkit/compat/toNumber.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..24db69c25f9e9381d49fb12758f20b63fbced45e --- /dev/null +++ b/node_modules/es-toolkit/compat/toNumber.d.ts @@ -0,0 +1 @@ +export { toNumber as default } from '../dist/compat/util/toNumber.js'; diff --git a/node_modules/es-toolkit/compat/toNumber.js b/node_modules/es-toolkit/compat/toNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..483474a0b979a6baea9e1886084f1066a6e3a551 --- /dev/null +++ b/node_modules/es-toolkit/compat/toNumber.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toNumber.js').toNumber; diff --git a/node_modules/es-toolkit/compat/toPairs.d.ts b/node_modules/es-toolkit/compat/toPairs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3feec39e301478bce6fd0d8e86b9816d5f72a4fa --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairs.d.ts @@ -0,0 +1 @@ +export { toPairs as default } from '../dist/compat/object/toPairs.js'; diff --git a/node_modules/es-toolkit/compat/toPairs.js b/node_modules/es-toolkit/compat/toPairs.js new file mode 100644 index 0000000000000000000000000000000000000000..71b15c2c6383aab8c71401d8d7cd57c6b03c8459 --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairs.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/toPairs.js').toPairs; diff --git a/node_modules/es-toolkit/compat/toPairsIn.d.ts b/node_modules/es-toolkit/compat/toPairsIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c06db4f5524c58eb6c7f6fc06f850ec185d09b5e --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairsIn.d.ts @@ -0,0 +1 @@ +export { toPairsIn as default } from '../dist/compat/object/toPairsIn.js'; diff --git a/node_modules/es-toolkit/compat/toPairsIn.js b/node_modules/es-toolkit/compat/toPairsIn.js new file mode 100644 index 0000000000000000000000000000000000000000..1308fa7b81b3d53bcaa96537d846e06ccc1f7fce --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairsIn.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/toPairsIn.js').toPairsIn; diff --git a/node_modules/es-toolkit/compat/toPath.d.ts b/node_modules/es-toolkit/compat/toPath.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..84192bfe9eb554419a144078aa02727a188607eb --- /dev/null +++ b/node_modules/es-toolkit/compat/toPath.d.ts @@ -0,0 +1 @@ +export { toPath as default } from '../dist/compat/util/toPath.js'; diff --git a/node_modules/es-toolkit/compat/toPath.js b/node_modules/es-toolkit/compat/toPath.js new file mode 100644 index 0000000000000000000000000000000000000000..4dfb79e20dfdb703588d6121dfa1ddeccc2b1601 --- /dev/null +++ b/node_modules/es-toolkit/compat/toPath.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toPath.js').toPath; diff --git a/node_modules/es-toolkit/compat/toPlainObject.d.ts b/node_modules/es-toolkit/compat/toPlainObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..527bf0540847960104f8ea03d0e50575af698e53 --- /dev/null +++ b/node_modules/es-toolkit/compat/toPlainObject.d.ts @@ -0,0 +1 @@ +export { toPlainObject as default } from '../dist/compat/util/toPlainObject.js'; diff --git a/node_modules/es-toolkit/compat/toPlainObject.js b/node_modules/es-toolkit/compat/toPlainObject.js new file mode 100644 index 0000000000000000000000000000000000000000..7a3b508a32078852580328257c4fac6fabdd2e9b --- /dev/null +++ b/node_modules/es-toolkit/compat/toPlainObject.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toPlainObject.js').toPlainObject; diff --git a/node_modules/es-toolkit/compat/toSafeInteger.d.ts b/node_modules/es-toolkit/compat/toSafeInteger.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ec10a2b89176131cd26a3674af801ba05229bf8 --- /dev/null +++ b/node_modules/es-toolkit/compat/toSafeInteger.d.ts @@ -0,0 +1 @@ +export { toSafeInteger as default } from '../dist/compat/util/toSafeInteger.js'; diff --git a/node_modules/es-toolkit/compat/toSafeInteger.js b/node_modules/es-toolkit/compat/toSafeInteger.js new file mode 100644 index 0000000000000000000000000000000000000000..bdd137ebbdbc2d11ad6ab772de80675074ee93dc --- /dev/null +++ b/node_modules/es-toolkit/compat/toSafeInteger.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toSafeInteger.js').toSafeInteger; diff --git a/node_modules/es-toolkit/compat/toString.d.ts b/node_modules/es-toolkit/compat/toString.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab6ad7cc3c9df6c49f5db9c14389431c6f6ee22a --- /dev/null +++ b/node_modules/es-toolkit/compat/toString.d.ts @@ -0,0 +1 @@ +export { toString as default } from '../dist/compat/util/toString.js'; diff --git a/node_modules/es-toolkit/compat/toString.js b/node_modules/es-toolkit/compat/toString.js new file mode 100644 index 0000000000000000000000000000000000000000..8ec882cd7e01e54871731a06162c38e6bfb18b43 --- /dev/null +++ b/node_modules/es-toolkit/compat/toString.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/toString.js').toString; diff --git a/node_modules/es-toolkit/compat/toUpper.d.ts b/node_modules/es-toolkit/compat/toUpper.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..13e08814f4a5e32558adb240ec4ce1c4865c04fb --- /dev/null +++ b/node_modules/es-toolkit/compat/toUpper.d.ts @@ -0,0 +1 @@ +export { toUpper as default } from '../dist/compat/string/toUpper.js'; diff --git a/node_modules/es-toolkit/compat/toUpper.js b/node_modules/es-toolkit/compat/toUpper.js new file mode 100644 index 0000000000000000000000000000000000000000..84d109d68b6293e755cf19f1adb3075414c956f9 --- /dev/null +++ b/node_modules/es-toolkit/compat/toUpper.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/toUpper.js').toUpper; diff --git a/node_modules/es-toolkit/compat/transform.d.ts b/node_modules/es-toolkit/compat/transform.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..33e10e404182f9def8c8d5ef5fd6f015a201b4d6 --- /dev/null +++ b/node_modules/es-toolkit/compat/transform.d.ts @@ -0,0 +1 @@ +export { transform as default } from '../dist/compat/object/transform.js'; diff --git a/node_modules/es-toolkit/compat/transform.js b/node_modules/es-toolkit/compat/transform.js new file mode 100644 index 0000000000000000000000000000000000000000..b9388aefe2c4804f25cd60bea5c023f2107cb6d2 --- /dev/null +++ b/node_modules/es-toolkit/compat/transform.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/transform.js').transform; diff --git a/node_modules/es-toolkit/compat/trim.d.ts b/node_modules/es-toolkit/compat/trim.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b81263e613c5c84cee3cbf11d00c551f55b1c5a8 --- /dev/null +++ b/node_modules/es-toolkit/compat/trim.d.ts @@ -0,0 +1 @@ +export { trim as default } from '../dist/compat/string/trim.js'; diff --git a/node_modules/es-toolkit/compat/trim.js b/node_modules/es-toolkit/compat/trim.js new file mode 100644 index 0000000000000000000000000000000000000000..8888b16ed6af5b618d642829d8e7f20f7a147384 --- /dev/null +++ b/node_modules/es-toolkit/compat/trim.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/trim.js').trim; diff --git a/node_modules/es-toolkit/compat/trimEnd.d.ts b/node_modules/es-toolkit/compat/trimEnd.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..16181de64a4b08251f79a77225658da6789eb06e --- /dev/null +++ b/node_modules/es-toolkit/compat/trimEnd.d.ts @@ -0,0 +1 @@ +export { trimEnd as default } from '../dist/compat/string/trimEnd.js'; diff --git a/node_modules/es-toolkit/compat/trimEnd.js b/node_modules/es-toolkit/compat/trimEnd.js new file mode 100644 index 0000000000000000000000000000000000000000..8fedeaab52f937580330351c5d639d350ffd5f67 --- /dev/null +++ b/node_modules/es-toolkit/compat/trimEnd.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/trimEnd.js').trimEnd; diff --git a/node_modules/es-toolkit/compat/trimStart.d.ts b/node_modules/es-toolkit/compat/trimStart.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ceb2b5e39910891d532bcf810b393d5dd7b367ab --- /dev/null +++ b/node_modules/es-toolkit/compat/trimStart.d.ts @@ -0,0 +1 @@ +export { trimStart as default } from '../dist/compat/string/trimStart.js'; diff --git a/node_modules/es-toolkit/compat/trimStart.js b/node_modules/es-toolkit/compat/trimStart.js new file mode 100644 index 0000000000000000000000000000000000000000..a1a65f4c0cbd4a2c9df1a8f04d1cafd887227cdb --- /dev/null +++ b/node_modules/es-toolkit/compat/trimStart.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/trimStart.js').trimStart; diff --git a/node_modules/es-toolkit/compat/truncate.d.ts b/node_modules/es-toolkit/compat/truncate.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9302a1caf0a487be455c17cfb796a3d023075f58 --- /dev/null +++ b/node_modules/es-toolkit/compat/truncate.d.ts @@ -0,0 +1 @@ +export { truncate as default } from '../dist/compat/string/truncate.js'; diff --git a/node_modules/es-toolkit/compat/truncate.js b/node_modules/es-toolkit/compat/truncate.js new file mode 100644 index 0000000000000000000000000000000000000000..0edd2ebd66637821f7cb90e62e53494b4f1fe6ac --- /dev/null +++ b/node_modules/es-toolkit/compat/truncate.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/truncate.js').truncate; diff --git a/node_modules/es-toolkit/compat/unary.d.ts b/node_modules/es-toolkit/compat/unary.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..35b078cd7b793488ce3a9ceca94d4a151ab87aed --- /dev/null +++ b/node_modules/es-toolkit/compat/unary.d.ts @@ -0,0 +1 @@ +export { unary as default } from '../dist/function/unary.js'; diff --git a/node_modules/es-toolkit/compat/unary.js b/node_modules/es-toolkit/compat/unary.js new file mode 100644 index 0000000000000000000000000000000000000000..4f101f79fba249c3527202e6b9d6f4217ebd4303 --- /dev/null +++ b/node_modules/es-toolkit/compat/unary.js @@ -0,0 +1 @@ +module.exports = require('../dist/function/unary.js').unary; diff --git a/node_modules/es-toolkit/compat/unescape.d.ts b/node_modules/es-toolkit/compat/unescape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..964a324f01d054640f1ec8fa98aa86fb05648931 --- /dev/null +++ b/node_modules/es-toolkit/compat/unescape.d.ts @@ -0,0 +1 @@ +export { unescape as default } from '../dist/compat/string/unescape.js'; diff --git a/node_modules/es-toolkit/compat/unescape.js b/node_modules/es-toolkit/compat/unescape.js new file mode 100644 index 0000000000000000000000000000000000000000..334b158328ba8a8099fb203abb578e7b8e506ac4 --- /dev/null +++ b/node_modules/es-toolkit/compat/unescape.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/unescape.js').unescape; diff --git a/node_modules/es-toolkit/compat/union.d.ts b/node_modules/es-toolkit/compat/union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee0ac077321d50ede928b36affcecb7471d43f28 --- /dev/null +++ b/node_modules/es-toolkit/compat/union.d.ts @@ -0,0 +1 @@ +export { union as default } from '../dist/compat/array/union.js'; diff --git a/node_modules/es-toolkit/compat/union.js b/node_modules/es-toolkit/compat/union.js new file mode 100644 index 0000000000000000000000000000000000000000..23e4423ff0c80df1864f7c6e8ed5917d27458e6c --- /dev/null +++ b/node_modules/es-toolkit/compat/union.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/union.js').union; diff --git a/node_modules/es-toolkit/compat/unionBy.d.ts b/node_modules/es-toolkit/compat/unionBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d80ecdfc5826ff3bcc68d5464b9728431b2f7ce1 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionBy.d.ts @@ -0,0 +1 @@ +export { unionBy as default } from '../dist/compat/array/unionBy.js'; diff --git a/node_modules/es-toolkit/compat/unionBy.js b/node_modules/es-toolkit/compat/unionBy.js new file mode 100644 index 0000000000000000000000000000000000000000..59ee26c7d3b557aeb77db1ff57b12309c02848c3 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/unionBy.js').unionBy; diff --git a/node_modules/es-toolkit/compat/unionWith.d.ts b/node_modules/es-toolkit/compat/unionWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aae589b0ccccd950cd3752f8f4258fea87420ef0 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionWith.d.ts @@ -0,0 +1 @@ +export { unionWith as default } from '../dist/compat/array/unionWith.js'; diff --git a/node_modules/es-toolkit/compat/unionWith.js b/node_modules/es-toolkit/compat/unionWith.js new file mode 100644 index 0000000000000000000000000000000000000000..7e486ac9b04d7dfc240f62b580d1cc388fda3a83 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/unionWith.js').unionWith; diff --git a/node_modules/es-toolkit/compat/uniq.d.ts b/node_modules/es-toolkit/compat/uniq.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c614482c40cc8dd2c943fb12903855e6929d2fee --- /dev/null +++ b/node_modules/es-toolkit/compat/uniq.d.ts @@ -0,0 +1 @@ +export { uniq as default } from '../dist/compat/array/uniq.js'; diff --git a/node_modules/es-toolkit/compat/uniq.js b/node_modules/es-toolkit/compat/uniq.js new file mode 100644 index 0000000000000000000000000000000000000000..fe9cf67b722ee82f679b2ad9f4194dc18435bd5a --- /dev/null +++ b/node_modules/es-toolkit/compat/uniq.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/uniq.js').uniq; diff --git a/node_modules/es-toolkit/compat/uniqBy.d.ts b/node_modules/es-toolkit/compat/uniqBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7e470eb7f44f68602d7d04397a955316f73ece6d --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqBy.d.ts @@ -0,0 +1 @@ +export { uniqBy as default } from '../dist/compat/array/uniqBy.js'; diff --git a/node_modules/es-toolkit/compat/uniqBy.js b/node_modules/es-toolkit/compat/uniqBy.js new file mode 100644 index 0000000000000000000000000000000000000000..9f1174d0767c1e4fbb653ac05570bd6a59fd0769 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/uniqBy.js').uniqBy; diff --git a/node_modules/es-toolkit/compat/uniqWith.d.ts b/node_modules/es-toolkit/compat/uniqWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a0271c1532d21a2cdf372672296c87202c2f678c --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqWith.d.ts @@ -0,0 +1 @@ +export { uniqWith as default } from '../dist/compat/array/uniqWith.js'; diff --git a/node_modules/es-toolkit/compat/uniqWith.js b/node_modules/es-toolkit/compat/uniqWith.js new file mode 100644 index 0000000000000000000000000000000000000000..158a67ac38091e27bba06887d113c6ea8678b479 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/uniqWith.js').uniqWith; diff --git a/node_modules/es-toolkit/compat/uniqueId.d.ts b/node_modules/es-toolkit/compat/uniqueId.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1635f8af10887475b51fc9e3d474fe9dca592165 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqueId.d.ts @@ -0,0 +1 @@ +export { uniqueId as default } from '../dist/compat/util/uniqueId.js'; diff --git a/node_modules/es-toolkit/compat/uniqueId.js b/node_modules/es-toolkit/compat/uniqueId.js new file mode 100644 index 0000000000000000000000000000000000000000..71b7525a1c32bcdb3b4a70b3376e4849fa6bf091 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqueId.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/util/uniqueId.js').uniqueId; diff --git a/node_modules/es-toolkit/compat/unset.d.ts b/node_modules/es-toolkit/compat/unset.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b83b5d5e2ecbe8829ffdebc29554cc7851368852 --- /dev/null +++ b/node_modules/es-toolkit/compat/unset.d.ts @@ -0,0 +1 @@ +export { unset as default } from '../dist/compat/object/unset.js'; diff --git a/node_modules/es-toolkit/compat/unset.js b/node_modules/es-toolkit/compat/unset.js new file mode 100644 index 0000000000000000000000000000000000000000..88e734e8563837db933396570de5df9eca9c3b99 --- /dev/null +++ b/node_modules/es-toolkit/compat/unset.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/unset.js').unset; diff --git a/node_modules/es-toolkit/compat/unzip.d.ts b/node_modules/es-toolkit/compat/unzip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b104cd1bb07d709c632f7222b1b40f9bc032f0e2 --- /dev/null +++ b/node_modules/es-toolkit/compat/unzip.d.ts @@ -0,0 +1 @@ +export { unzip as default } from '../dist/compat/array/unzip.js'; diff --git a/node_modules/es-toolkit/compat/unzip.js b/node_modules/es-toolkit/compat/unzip.js new file mode 100644 index 0000000000000000000000000000000000000000..6ed37e20103ffa2c89e17da0b67425185979e3af --- /dev/null +++ b/node_modules/es-toolkit/compat/unzip.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/unzip.js').unzip; diff --git a/node_modules/es-toolkit/compat/unzipWith.d.ts b/node_modules/es-toolkit/compat/unzipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bcdbfa98218358c5d0ddc7ffb3814b468c450402 --- /dev/null +++ b/node_modules/es-toolkit/compat/unzipWith.d.ts @@ -0,0 +1 @@ +export { unzipWith as default } from '../dist/compat/array/unzipWith.js'; diff --git a/node_modules/es-toolkit/compat/unzipWith.js b/node_modules/es-toolkit/compat/unzipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..9fefaba223a096de57dff2f53c9ded82982368d0 --- /dev/null +++ b/node_modules/es-toolkit/compat/unzipWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/unzipWith.js').unzipWith; diff --git a/node_modules/es-toolkit/compat/update.d.ts b/node_modules/es-toolkit/compat/update.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..01f5ff723a8e4e5fbe1ba1d631a71044f45bf7fc --- /dev/null +++ b/node_modules/es-toolkit/compat/update.d.ts @@ -0,0 +1 @@ +export { update as default } from '../dist/compat/object/update.js'; diff --git a/node_modules/es-toolkit/compat/update.js b/node_modules/es-toolkit/compat/update.js new file mode 100644 index 0000000000000000000000000000000000000000..96cf555334454a75781864b8b77a2d151b6fca5b --- /dev/null +++ b/node_modules/es-toolkit/compat/update.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/update.js').update; diff --git a/node_modules/es-toolkit/compat/updateWith.d.ts b/node_modules/es-toolkit/compat/updateWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ccc99cb59181847b0e02459bb7f7fb67e3f5a671 --- /dev/null +++ b/node_modules/es-toolkit/compat/updateWith.d.ts @@ -0,0 +1 @@ +export { updateWith as default } from '../dist/compat/object/updateWith.js'; diff --git a/node_modules/es-toolkit/compat/updateWith.js b/node_modules/es-toolkit/compat/updateWith.js new file mode 100644 index 0000000000000000000000000000000000000000..6f43baba38a48fcba880263796786563ef37e0cc --- /dev/null +++ b/node_modules/es-toolkit/compat/updateWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/updateWith.js').updateWith; diff --git a/node_modules/es-toolkit/compat/upperCase.d.ts b/node_modules/es-toolkit/compat/upperCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67cbbca08836a433fc0704d54a88f34ef30383bc --- /dev/null +++ b/node_modules/es-toolkit/compat/upperCase.d.ts @@ -0,0 +1 @@ +export { upperCase as default } from '../dist/compat/string/upperCase.js'; diff --git a/node_modules/es-toolkit/compat/upperCase.js b/node_modules/es-toolkit/compat/upperCase.js new file mode 100644 index 0000000000000000000000000000000000000000..bfa4d7f4217ceb17ed26a73adfaf33d765e09183 --- /dev/null +++ b/node_modules/es-toolkit/compat/upperCase.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/upperCase.js').upperCase; diff --git a/node_modules/es-toolkit/compat/upperFirst.d.ts b/node_modules/es-toolkit/compat/upperFirst.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5960330d227b9a47db01c389ae61ff46877e4f8 --- /dev/null +++ b/node_modules/es-toolkit/compat/upperFirst.d.ts @@ -0,0 +1 @@ +export { upperFirst as default } from '../dist/compat/string/upperFirst.js'; diff --git a/node_modules/es-toolkit/compat/upperFirst.js b/node_modules/es-toolkit/compat/upperFirst.js new file mode 100644 index 0000000000000000000000000000000000000000..f4638223f923e2cbb12fef9790e609e9264a3ea5 --- /dev/null +++ b/node_modules/es-toolkit/compat/upperFirst.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/upperFirst.js').upperFirst; diff --git a/node_modules/es-toolkit/compat/values.d.ts b/node_modules/es-toolkit/compat/values.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..165db9dc98f6a59aabea27f2a238f4cf5684b088 --- /dev/null +++ b/node_modules/es-toolkit/compat/values.d.ts @@ -0,0 +1 @@ +export { values as default } from '../dist/compat/object/values.js'; diff --git a/node_modules/es-toolkit/compat/values.js b/node_modules/es-toolkit/compat/values.js new file mode 100644 index 0000000000000000000000000000000000000000..1b7466788c05ddc14ff6d74b60cd7dc5242a6642 --- /dev/null +++ b/node_modules/es-toolkit/compat/values.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/values.js').values; diff --git a/node_modules/es-toolkit/compat/valuesIn.d.ts b/node_modules/es-toolkit/compat/valuesIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..83134af7d77e4222e4f39e4b373f5e52ed701cb1 --- /dev/null +++ b/node_modules/es-toolkit/compat/valuesIn.d.ts @@ -0,0 +1 @@ +export { valuesIn as default } from '../dist/compat/object/valuesIn.js'; diff --git a/node_modules/es-toolkit/compat/valuesIn.js b/node_modules/es-toolkit/compat/valuesIn.js new file mode 100644 index 0000000000000000000000000000000000000000..ad9dc4cc6de5a2a0aa2f9fa4a3d6f2e0faa2011c --- /dev/null +++ b/node_modules/es-toolkit/compat/valuesIn.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/object/valuesIn.js').valuesIn; diff --git a/node_modules/es-toolkit/compat/without.d.ts b/node_modules/es-toolkit/compat/without.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7c6fbeb6c7909506c0757f625425b8903a297396 --- /dev/null +++ b/node_modules/es-toolkit/compat/without.d.ts @@ -0,0 +1 @@ +export { without as default } from '../dist/compat/array/without.js'; diff --git a/node_modules/es-toolkit/compat/without.js b/node_modules/es-toolkit/compat/without.js new file mode 100644 index 0000000000000000000000000000000000000000..bbc76e076a571f746aab65a5325553291d57b650 --- /dev/null +++ b/node_modules/es-toolkit/compat/without.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/without.js').without; diff --git a/node_modules/es-toolkit/compat/words.d.ts b/node_modules/es-toolkit/compat/words.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9aeaf628ea941f95213c636f227a499e2cbd3ef --- /dev/null +++ b/node_modules/es-toolkit/compat/words.d.ts @@ -0,0 +1 @@ +export { words as default } from '../dist/compat/string/words.js'; diff --git a/node_modules/es-toolkit/compat/words.js b/node_modules/es-toolkit/compat/words.js new file mode 100644 index 0000000000000000000000000000000000000000..692d4eea2928a34832fa1b73c0f03f31aa244568 --- /dev/null +++ b/node_modules/es-toolkit/compat/words.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/string/words.js').words; diff --git a/node_modules/es-toolkit/compat/wrap.d.ts b/node_modules/es-toolkit/compat/wrap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d4ecdba32ff32487cc5f8110958d91f5d75ffc5 --- /dev/null +++ b/node_modules/es-toolkit/compat/wrap.d.ts @@ -0,0 +1 @@ +export { wrap as default } from '../dist/compat/function/wrap.js'; diff --git a/node_modules/es-toolkit/compat/wrap.js b/node_modules/es-toolkit/compat/wrap.js new file mode 100644 index 0000000000000000000000000000000000000000..72186d995f994df9fae416345a33af7cf803ab3d --- /dev/null +++ b/node_modules/es-toolkit/compat/wrap.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/function/wrap.js').wrap; diff --git a/node_modules/es-toolkit/compat/xor.d.ts b/node_modules/es-toolkit/compat/xor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0df42f89b4a66c57d29a218ee5b3cbb5423c5542 --- /dev/null +++ b/node_modules/es-toolkit/compat/xor.d.ts @@ -0,0 +1 @@ +export { xor as default } from '../dist/compat/array/xor.js'; diff --git a/node_modules/es-toolkit/compat/xor.js b/node_modules/es-toolkit/compat/xor.js new file mode 100644 index 0000000000000000000000000000000000000000..b678b10e8ef3a78d2022c9298fe022df9cab75e7 --- /dev/null +++ b/node_modules/es-toolkit/compat/xor.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/xor.js').xor; diff --git a/node_modules/es-toolkit/compat/xorBy.d.ts b/node_modules/es-toolkit/compat/xorBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b971238c91666f326f1931ded8c2a33db5722b2c --- /dev/null +++ b/node_modules/es-toolkit/compat/xorBy.d.ts @@ -0,0 +1 @@ +export { xorBy as default } from '../dist/compat/array/xorBy.js'; diff --git a/node_modules/es-toolkit/compat/xorBy.js b/node_modules/es-toolkit/compat/xorBy.js new file mode 100644 index 0000000000000000000000000000000000000000..24e76475be85e3f6ecb0644efe0000ce1acb6706 --- /dev/null +++ b/node_modules/es-toolkit/compat/xorBy.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/xorBy.js').xorBy; diff --git a/node_modules/es-toolkit/compat/xorWith.d.ts b/node_modules/es-toolkit/compat/xorWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae202d54854401f93ee5d3df2d285fcc8ff73c42 --- /dev/null +++ b/node_modules/es-toolkit/compat/xorWith.d.ts @@ -0,0 +1 @@ +export { xorWith as default } from '../dist/compat/array/xorWith.js'; diff --git a/node_modules/es-toolkit/compat/xorWith.js b/node_modules/es-toolkit/compat/xorWith.js new file mode 100644 index 0000000000000000000000000000000000000000..32bf76f60c766b4468e5e67dcd4df8ae0ead3c1e --- /dev/null +++ b/node_modules/es-toolkit/compat/xorWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/xorWith.js').xorWith; diff --git a/node_modules/es-toolkit/compat/zip.d.ts b/node_modules/es-toolkit/compat/zip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6598138a57adf2b2963ed95c914d42df05f6a6d6 --- /dev/null +++ b/node_modules/es-toolkit/compat/zip.d.ts @@ -0,0 +1 @@ +export { zip as default } from '../dist/compat/array/zip.js'; diff --git a/node_modules/es-toolkit/compat/zip.js b/node_modules/es-toolkit/compat/zip.js new file mode 100644 index 0000000000000000000000000000000000000000..d92843311f1e1c463d239bb8abd8361676afe02c --- /dev/null +++ b/node_modules/es-toolkit/compat/zip.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/zip.js').zip; diff --git a/node_modules/es-toolkit/compat/zipObject.d.ts b/node_modules/es-toolkit/compat/zipObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9dd14aab93b2a4405518bccfe9b2c4aaaacbbf1 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObject.d.ts @@ -0,0 +1 @@ +export { zipObject as default } from '../dist/compat/array/zipObject.js'; diff --git a/node_modules/es-toolkit/compat/zipObject.js b/node_modules/es-toolkit/compat/zipObject.js new file mode 100644 index 0000000000000000000000000000000000000000..679828dfa7d54198660d9265cae88ec4ed8cf5a6 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObject.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/zipObject.js').zipObject; diff --git a/node_modules/es-toolkit/compat/zipObjectDeep.d.ts b/node_modules/es-toolkit/compat/zipObjectDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0ad24d7112c31d04450c1647505325ce45dde49 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObjectDeep.d.ts @@ -0,0 +1 @@ +export { zipObjectDeep as default } from '../dist/compat/array/zipObjectDeep.js'; diff --git a/node_modules/es-toolkit/compat/zipObjectDeep.js b/node_modules/es-toolkit/compat/zipObjectDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..b9cfe4ccfcc8cb6566b355b3732fb962b08dadf8 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObjectDeep.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/zipObjectDeep.js').zipObjectDeep; diff --git a/node_modules/es-toolkit/compat/zipWith.d.ts b/node_modules/es-toolkit/compat/zipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..808a89b01281190dc4d6693a87e4c89ffc3a42b6 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipWith.d.ts @@ -0,0 +1 @@ +export { zipWith as default } from '../dist/compat/array/zipWith.js'; diff --git a/node_modules/es-toolkit/compat/zipWith.js b/node_modules/es-toolkit/compat/zipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..03f2f8c92f2199b87f5f84ab0d521d835029640b --- /dev/null +++ b/node_modules/es-toolkit/compat/zipWith.js @@ -0,0 +1 @@ +module.exports = require('../dist/compat/array/zipWith.js').zipWith; diff --git a/node_modules/es-toolkit/dist/_internal/compareValues.js b/node_modules/es-toolkit/dist/_internal/compareValues.js new file mode 100644 index 0000000000000000000000000000000000000000..bd24cd4920907f0955c4d2158ae70e78b99cf913 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/compareValues.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function compareValues(a, b, order) { + if (a < b) { + return order === 'asc' ? -1 : 1; + } + if (a > b) { + return order === 'asc' ? 1 : -1; + } + return 0; +} + +exports.compareValues = compareValues; diff --git a/node_modules/es-toolkit/dist/_internal/compareValues.mjs b/node_modules/es-toolkit/dist/_internal/compareValues.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f4ca391ca4ed0b552a8c92c1f73dcdddfdb25459 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/compareValues.mjs @@ -0,0 +1,11 @@ +function compareValues(a, b, order) { + if (a < b) { + return order === 'asc' ? -1 : 1; + } + if (a > b) { + return order === 'asc' ? 1 : -1; + } + return 0; +} + +export { compareValues }; diff --git a/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.d.mts b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a5d40a9a0dc455ec965b205fa08dbab6a1c51ebe --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.d.mts @@ -0,0 +1,16 @@ +/** + * Performs a `SameValueZero` comparison between two values to determine if they are equivalent. + * + * @param {any} value - The value to compare. + * @param {any} other - The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * + * @example + * eq(1, 1); // true + * eq(0, -0); // true + * eq(NaN, NaN); // true + * eq('a', Object('a')); // false + */ +declare function isEqualsSameValueZero(value: any, other: any): boolean; + +export { isEqualsSameValueZero }; diff --git a/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.d.ts b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5d40a9a0dc455ec965b205fa08dbab6a1c51ebe --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.d.ts @@ -0,0 +1,16 @@ +/** + * Performs a `SameValueZero` comparison between two values to determine if they are equivalent. + * + * @param {any} value - The value to compare. + * @param {any} other - The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * + * @example + * eq(1, 1); // true + * eq(0, -0); // true + * eq(NaN, NaN); // true + * eq('a', Object('a')); // false + */ +declare function isEqualsSameValueZero(value: any, other: any): boolean; + +export { isEqualsSameValueZero }; diff --git a/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.js b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.js new file mode 100644 index 0000000000000000000000000000000000000000..cf504173766fa2b9d24ab31701158a7b3b7aa7dd --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function isEqualsSameValueZero(value, other) { + return value === other || (Number.isNaN(value) && Number.isNaN(other)); +} + +exports.isEqualsSameValueZero = isEqualsSameValueZero; diff --git a/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ca61076bcc5828cf1d48dced70c0f6d7237ab63b --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs @@ -0,0 +1,5 @@ +function isEqualsSameValueZero(value, other) { + return value === other || (Number.isNaN(value) && Number.isNaN(other)); +} + +export { isEqualsSameValueZero }; diff --git a/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js b/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..851e66a9e098ba5b4c9bf05e5e3e8a4a9831c37f --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function isUnsafeProperty(key) { + return key === '__proto__'; +} + +exports.isUnsafeProperty = isUnsafeProperty; diff --git a/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs b/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1d19806b8b59ef5058aefd4d6c6c8aa34515b729 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs @@ -0,0 +1,5 @@ +function isUnsafeProperty(key) { + return key === '__proto__'; +} + +export { isUnsafeProperty }; diff --git a/node_modules/es-toolkit/dist/array/at.d.mts b/node_modules/es-toolkit/dist/array/at.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..17bca14a997a8dcde697f1dba14d6b64b41d76ff --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.d.mts @@ -0,0 +1,18 @@ +/** + * Retrieves elements from an array at the specified indices. + * + * This function supports negative indices, which count from the end of the array. + * + * @template T + * @param {readonly T[]} arr - The array to retrieve elements from. + * @param {number[]} indices - An array of indices specifying the positions of elements to retrieve. + * @returns {T[]} A new array containing the elements at the specified indices. + * + * @example + * const numbers = [10, 20, 30, 40, 50]; + * const result = at(numbers, [1, 3, 4]); + * console.log(result); // [20, 40, 50] + */ +declare function at(arr: readonly T[], indices: number[]): T[]; + +export { at }; diff --git a/node_modules/es-toolkit/dist/array/at.d.ts b/node_modules/es-toolkit/dist/array/at.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..17bca14a997a8dcde697f1dba14d6b64b41d76ff --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.d.ts @@ -0,0 +1,18 @@ +/** + * Retrieves elements from an array at the specified indices. + * + * This function supports negative indices, which count from the end of the array. + * + * @template T + * @param {readonly T[]} arr - The array to retrieve elements from. + * @param {number[]} indices - An array of indices specifying the positions of elements to retrieve. + * @returns {T[]} A new array containing the elements at the specified indices. + * + * @example + * const numbers = [10, 20, 30, 40, 50]; + * const result = at(numbers, [1, 3, 4]); + * console.log(result); // [20, 40, 50] + */ +declare function at(arr: readonly T[], indices: number[]): T[]; + +export { at }; diff --git a/node_modules/es-toolkit/dist/array/at.js b/node_modules/es-toolkit/dist/array/at.js new file mode 100644 index 0000000000000000000000000000000000000000..052c833c1cfb3847b2e1fa22592125498d269fcc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function at(arr, indices) { + const result = new Array(indices.length); + const length = arr.length; + for (let i = 0; i < indices.length; i++) { + let index = indices[i]; + index = Number.isInteger(index) ? index : Math.trunc(index) || 0; + if (index < 0) { + index += length; + } + result[i] = arr[index]; + } + return result; +} + +exports.at = at; diff --git a/node_modules/es-toolkit/dist/array/at.mjs b/node_modules/es-toolkit/dist/array/at.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ca7527802399b44f67db509eb53c0e43d051aa0b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.mjs @@ -0,0 +1,15 @@ +function at(arr, indices) { + const result = new Array(indices.length); + const length = arr.length; + for (let i = 0; i < indices.length; i++) { + let index = indices[i]; + index = Number.isInteger(index) ? index : Math.trunc(index) || 0; + if (index < 0) { + index += length; + } + result[i] = arr[index]; + } + return result; +} + +export { at }; diff --git a/node_modules/es-toolkit/dist/array/chunk.d.mts b/node_modules/es-toolkit/dist/array/chunk.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..57f8e6f5bff2d5ff7949d09ac46ec14bf6572985 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.d.mts @@ -0,0 +1,26 @@ +/** + * Splits an array into smaller arrays of a specified length. + * + * This function takes an input array and divides it into multiple smaller arrays, + * each of a specified length. If the input array cannot be evenly divided, + * the final sub-array will contain the remaining elements. + * + * @template T The type of elements in the array. + * @param {T[]} arr - The array to be chunked into smaller arrays. + * @param {number} size - The size of each smaller array. Must be a positive integer. + * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`. + * @throws {Error} Throws an error if `size` is not a positive integer. + * + * @example + * // Splits an array of numbers into sub-arrays of length 2 + * chunk([1, 2, 3, 4, 5], 2); + * // Returns: [[1, 2], [3, 4], [5]] + * + * @example + * // Splits an array of strings into sub-arrays of length 3 + * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3); + * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']] + */ +declare function chunk(arr: readonly T[], size: number): T[][]; + +export { chunk }; diff --git a/node_modules/es-toolkit/dist/array/chunk.d.ts b/node_modules/es-toolkit/dist/array/chunk.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..57f8e6f5bff2d5ff7949d09ac46ec14bf6572985 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.d.ts @@ -0,0 +1,26 @@ +/** + * Splits an array into smaller arrays of a specified length. + * + * This function takes an input array and divides it into multiple smaller arrays, + * each of a specified length. If the input array cannot be evenly divided, + * the final sub-array will contain the remaining elements. + * + * @template T The type of elements in the array. + * @param {T[]} arr - The array to be chunked into smaller arrays. + * @param {number} size - The size of each smaller array. Must be a positive integer. + * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`. + * @throws {Error} Throws an error if `size` is not a positive integer. + * + * @example + * // Splits an array of numbers into sub-arrays of length 2 + * chunk([1, 2, 3, 4, 5], 2); + * // Returns: [[1, 2], [3, 4], [5]] + * + * @example + * // Splits an array of strings into sub-arrays of length 3 + * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3); + * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']] + */ +declare function chunk(arr: readonly T[], size: number): T[][]; + +export { chunk }; diff --git a/node_modules/es-toolkit/dist/array/chunk.js b/node_modules/es-toolkit/dist/array/chunk.js new file mode 100644 index 0000000000000000000000000000000000000000..663a2f588fcb9b2cffe93d27c5b4ef27eff247ed --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function chunk(arr, size) { + if (!Number.isInteger(size) || size <= 0) { + throw new Error('Size must be an integer greater than zero.'); + } + const chunkLength = Math.ceil(arr.length / size); + const result = Array(chunkLength); + for (let index = 0; index < chunkLength; index++) { + const start = index * size; + const end = start + size; + result[index] = arr.slice(start, end); + } + return result; +} + +exports.chunk = chunk; diff --git a/node_modules/es-toolkit/dist/array/chunk.mjs b/node_modules/es-toolkit/dist/array/chunk.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3e4ac5bd9a154c4a0fbae4e43f5b483d8028431c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.mjs @@ -0,0 +1,15 @@ +function chunk(arr, size) { + if (!Number.isInteger(size) || size <= 0) { + throw new Error('Size must be an integer greater than zero.'); + } + const chunkLength = Math.ceil(arr.length / size); + const result = Array(chunkLength); + for (let index = 0; index < chunkLength; index++) { + const start = index * size; + const end = start + size; + result[index] = arr.slice(start, end); + } + return result; +} + +export { chunk }; diff --git a/node_modules/es-toolkit/dist/array/compact.d.mts b/node_modules/es-toolkit/dist/array/compact.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0d99194c59609dcc5ead8aca805a706e41c1261b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.d.mts @@ -0,0 +1,15 @@ +type NotFalsey = Exclude; +/** + * Removes falsey values (false, null, 0, -0, 0n, '', undefined, NaN) from an array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The input array to remove falsey values. + * @returns {Array>} - A new array with all falsey values removed. + * + * @example + * compact([0, -0, 0n, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]); + * Returns: [1, 2, 3, 4, 5] + */ +declare function compact(arr: readonly T[]): Array>; + +export { compact }; diff --git a/node_modules/es-toolkit/dist/array/compact.d.ts b/node_modules/es-toolkit/dist/array/compact.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d99194c59609dcc5ead8aca805a706e41c1261b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.d.ts @@ -0,0 +1,15 @@ +type NotFalsey = Exclude; +/** + * Removes falsey values (false, null, 0, -0, 0n, '', undefined, NaN) from an array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The input array to remove falsey values. + * @returns {Array>} - A new array with all falsey values removed. + * + * @example + * compact([0, -0, 0n, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]); + * Returns: [1, 2, 3, 4, 5] + */ +declare function compact(arr: readonly T[]): Array>; + +export { compact }; diff --git a/node_modules/es-toolkit/dist/array/compact.js b/node_modules/es-toolkit/dist/array/compact.js new file mode 100644 index 0000000000000000000000000000000000000000..c4eb60e173ed83710fe81a321fb25a69f9a4dee6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function compact(arr) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (item) { + result.push(item); + } + } + return result; +} + +exports.compact = compact; diff --git a/node_modules/es-toolkit/dist/array/compact.mjs b/node_modules/es-toolkit/dist/array/compact.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6a572ce2d5434fb666879fc43256c52db221ad05 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.mjs @@ -0,0 +1,12 @@ +function compact(arr) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (item) { + result.push(item); + } + } + return result; +} + +export { compact }; diff --git a/node_modules/es-toolkit/dist/array/countBy.d.mts b/node_modules/es-toolkit/dist/array/countBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3945b949a1a7369b78cfd053e0f323522130457b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.d.mts @@ -0,0 +1,36 @@ +/** + * Count the occurrences of each item in an array + * based on a transformation function. + * + * This function takes an array and a transformation function + * that converts each item in the array to a key. It then + * counts the occurrences of each transformed item and returns + * an object with the transformed items as keys and the counts + * as values. + * + * @template T - The type of the items in the input array. + * @template K - The type of keys. + * @param {T[]} arr - The input array to count occurrences. + * @param {(item: T, index: number, array: readonly T[]) => K} mapper - The transformation function that maps each item, its index, and the array to a key. + * @returns {Record} An object containing the transformed items as keys and the + * counts as values. + * + * @example + * const array = ['a', 'b', 'c', 'a', 'b', 'a']; + * const result = countBy(array, x => x); + * // result will be { a: 3, b: 2, c: 1 } + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = countBy(array, item => item % 2 === 0 ? 'even' : 'odd'); + * // result will be { odd: 3, even: 2 } + * + * @example + * // Using index parameter + * const array = ['a', 'b', 'c', 'd']; + * const result = countBy(array, (item, index) => index < 2 ? 'first' : 'rest'); + * // result will be { first: 2, rest: 2 } + */ +declare function countBy(arr: readonly T[], mapper: (item: T, index: number, array: readonly T[]) => K): Record; + +export { countBy }; diff --git a/node_modules/es-toolkit/dist/array/countBy.d.ts b/node_modules/es-toolkit/dist/array/countBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3945b949a1a7369b78cfd053e0f323522130457b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.d.ts @@ -0,0 +1,36 @@ +/** + * Count the occurrences of each item in an array + * based on a transformation function. + * + * This function takes an array and a transformation function + * that converts each item in the array to a key. It then + * counts the occurrences of each transformed item and returns + * an object with the transformed items as keys and the counts + * as values. + * + * @template T - The type of the items in the input array. + * @template K - The type of keys. + * @param {T[]} arr - The input array to count occurrences. + * @param {(item: T, index: number, array: readonly T[]) => K} mapper - The transformation function that maps each item, its index, and the array to a key. + * @returns {Record} An object containing the transformed items as keys and the + * counts as values. + * + * @example + * const array = ['a', 'b', 'c', 'a', 'b', 'a']; + * const result = countBy(array, x => x); + * // result will be { a: 3, b: 2, c: 1 } + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = countBy(array, item => item % 2 === 0 ? 'even' : 'odd'); + * // result will be { odd: 3, even: 2 } + * + * @example + * // Using index parameter + * const array = ['a', 'b', 'c', 'd']; + * const result = countBy(array, (item, index) => index < 2 ? 'first' : 'rest'); + * // result will be { first: 2, rest: 2 } + */ +declare function countBy(arr: readonly T[], mapper: (item: T, index: number, array: readonly T[]) => K): Record; + +export { countBy }; diff --git a/node_modules/es-toolkit/dist/array/countBy.js b/node_modules/es-toolkit/dist/array/countBy.js new file mode 100644 index 0000000000000000000000000000000000000000..aec17d046acb48b7dbc972a20ff540a8100db8cd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function countBy(arr, mapper) { + const result = {}; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = mapper(item, i, arr); + result[key] = (result[key] ?? 0) + 1; + } + return result; +} + +exports.countBy = countBy; diff --git a/node_modules/es-toolkit/dist/array/countBy.mjs b/node_modules/es-toolkit/dist/array/countBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..83464e605e2f3a6e6a7391c3f2d8a7e475b0ce05 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.mjs @@ -0,0 +1,11 @@ +function countBy(arr, mapper) { + const result = {}; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = mapper(item, i, arr); + result[key] = (result[key] ?? 0) + 1; + } + return result; +} + +export { countBy }; diff --git a/node_modules/es-toolkit/dist/array/difference.d.mts b/node_modules/es-toolkit/dist/array/difference.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5088392d97433ca12639d0c5e503b1afb5b23230 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.d.mts @@ -0,0 +1,25 @@ +/** + * Computes the difference between two arrays. + * + * This function takes two arrays and returns a new array containing the elements + * that are present in the first array but not in the second array. It effectively + * filters out any elements from the first array that also appear in the second array. + * + * @template T + * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array + * from which elements will be compared and filtered. + * @param {T[]} secondArr - The array containing elements to be excluded from the first array. + * Each element in this array will be checked against the first array, and if a match is found, + * that element will be excluded from the result. + * @returns {T[]} A new array containing the elements that are present in the first array but not + * in the second array. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [2, 4]; + * const result = difference(array1, array2); + * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result. + */ +declare function difference(firstArr: readonly T[], secondArr: readonly T[]): T[]; + +export { difference }; diff --git a/node_modules/es-toolkit/dist/array/difference.d.ts b/node_modules/es-toolkit/dist/array/difference.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5088392d97433ca12639d0c5e503b1afb5b23230 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.d.ts @@ -0,0 +1,25 @@ +/** + * Computes the difference between two arrays. + * + * This function takes two arrays and returns a new array containing the elements + * that are present in the first array but not in the second array. It effectively + * filters out any elements from the first array that also appear in the second array. + * + * @template T + * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array + * from which elements will be compared and filtered. + * @param {T[]} secondArr - The array containing elements to be excluded from the first array. + * Each element in this array will be checked against the first array, and if a match is found, + * that element will be excluded from the result. + * @returns {T[]} A new array containing the elements that are present in the first array but not + * in the second array. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [2, 4]; + * const result = difference(array1, array2); + * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result. + */ +declare function difference(firstArr: readonly T[], secondArr: readonly T[]): T[]; + +export { difference }; diff --git a/node_modules/es-toolkit/dist/array/difference.js b/node_modules/es-toolkit/dist/array/difference.js new file mode 100644 index 0000000000000000000000000000000000000000..c8209bbbc1c9bd95dedd4aef3bf2e626b41275d1 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.js @@ -0,0 +1,10 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function difference(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter(item => !secondSet.has(item)); +} + +exports.difference = difference; diff --git a/node_modules/es-toolkit/dist/array/difference.mjs b/node_modules/es-toolkit/dist/array/difference.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c3e0eb448261bbe7f1c481ed258186880898f5e9 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.mjs @@ -0,0 +1,6 @@ +function difference(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter(item => !secondSet.has(item)); +} + +export { difference }; diff --git a/node_modules/es-toolkit/dist/array/differenceBy.d.mts b/node_modules/es-toolkit/dist/array/differenceBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..15809254ea78ad975991d1cd89d90ff1f7b9b772 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.d.mts @@ -0,0 +1,35 @@ +/** + * Computes the difference between two arrays after mapping their elements through a provided function. + * + * This function takes two arrays and a mapper function. It returns a new array containing the elements + * that are present in the first array but not in the second array, based on the identity calculated + * by the mapper function. + * + * Essentially, it filters out any elements from the first array that, when + * mapped, match an element in the mapped version of the second array. + * + * @template T, U + * @param {T[]} firstArr - The primary array from which to derive the difference. + * @param {U[]} secondArr - The array containing elements to be excluded from the first array. + * @param {(value: T | U) => unknown} mapper - The function to map the elements of both arrays. This function + * is applied to each element in both arrays, and the comparison is made based on the mapped values. + * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding + * mapped identity in the second array. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const mapper = item => item.id; + * const result = differenceBy(array1, array2, mapper); + * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [2, 4]; + * const mapper = item => (typeof item === 'object' ? item.id : item); + * const result = differenceBy(array1, array2, mapper); + * // result will be [{ id: 1 }, { id: 3 }] since 2 is present in both arrays after mapping, and is excluded from the result. + */ +declare function differenceBy(firstArr: readonly T[], secondArr: readonly U[], mapper: (value: T | U) => unknown): T[]; + +export { differenceBy }; diff --git a/node_modules/es-toolkit/dist/array/differenceBy.d.ts b/node_modules/es-toolkit/dist/array/differenceBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..15809254ea78ad975991d1cd89d90ff1f7b9b772 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.d.ts @@ -0,0 +1,35 @@ +/** + * Computes the difference between two arrays after mapping their elements through a provided function. + * + * This function takes two arrays and a mapper function. It returns a new array containing the elements + * that are present in the first array but not in the second array, based on the identity calculated + * by the mapper function. + * + * Essentially, it filters out any elements from the first array that, when + * mapped, match an element in the mapped version of the second array. + * + * @template T, U + * @param {T[]} firstArr - The primary array from which to derive the difference. + * @param {U[]} secondArr - The array containing elements to be excluded from the first array. + * @param {(value: T | U) => unknown} mapper - The function to map the elements of both arrays. This function + * is applied to each element in both arrays, and the comparison is made based on the mapped values. + * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding + * mapped identity in the second array. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const mapper = item => item.id; + * const result = differenceBy(array1, array2, mapper); + * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [2, 4]; + * const mapper = item => (typeof item === 'object' ? item.id : item); + * const result = differenceBy(array1, array2, mapper); + * // result will be [{ id: 1 }, { id: 3 }] since 2 is present in both arrays after mapping, and is excluded from the result. + */ +declare function differenceBy(firstArr: readonly T[], secondArr: readonly U[], mapper: (value: T | U) => unknown): T[]; + +export { differenceBy }; diff --git a/node_modules/es-toolkit/dist/array/differenceBy.js b/node_modules/es-toolkit/dist/array/differenceBy.js new file mode 100644 index 0000000000000000000000000000000000000000..19d0ab5a81267f8770840ad496e610ba0da3623e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function differenceBy(firstArr, secondArr, mapper) { + const mappedSecondSet = new Set(secondArr.map(item => mapper(item))); + return firstArr.filter(item => { + return !mappedSecondSet.has(mapper(item)); + }); +} + +exports.differenceBy = differenceBy; diff --git a/node_modules/es-toolkit/dist/array/differenceBy.mjs b/node_modules/es-toolkit/dist/array/differenceBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fa92712f5c4236286279b5b05fa83b75c2dd7cd9 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.mjs @@ -0,0 +1,8 @@ +function differenceBy(firstArr, secondArr, mapper) { + const mappedSecondSet = new Set(secondArr.map(item => mapper(item))); + return firstArr.filter(item => { + return !mappedSecondSet.has(mapper(item)); + }); +} + +export { differenceBy }; diff --git a/node_modules/es-toolkit/dist/array/differenceWith.d.mts b/node_modules/es-toolkit/dist/array/differenceWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..67de1b2cf915c0f65e7099dccba692af12b93cbf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.d.mts @@ -0,0 +1,31 @@ +/** + * Computes the difference between two arrays based on a custom equality function. + * + * This function takes two arrays and a custom comparison function. It returns a new array containing + * the elements that are present in the first array but not in the second array. The comparison to determine + * if elements are equal is made using the provided custom function. + * + * @template T, U + * @param {T[]} firstArr - The array from which to get the difference. + * @param {U[]} secondArr - The array containing elements to exclude from the first array. + * @param {(x: T, y: U) => boolean} areItemsEqual - A function to determine if two items are equal. + * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array + * according to the custom equality function. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * const result = differenceWith(array1, array2, areItemsEqual); + * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [2, 4]; + * const areItemsEqual = (a, b) => a.id === b; + * const result = differenceWith(array1, array2, areItemsEqual); + * // result will be [{ id: 1 }, { id: 3 }] since the element with id 2 is considered equal to the second array's element and is excluded from the result. + */ +declare function differenceWith(firstArr: readonly T[], secondArr: readonly U[], areItemsEqual: (x: T, y: U) => boolean): T[]; + +export { differenceWith }; diff --git a/node_modules/es-toolkit/dist/array/differenceWith.d.ts b/node_modules/es-toolkit/dist/array/differenceWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67de1b2cf915c0f65e7099dccba692af12b93cbf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.d.ts @@ -0,0 +1,31 @@ +/** + * Computes the difference between two arrays based on a custom equality function. + * + * This function takes two arrays and a custom comparison function. It returns a new array containing + * the elements that are present in the first array but not in the second array. The comparison to determine + * if elements are equal is made using the provided custom function. + * + * @template T, U + * @param {T[]} firstArr - The array from which to get the difference. + * @param {U[]} secondArr - The array containing elements to exclude from the first array. + * @param {(x: T, y: U) => boolean} areItemsEqual - A function to determine if two items are equal. + * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array + * according to the custom equality function. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * const result = differenceWith(array1, array2, areItemsEqual); + * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [2, 4]; + * const areItemsEqual = (a, b) => a.id === b; + * const result = differenceWith(array1, array2, areItemsEqual); + * // result will be [{ id: 1 }, { id: 3 }] since the element with id 2 is considered equal to the second array's element and is excluded from the result. + */ +declare function differenceWith(firstArr: readonly T[], secondArr: readonly U[], areItemsEqual: (x: T, y: U) => boolean): T[]; + +export { differenceWith }; diff --git a/node_modules/es-toolkit/dist/array/differenceWith.js b/node_modules/es-toolkit/dist/array/differenceWith.js new file mode 100644 index 0000000000000000000000000000000000000000..3794a2a61d36211b8d3b9c2ea9f7d7b48144fc72 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function differenceWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter(firstItem => { + return secondArr.every(secondItem => { + return !areItemsEqual(firstItem, secondItem); + }); + }); +} + +exports.differenceWith = differenceWith; diff --git a/node_modules/es-toolkit/dist/array/differenceWith.mjs b/node_modules/es-toolkit/dist/array/differenceWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..79622c90f27736c38c22fc0487cc0212d8d6e802 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.mjs @@ -0,0 +1,9 @@ +function differenceWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter(firstItem => { + return secondArr.every(secondItem => { + return !areItemsEqual(firstItem, secondItem); + }); + }); +} + +export { differenceWith }; diff --git a/node_modules/es-toolkit/dist/array/drop.d.mts b/node_modules/es-toolkit/dist/array/drop.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..10f27547dd2d31c1480a11c8c9c4d17b0ba74adb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.d.mts @@ -0,0 +1,19 @@ +/** + * Removes a specified number of elements from the beginning of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the start. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the beginning of the array. + * @returns {T[]} A new array with the specified number of elements removed from the start. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = drop(array, 2); + * // result will be [3, 4, 5] since the first two elements are dropped. + */ +declare function drop(arr: readonly T[], itemsCount: number): T[]; + +export { drop }; diff --git a/node_modules/es-toolkit/dist/array/drop.d.ts b/node_modules/es-toolkit/dist/array/drop.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..10f27547dd2d31c1480a11c8c9c4d17b0ba74adb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.d.ts @@ -0,0 +1,19 @@ +/** + * Removes a specified number of elements from the beginning of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the start. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the beginning of the array. + * @returns {T[]} A new array with the specified number of elements removed from the start. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = drop(array, 2); + * // result will be [3, 4, 5] since the first two elements are dropped. + */ +declare function drop(arr: readonly T[], itemsCount: number): T[]; + +export { drop }; diff --git a/node_modules/es-toolkit/dist/array/drop.js b/node_modules/es-toolkit/dist/array/drop.js new file mode 100644 index 0000000000000000000000000000000000000000..dc08ad4b36be8658f444ad64ec7b99d52ca45499 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.js @@ -0,0 +1,10 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function drop(arr, itemsCount) { + itemsCount = Math.max(itemsCount, 0); + return arr.slice(itemsCount); +} + +exports.drop = drop; diff --git a/node_modules/es-toolkit/dist/array/drop.mjs b/node_modules/es-toolkit/dist/array/drop.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cfc979ec60bebbe15bed01d3d5536c88d8135580 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.mjs @@ -0,0 +1,6 @@ +function drop(arr, itemsCount) { + itemsCount = Math.max(itemsCount, 0); + return arr.slice(itemsCount); +} + +export { drop }; diff --git a/node_modules/es-toolkit/dist/array/dropRight.d.mts b/node_modules/es-toolkit/dist/array/dropRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c70bdb21fd74ece07e9e06397d4d4364563074bf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.d.mts @@ -0,0 +1,19 @@ +/** + * Removes a specified number of elements from the end of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the end. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the end of the array. + * @returns {T[]} A new array with the specified number of elements removed from the end. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropRight(array, 2); + * // result will be [1, 2, 3] since the last two elements are dropped. + */ +declare function dropRight(arr: readonly T[], itemsCount: number): T[]; + +export { dropRight }; diff --git a/node_modules/es-toolkit/dist/array/dropRight.d.ts b/node_modules/es-toolkit/dist/array/dropRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c70bdb21fd74ece07e9e06397d4d4364563074bf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.d.ts @@ -0,0 +1,19 @@ +/** + * Removes a specified number of elements from the end of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the end. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the end of the array. + * @returns {T[]} A new array with the specified number of elements removed from the end. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropRight(array, 2); + * // result will be [1, 2, 3] since the last two elements are dropped. + */ +declare function dropRight(arr: readonly T[], itemsCount: number): T[]; + +export { dropRight }; diff --git a/node_modules/es-toolkit/dist/array/dropRight.js b/node_modules/es-toolkit/dist/array/dropRight.js new file mode 100644 index 0000000000000000000000000000000000000000..53fc531eefea540dd7995e7498ff2aea7e8ce799 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function dropRight(arr, itemsCount) { + itemsCount = Math.min(-itemsCount, 0); + if (itemsCount === 0) { + return arr.slice(); + } + return arr.slice(0, itemsCount); +} + +exports.dropRight = dropRight; diff --git a/node_modules/es-toolkit/dist/array/dropRight.mjs b/node_modules/es-toolkit/dist/array/dropRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ceec852dd68058102931aeb8f79acfa8827f0203 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.mjs @@ -0,0 +1,9 @@ +function dropRight(arr, itemsCount) { + itemsCount = Math.min(-itemsCount, 0); + if (itemsCount === 0) { + return arr.slice(); + } + return arr.slice(0, itemsCount); +} + +export { dropRight }; diff --git a/node_modules/es-toolkit/dist/array/dropRightWhile.d.mts b/node_modules/es-toolkit/dist/array/dropRightWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..48bca56de5a998bfe30f1b0c34adb8c71bea6cdf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.d.mts @@ -0,0 +1,21 @@ +/** + * Removes elements from the end of an array until the predicate returns false. + * + * This function iterates over an array from the end and drops elements until the provided + * predicate function returns false. It then returns a new array with the remaining elements. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {(item: T, index: number, arr: T[]) => boolean} canContinueDropping - A predicate function that determines + * whether to continue dropping elements. The function is called with each element from the end, + * and dropping continues as long as it returns true. + * @returns {T[]} A new array with the elements remaining after the predicate returns false. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropRightWhile(array, x => x > 3); + * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end. + */ +declare function dropRightWhile(arr: readonly T[], canContinueDropping: (item: T, index: number, arr: readonly T[]) => boolean): T[]; + +export { dropRightWhile }; diff --git a/node_modules/es-toolkit/dist/array/dropRightWhile.d.ts b/node_modules/es-toolkit/dist/array/dropRightWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..48bca56de5a998bfe30f1b0c34adb8c71bea6cdf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.d.ts @@ -0,0 +1,21 @@ +/** + * Removes elements from the end of an array until the predicate returns false. + * + * This function iterates over an array from the end and drops elements until the provided + * predicate function returns false. It then returns a new array with the remaining elements. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {(item: T, index: number, arr: T[]) => boolean} canContinueDropping - A predicate function that determines + * whether to continue dropping elements. The function is called with each element from the end, + * and dropping continues as long as it returns true. + * @returns {T[]} A new array with the elements remaining after the predicate returns false. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropRightWhile(array, x => x > 3); + * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end. + */ +declare function dropRightWhile(arr: readonly T[], canContinueDropping: (item: T, index: number, arr: readonly T[]) => boolean): T[]; + +export { dropRightWhile }; diff --git a/node_modules/es-toolkit/dist/array/dropRightWhile.js b/node_modules/es-toolkit/dist/array/dropRightWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..c0c57e3496cda7772d23276e46bd23adfa332397 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function dropRightWhile(arr, canContinueDropping) { + for (let i = arr.length - 1; i >= 0; i--) { + if (!canContinueDropping(arr[i], i, arr)) { + return arr.slice(0, i + 1); + } + } + return []; +} + +exports.dropRightWhile = dropRightWhile; diff --git a/node_modules/es-toolkit/dist/array/dropRightWhile.mjs b/node_modules/es-toolkit/dist/array/dropRightWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4999b9b04ae1c2072940af6ccd919f85881e7860 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.mjs @@ -0,0 +1,10 @@ +function dropRightWhile(arr, canContinueDropping) { + for (let i = arr.length - 1; i >= 0; i--) { + if (!canContinueDropping(arr[i], i, arr)) { + return arr.slice(0, i + 1); + } + } + return []; +} + +export { dropRightWhile }; diff --git a/node_modules/es-toolkit/dist/array/dropWhile.d.mts b/node_modules/es-toolkit/dist/array/dropWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..182cbde5d5fbe0cf6f9495eea63bdd0ef775fc6c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.d.mts @@ -0,0 +1,21 @@ +/** + * Removes elements from the beginning of an array until the predicate returns false. + * + * This function iterates over an array and drops elements from the start until the provided + * predicate function returns false. It then returns a new array with the remaining elements. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {(item: T, index: number, arr: T[]) => boolean} canContinueDropping - A predicate function that determines + * whether to continue dropping elements. The function is called with each element, and dropping + * continues as long as it returns true. + * @returns {T[]} A new array with the elements remaining after the predicate returns false. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropWhile(array, x => x < 3); + * // result will be [3, 4, 5] since elements less than 3 are dropped. + */ +declare function dropWhile(arr: readonly T[], canContinueDropping: (item: T, index: number, arr: readonly T[]) => boolean): T[]; + +export { dropWhile }; diff --git a/node_modules/es-toolkit/dist/array/dropWhile.d.ts b/node_modules/es-toolkit/dist/array/dropWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..182cbde5d5fbe0cf6f9495eea63bdd0ef775fc6c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.d.ts @@ -0,0 +1,21 @@ +/** + * Removes elements from the beginning of an array until the predicate returns false. + * + * This function iterates over an array and drops elements from the start until the provided + * predicate function returns false. It then returns a new array with the remaining elements. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to drop elements. + * @param {(item: T, index: number, arr: T[]) => boolean} canContinueDropping - A predicate function that determines + * whether to continue dropping elements. The function is called with each element, and dropping + * continues as long as it returns true. + * @returns {T[]} A new array with the elements remaining after the predicate returns false. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropWhile(array, x => x < 3); + * // result will be [3, 4, 5] since elements less than 3 are dropped. + */ +declare function dropWhile(arr: readonly T[], canContinueDropping: (item: T, index: number, arr: readonly T[]) => boolean): T[]; + +export { dropWhile }; diff --git a/node_modules/es-toolkit/dist/array/dropWhile.js b/node_modules/es-toolkit/dist/array/dropWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..698ed179efec9f3ba49adbccb85b56ccc93ad797 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function dropWhile(arr, canContinueDropping) { + const dropEndIndex = arr.findIndex((item, index, arr) => !canContinueDropping(item, index, arr)); + if (dropEndIndex === -1) { + return []; + } + return arr.slice(dropEndIndex); +} + +exports.dropWhile = dropWhile; diff --git a/node_modules/es-toolkit/dist/array/dropWhile.mjs b/node_modules/es-toolkit/dist/array/dropWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5197c213fed6185a2854aab63c81189069120c0c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.mjs @@ -0,0 +1,9 @@ +function dropWhile(arr, canContinueDropping) { + const dropEndIndex = arr.findIndex((item, index, arr) => !canContinueDropping(item, index, arr)); + if (dropEndIndex === -1) { + return []; + } + return arr.slice(dropEndIndex); +} + +export { dropWhile }; diff --git a/node_modules/es-toolkit/dist/array/fill.d.mts b/node_modules/es-toolkit/dist/array/fill.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fd57b69fa45c18595223a4643f95468a6f0dda10 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.d.mts @@ -0,0 +1,88 @@ +/** + * Fills the whole array with a specified value. + * + * This function mutates the original array and replaces its elements with the provided value, starting from the specified + * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the + * entire array. + * + * @template T - The type of the value to fill the array with. + * @param {unknown[]} array - The array to fill. + * @param {T} value - The value to fill the array with. + * @returns {T[]} The array with the filled values. + * + * @example + * const array = [1, 2, 3]; + * const result = fill(array, 'a'); + * // => ['a', 'a', 'a'] + * + * const result = fill(Array(3), 2); + * // => [2, 2, 2] + * + * const result = fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * const result = fill(array, '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: unknown[], value: T): T[]; +/** + * Fills elements of an array with a specified value from the start position up to the end of the array. + * + * This function mutates the original array and replaces its elements with the provided value, starting from the specified + * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the + * entire array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the array with. + * @param {Array} array - The array to fill. + * @param {U} value - The value to fill the array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @returns {Array} The array with the filled values. + * + * @example + * const array = [1, 2, 3]; + * const result = fill(array, 'a'); + * // => ['a', 'a', 'a'] + * + * const result = fill(Array(3), 2); + * // => [2, 2, 2] + * + * const result = fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * const result = fill(array, '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: Array, value: U, start: number): Array; +/** + * Fills elements of an array with a specified value from the start position up to, but not including, the end position. + * + * This function mutates the original array and replaces its elements with the provided value, starting from the specified + * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the + * entire array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the array with. + * @param {Array} array - The array to fill. + * @param {U} value - The value to fill the array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @param {number} [end=arr.length] - The end position. Defaults to the array's length. + * @returns {Array} The array with the filled values. + * + * @example + * const array = [1, 2, 3]; + * const result = fill(array, 'a'); + * // => ['a', 'a', 'a'] + * + * const result = fill(Array(3), 2); + * // => [2, 2, 2] + * + * const result = fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * const result = fill(array, '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: Array, value: U, start: number, end: number): Array; + +export { fill }; diff --git a/node_modules/es-toolkit/dist/array/fill.d.ts b/node_modules/es-toolkit/dist/array/fill.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd57b69fa45c18595223a4643f95468a6f0dda10 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.d.ts @@ -0,0 +1,88 @@ +/** + * Fills the whole array with a specified value. + * + * This function mutates the original array and replaces its elements with the provided value, starting from the specified + * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the + * entire array. + * + * @template T - The type of the value to fill the array with. + * @param {unknown[]} array - The array to fill. + * @param {T} value - The value to fill the array with. + * @returns {T[]} The array with the filled values. + * + * @example + * const array = [1, 2, 3]; + * const result = fill(array, 'a'); + * // => ['a', 'a', 'a'] + * + * const result = fill(Array(3), 2); + * // => [2, 2, 2] + * + * const result = fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * const result = fill(array, '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: unknown[], value: T): T[]; +/** + * Fills elements of an array with a specified value from the start position up to the end of the array. + * + * This function mutates the original array and replaces its elements with the provided value, starting from the specified + * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the + * entire array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the array with. + * @param {Array} array - The array to fill. + * @param {U} value - The value to fill the array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @returns {Array} The array with the filled values. + * + * @example + * const array = [1, 2, 3]; + * const result = fill(array, 'a'); + * // => ['a', 'a', 'a'] + * + * const result = fill(Array(3), 2); + * // => [2, 2, 2] + * + * const result = fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * const result = fill(array, '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: Array, value: U, start: number): Array; +/** + * Fills elements of an array with a specified value from the start position up to, but not including, the end position. + * + * This function mutates the original array and replaces its elements with the provided value, starting from the specified + * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the + * entire array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the array with. + * @param {Array} array - The array to fill. + * @param {U} value - The value to fill the array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @param {number} [end=arr.length] - The end position. Defaults to the array's length. + * @returns {Array} The array with the filled values. + * + * @example + * const array = [1, 2, 3]; + * const result = fill(array, 'a'); + * // => ['a', 'a', 'a'] + * + * const result = fill(Array(3), 2); + * // => [2, 2, 2] + * + * const result = fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * const result = fill(array, '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: Array, value: U, start: number, end: number): Array; + +export { fill }; diff --git a/node_modules/es-toolkit/dist/array/fill.js b/node_modules/es-toolkit/dist/array/fill.js new file mode 100644 index 0000000000000000000000000000000000000000..2d772443d5ee68680892e87964695f77781bdecc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function fill(array, value, start = 0, end = array.length) { + const length = array.length; + const finalStart = Math.max(start >= 0 ? start : length + start, 0); + const finalEnd = Math.min(end >= 0 ? end : length + end, length); + for (let i = finalStart; i < finalEnd; i++) { + array[i] = value; + } + return array; +} + +exports.fill = fill; diff --git a/node_modules/es-toolkit/dist/array/fill.mjs b/node_modules/es-toolkit/dist/array/fill.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fae3b22503c7278b360c4ba0479a5fd63c034da8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.mjs @@ -0,0 +1,11 @@ +function fill(array, value, start = 0, end = array.length) { + const length = array.length; + const finalStart = Math.max(start >= 0 ? start : length + start, 0); + const finalEnd = Math.min(end >= 0 ? end : length + end, length); + for (let i = finalStart; i < finalEnd; i++) { + array[i] = value; + } + return array; +} + +export { fill }; diff --git a/node_modules/es-toolkit/dist/array/filterAsync.d.mts b/node_modules/es-toolkit/dist/array/filterAsync.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..af9ecb7dfa32dd5aeb30563bc30cf976b636138b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.d.mts @@ -0,0 +1,35 @@ +interface FilterAsyncOptions { + concurrency?: number; +} +/** + * Filters an array asynchronously using an async predicate function. + * + * Returns a promise that resolves to a new array containing only the elements + * for which the predicate function returns a truthy value. + * + * @template T - The type of elements in the array. + * @param {readonly T[]} array The array to filter. + * @param {(item: T, index: number, array: readonly T[]) => Promise} predicate An async function that tests each element. + * @param {FilterAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves to the filtered array. + * @example + * const users = [{ id: 1, active: true }, { id: 2, active: false }, { id: 3, active: true }]; + * const activeUsers = await filterAsync(users, async (user) => { + * return await checkUserStatus(user.id); + * }); + * // Returns: [{ id: 1, active: true }, { id: 3, active: true }] + * + * @example + * // With concurrency limit + * const numbers = [1, 2, 3, 4, 5]; + * const evenNumbers = await filterAsync( + * numbers, + * async (n) => await isEvenAsync(n), + * { concurrency: 2 } + * ); + * // Processes at most 2 operations concurrently + */ +declare function filterAsync(array: readonly T[], predicate: (item: T, index: number, array: readonly T[]) => Promise, options?: FilterAsyncOptions): Promise; + +export { filterAsync }; diff --git a/node_modules/es-toolkit/dist/array/filterAsync.d.ts b/node_modules/es-toolkit/dist/array/filterAsync.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..af9ecb7dfa32dd5aeb30563bc30cf976b636138b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.d.ts @@ -0,0 +1,35 @@ +interface FilterAsyncOptions { + concurrency?: number; +} +/** + * Filters an array asynchronously using an async predicate function. + * + * Returns a promise that resolves to a new array containing only the elements + * for which the predicate function returns a truthy value. + * + * @template T - The type of elements in the array. + * @param {readonly T[]} array The array to filter. + * @param {(item: T, index: number, array: readonly T[]) => Promise} predicate An async function that tests each element. + * @param {FilterAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves to the filtered array. + * @example + * const users = [{ id: 1, active: true }, { id: 2, active: false }, { id: 3, active: true }]; + * const activeUsers = await filterAsync(users, async (user) => { + * return await checkUserStatus(user.id); + * }); + * // Returns: [{ id: 1, active: true }, { id: 3, active: true }] + * + * @example + * // With concurrency limit + * const numbers = [1, 2, 3, 4, 5]; + * const evenNumbers = await filterAsync( + * numbers, + * async (n) => await isEvenAsync(n), + * { concurrency: 2 } + * ); + * // Processes at most 2 operations concurrently + */ +declare function filterAsync(array: readonly T[], predicate: (item: T, index: number, array: readonly T[]) => Promise, options?: FilterAsyncOptions): Promise; + +export { filterAsync }; diff --git a/node_modules/es-toolkit/dist/array/filterAsync.js b/node_modules/es-toolkit/dist/array/filterAsync.js new file mode 100644 index 0000000000000000000000000000000000000000..8c7c9caede6e0e28432aaceb7e014a7f55d607e6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const limitAsync = require('./limitAsync.js'); + +async function filterAsync(array, predicate, options) { + if (options?.concurrency != null) { + predicate = limitAsync.limitAsync(predicate, options.concurrency); + } + const results = await Promise.all(array.map(predicate)); + return array.filter((_, index) => results[index]); +} + +exports.filterAsync = filterAsync; diff --git a/node_modules/es-toolkit/dist/array/filterAsync.mjs b/node_modules/es-toolkit/dist/array/filterAsync.mjs new file mode 100644 index 0000000000000000000000000000000000000000..28913c61fa9d38f028e76b4e0bf9db04584231d5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.mjs @@ -0,0 +1,11 @@ +import { limitAsync } from './limitAsync.mjs'; + +async function filterAsync(array, predicate, options) { + if (options?.concurrency != null) { + predicate = limitAsync(predicate, options.concurrency); + } + const results = await Promise.all(array.map(predicate)); + return array.filter((_, index) => results[index]); +} + +export { filterAsync }; diff --git a/node_modules/es-toolkit/dist/array/flatMap.d.mts b/node_modules/es-toolkit/dist/array/flatMap.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9c2548cc6cefbd10c62e36350a2e10b16640eb45 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.d.mts @@ -0,0 +1,23 @@ +/** + * Maps each element in the array using the iteratee function and flattens the result up to the specified depth. + * + * @template T - The type of elements within the array. + * @template U - The type of elements within the returned array from the iteratee function. + * @template D - The depth to which the array should be flattened. + * @param {T[]} arr - The array to flatten. + * @param {(item: T, index: number, array: readonly T[]) => U} iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns {Array>} The new array with the mapped and flattened elements. + * + * @example + * const arr = [1, 2, 3]; + * + * flatMap(arr, (item: number) => [item, item]); + * // [1, 1, 2, 2, 3, 3] + * + * flatMap(arr, (item: number) => [[item, item]], 2); + * // [1, 1, 2, 2, 3, 3] + */ +declare function flatMap(arr: readonly T[], iteratee: (item: T, index: number, array: readonly T[]) => U, depth?: D): Array>; + +export { flatMap }; diff --git a/node_modules/es-toolkit/dist/array/flatMap.d.ts b/node_modules/es-toolkit/dist/array/flatMap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9c2548cc6cefbd10c62e36350a2e10b16640eb45 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.d.ts @@ -0,0 +1,23 @@ +/** + * Maps each element in the array using the iteratee function and flattens the result up to the specified depth. + * + * @template T - The type of elements within the array. + * @template U - The type of elements within the returned array from the iteratee function. + * @template D - The depth to which the array should be flattened. + * @param {T[]} arr - The array to flatten. + * @param {(item: T, index: number, array: readonly T[]) => U} iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns {Array>} The new array with the mapped and flattened elements. + * + * @example + * const arr = [1, 2, 3]; + * + * flatMap(arr, (item: number) => [item, item]); + * // [1, 1, 2, 2, 3, 3] + * + * flatMap(arr, (item: number) => [[item, item]], 2); + * // [1, 1, 2, 2, 3, 3] + */ +declare function flatMap(arr: readonly T[], iteratee: (item: T, index: number, array: readonly T[]) => U, depth?: D): Array>; + +export { flatMap }; diff --git a/node_modules/es-toolkit/dist/array/flatMap.js b/node_modules/es-toolkit/dist/array/flatMap.js new file mode 100644 index 0000000000000000000000000000000000000000..ca0b421f938d4964b884acff6c3e5d4f1a042821 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('./flatten.js'); + +function flatMap(arr, iteratee, depth = 1) { + return flatten.flatten(arr.map((item, index) => iteratee(item, index, arr)), depth); +} + +exports.flatMap = flatMap; diff --git a/node_modules/es-toolkit/dist/array/flatMap.mjs b/node_modules/es-toolkit/dist/array/flatMap.mjs new file mode 100644 index 0000000000000000000000000000000000000000..13c09b8b6678ddb00fa921a200ea9ed18a6410f2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.mjs @@ -0,0 +1,7 @@ +import { flatten } from './flatten.mjs'; + +function flatMap(arr, iteratee, depth = 1) { + return flatten(arr.map((item, index) => iteratee(item, index, arr)), depth); +} + +export { flatMap }; diff --git a/node_modules/es-toolkit/dist/array/flatMapAsync.d.mts b/node_modules/es-toolkit/dist/array/flatMapAsync.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b3ee5bcd80f8516c2d57ecd2d306236732c809d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.d.mts @@ -0,0 +1,37 @@ +interface FlatMapAsyncOptions { + concurrency?: number; +} +/** + * Maps each element in an array using an async callback function and flattens the result by one level. + * + * This is equivalent to calling `mapAsync` followed by `flat(1)`, but more efficient. + * Each callback should return an array, and all returned arrays are concatenated into + * a single output array. + * + * @template T - The type of elements in the input array. + * @template R - The type of elements in the arrays returned by the callback. + * @param {readonly T[]} array The array to transform. + * @param {(item: T, index: number, array: readonly T[]) => Promise} callback An async function that transforms each element into an array. + * @param {FlatMapAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves to a flattened array of transformed values. + * @example + * const users = [{ id: 1 }, { id: 2 }]; + * const allPosts = await flatMapAsync(users, async (user) => { + * return await fetchUserPosts(user.id); + * }); + * // Returns: [post1, post2, post3, ...] (all posts from all users) + * + * @example + * // With concurrency limit + * const numbers = [1, 2, 3]; + * const results = await flatMapAsync( + * numbers, + * async (n) => await fetchRelatedItems(n), + * { concurrency: 2 } + * ); + * // Processes at most 2 operations concurrently + */ +declare function flatMapAsync(array: readonly T[], callback: (item: T, index: number, array: readonly T[]) => Promise, options?: FlatMapAsyncOptions): Promise; + +export { flatMapAsync }; diff --git a/node_modules/es-toolkit/dist/array/flatMapAsync.d.ts b/node_modules/es-toolkit/dist/array/flatMapAsync.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b3ee5bcd80f8516c2d57ecd2d306236732c809d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.d.ts @@ -0,0 +1,37 @@ +interface FlatMapAsyncOptions { + concurrency?: number; +} +/** + * Maps each element in an array using an async callback function and flattens the result by one level. + * + * This is equivalent to calling `mapAsync` followed by `flat(1)`, but more efficient. + * Each callback should return an array, and all returned arrays are concatenated into + * a single output array. + * + * @template T - The type of elements in the input array. + * @template R - The type of elements in the arrays returned by the callback. + * @param {readonly T[]} array The array to transform. + * @param {(item: T, index: number, array: readonly T[]) => Promise} callback An async function that transforms each element into an array. + * @param {FlatMapAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves to a flattened array of transformed values. + * @example + * const users = [{ id: 1 }, { id: 2 }]; + * const allPosts = await flatMapAsync(users, async (user) => { + * return await fetchUserPosts(user.id); + * }); + * // Returns: [post1, post2, post3, ...] (all posts from all users) + * + * @example + * // With concurrency limit + * const numbers = [1, 2, 3]; + * const results = await flatMapAsync( + * numbers, + * async (n) => await fetchRelatedItems(n), + * { concurrency: 2 } + * ); + * // Processes at most 2 operations concurrently + */ +declare function flatMapAsync(array: readonly T[], callback: (item: T, index: number, array: readonly T[]) => Promise, options?: FlatMapAsyncOptions): Promise; + +export { flatMapAsync }; diff --git a/node_modules/es-toolkit/dist/array/flatMapAsync.js b/node_modules/es-toolkit/dist/array/flatMapAsync.js new file mode 100644 index 0000000000000000000000000000000000000000..3f109a0ef7c16f75051374ac7edb507179c312d6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('./flatten.js'); +const limitAsync = require('./limitAsync.js'); + +async function flatMapAsync(array, callback, options) { + if (options?.concurrency != null) { + callback = limitAsync.limitAsync(callback, options.concurrency); + } + const results = await Promise.all(array.map(callback)); + return flatten.flatten(results); +} + +exports.flatMapAsync = flatMapAsync; diff --git a/node_modules/es-toolkit/dist/array/flatMapAsync.mjs b/node_modules/es-toolkit/dist/array/flatMapAsync.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c646eff785856603aa962bda924534e577caf3c2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.mjs @@ -0,0 +1,12 @@ +import { flatten } from './flatten.mjs'; +import { limitAsync } from './limitAsync.mjs'; + +async function flatMapAsync(array, callback, options) { + if (options?.concurrency != null) { + callback = limitAsync(callback, options.concurrency); + } + const results = await Promise.all(array.map(callback)); + return flatten(results); +} + +export { flatMapAsync }; diff --git a/node_modules/es-toolkit/dist/array/flatMapDeep.d.mts b/node_modules/es-toolkit/dist/array/flatMapDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e36124ec2b74bbffa82d4dc1e3018d5a4e660a95 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.d.mts @@ -0,0 +1,18 @@ +import { ExtractNestedArrayType } from './flattenDeep.mjs'; + +/** + * Recursively maps each element in an array using a provided iteratee function and then deeply flattens the resulting array. + * + * @template T - The type of elements within the array. + * @template U - The type of elements within the returned array from the iteratee function. + * @param {T[]} arr - The array to flatten. + * @param {(item: T, index: number, array: readonly T[]) => U} iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @returns {Array>} A new array that has been flattened. + * + * @example + * const result = flatMapDeep([1, 2, 3], n => [[n, n]]); + * // [1, 1, 2, 2, 3, 3] + */ +declare function flatMapDeep(arr: readonly T[], iteratee: (item: T, index: number, array: readonly T[]) => U): Array>; + +export { flatMapDeep }; diff --git a/node_modules/es-toolkit/dist/array/flatMapDeep.d.ts b/node_modules/es-toolkit/dist/array/flatMapDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ad6fb28176803721f31a12ce1dd3bc1869b8b607 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.d.ts @@ -0,0 +1,18 @@ +import { ExtractNestedArrayType } from './flattenDeep.js'; + +/** + * Recursively maps each element in an array using a provided iteratee function and then deeply flattens the resulting array. + * + * @template T - The type of elements within the array. + * @template U - The type of elements within the returned array from the iteratee function. + * @param {T[]} arr - The array to flatten. + * @param {(item: T, index: number, array: readonly T[]) => U} iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @returns {Array>} A new array that has been flattened. + * + * @example + * const result = flatMapDeep([1, 2, 3], n => [[n, n]]); + * // [1, 1, 2, 2, 3, 3] + */ +declare function flatMapDeep(arr: readonly T[], iteratee: (item: T, index: number, array: readonly T[]) => U): Array>; + +export { flatMapDeep }; diff --git a/node_modules/es-toolkit/dist/array/flatMapDeep.js b/node_modules/es-toolkit/dist/array/flatMapDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..3fed67b5a411039b42c1a75d11176beb4eaeb6da --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flattenDeep = require('./flattenDeep.js'); + +function flatMapDeep(arr, iteratee) { + return flattenDeep.flattenDeep(arr.map((item, index) => iteratee(item, index, arr))); +} + +exports.flatMapDeep = flatMapDeep; diff --git a/node_modules/es-toolkit/dist/array/flatMapDeep.mjs b/node_modules/es-toolkit/dist/array/flatMapDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..75a15a3a5e57b3c5426c38b018f168c5966b482f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.mjs @@ -0,0 +1,7 @@ +import { flattenDeep } from './flattenDeep.mjs'; + +function flatMapDeep(arr, iteratee) { + return flattenDeep(arr.map((item, index) => iteratee(item, index, arr))); +} + +export { flatMapDeep }; diff --git a/node_modules/es-toolkit/dist/array/flatten.d.mts b/node_modules/es-toolkit/dist/array/flatten.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ed9c632658f29e20c8cb54f02211f403491290ad --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.d.mts @@ -0,0 +1,19 @@ +/** + * Flattens an array up to the specified depth. + * + * @template T - The type of elements within the array. + * @template D - The depth to which the array should be flattened. + * @param {T[]} arr - The array to flatten. + * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns {Array>} A new array that has been flattened. + * + * @example + * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1); + * // Returns: [1, 2, 3, 4, [5, 6]] + * + * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2); + * // Returns: [1, 2, 3, 4, 5, 6] + */ +declare function flatten(arr: readonly T[], depth?: D): Array>; + +export { flatten }; diff --git a/node_modules/es-toolkit/dist/array/flatten.d.ts b/node_modules/es-toolkit/dist/array/flatten.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed9c632658f29e20c8cb54f02211f403491290ad --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.d.ts @@ -0,0 +1,19 @@ +/** + * Flattens an array up to the specified depth. + * + * @template T - The type of elements within the array. + * @template D - The depth to which the array should be flattened. + * @param {T[]} arr - The array to flatten. + * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns {Array>} A new array that has been flattened. + * + * @example + * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1); + * // Returns: [1, 2, 3, 4, [5, 6]] + * + * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2); + * // Returns: [1, 2, 3, 4, 5, 6] + */ +declare function flatten(arr: readonly T[], depth?: D): Array>; + +export { flatten }; diff --git a/node_modules/es-toolkit/dist/array/flatten.js b/node_modules/es-toolkit/dist/array/flatten.js new file mode 100644 index 0000000000000000000000000000000000000000..363f9b525036014070e744aa62969b8f8ca3d773 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function flatten(arr, depth = 1) { + const result = []; + const flooredDepth = Math.floor(depth); + const recursive = (arr, currentDepth) => { + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (Array.isArray(item) && currentDepth < flooredDepth) { + recursive(item, currentDepth + 1); + } + else { + result.push(item); + } + } + }; + recursive(arr, 0); + return result; +} + +exports.flatten = flatten; diff --git a/node_modules/es-toolkit/dist/array/flatten.mjs b/node_modules/es-toolkit/dist/array/flatten.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9f9389190635e49f385b64f9c1a9aed1f57da461 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.mjs @@ -0,0 +1,19 @@ +function flatten(arr, depth = 1) { + const result = []; + const flooredDepth = Math.floor(depth); + const recursive = (arr, currentDepth) => { + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (Array.isArray(item) && currentDepth < flooredDepth) { + recursive(item, currentDepth + 1); + } + else { + result.push(item); + } + } + }; + recursive(arr, 0); + return result; +} + +export { flatten }; diff --git a/node_modules/es-toolkit/dist/array/flattenDeep.d.mts b/node_modules/es-toolkit/dist/array/flattenDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b41a0e70856158f069688667b164b0337d2089ed --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.d.mts @@ -0,0 +1,25 @@ +/** + * Utility type for recursively unpacking nested array types to extract the type of the innermost element + * + * @example + * ExtractNestedArrayType<(number | (number | number[])[])[]> + * // number + * + * ExtractNestedArrayType<(boolean | (string | number[])[])[]> + * // string | number | boolean + */ +type ExtractNestedArrayType = T extends ReadonlyArray ? ExtractNestedArrayType : T; +/** + * Flattens all depths of a nested array. + * + * @template T - The type of elements within the array. + * @param {T[]} arr - The array to flatten. + * @returns {Array>} A new array that has been flattened. + * + * @example + * const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]); + * // Returns: [1, 2, 3, 4, 5, 6] + */ +declare function flattenDeep(arr: readonly T[]): Array>; + +export { type ExtractNestedArrayType, flattenDeep }; diff --git a/node_modules/es-toolkit/dist/array/flattenDeep.d.ts b/node_modules/es-toolkit/dist/array/flattenDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b41a0e70856158f069688667b164b0337d2089ed --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.d.ts @@ -0,0 +1,25 @@ +/** + * Utility type for recursively unpacking nested array types to extract the type of the innermost element + * + * @example + * ExtractNestedArrayType<(number | (number | number[])[])[]> + * // number + * + * ExtractNestedArrayType<(boolean | (string | number[])[])[]> + * // string | number | boolean + */ +type ExtractNestedArrayType = T extends ReadonlyArray ? ExtractNestedArrayType : T; +/** + * Flattens all depths of a nested array. + * + * @template T - The type of elements within the array. + * @param {T[]} arr - The array to flatten. + * @returns {Array>} A new array that has been flattened. + * + * @example + * const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]); + * // Returns: [1, 2, 3, 4, 5, 6] + */ +declare function flattenDeep(arr: readonly T[]): Array>; + +export { type ExtractNestedArrayType, flattenDeep }; diff --git a/node_modules/es-toolkit/dist/array/flattenDeep.js b/node_modules/es-toolkit/dist/array/flattenDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..4067e75738dcc3a7b2a8e5ecb59c4ff16ded6559 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('./flatten.js'); + +function flattenDeep(arr) { + return flatten.flatten(arr, Infinity); +} + +exports.flattenDeep = flattenDeep; diff --git a/node_modules/es-toolkit/dist/array/flattenDeep.mjs b/node_modules/es-toolkit/dist/array/flattenDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fc98092b5408a346f46fac3d5e9e9e9dc2954cd2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.mjs @@ -0,0 +1,7 @@ +import { flatten } from './flatten.mjs'; + +function flattenDeep(arr) { + return flatten(arr, Infinity); +} + +export { flattenDeep }; diff --git a/node_modules/es-toolkit/dist/array/forEachAsync.d.mts b/node_modules/es-toolkit/dist/array/forEachAsync.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d74e0418f3e754e91498d225bb7bf9b26e8fab0c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.d.mts @@ -0,0 +1,35 @@ +interface ForEachAsyncOptions { + concurrency?: number; +} +/** + * Executes an async callback function for each element in an array. + * + * Unlike the native `forEach`, this function returns a promise that resolves + * when all async operations complete. It supports optional concurrency limiting. + * + * @template T - The type of elements in the array. + * @param {readonly T[]} array The array to iterate over. + * @param {(item: T, index: number, array: readonly T[]) => Promise} callback An async function to execute for each element. + * @param {ForEachAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves when all operations complete. + * @example + * const users = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * await forEachAsync(users, async (user) => { + * await updateUser(user.id); + * }); + * // All users have been updated + * + * @example + * // With concurrency limit + * const items = [1, 2, 3, 4, 5]; + * await forEachAsync( + * items, + * async (item) => await processItem(item), + * { concurrency: 2 } + * ); + * // Processes at most 2 items concurrently + */ +declare function forEachAsync(array: readonly T[], callback: (item: T, index: number, array: readonly T[]) => Promise, options?: ForEachAsyncOptions): Promise; + +export { forEachAsync }; diff --git a/node_modules/es-toolkit/dist/array/forEachAsync.d.ts b/node_modules/es-toolkit/dist/array/forEachAsync.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d74e0418f3e754e91498d225bb7bf9b26e8fab0c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.d.ts @@ -0,0 +1,35 @@ +interface ForEachAsyncOptions { + concurrency?: number; +} +/** + * Executes an async callback function for each element in an array. + * + * Unlike the native `forEach`, this function returns a promise that resolves + * when all async operations complete. It supports optional concurrency limiting. + * + * @template T - The type of elements in the array. + * @param {readonly T[]} array The array to iterate over. + * @param {(item: T, index: number, array: readonly T[]) => Promise} callback An async function to execute for each element. + * @param {ForEachAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves when all operations complete. + * @example + * const users = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * await forEachAsync(users, async (user) => { + * await updateUser(user.id); + * }); + * // All users have been updated + * + * @example + * // With concurrency limit + * const items = [1, 2, 3, 4, 5]; + * await forEachAsync( + * items, + * async (item) => await processItem(item), + * { concurrency: 2 } + * ); + * // Processes at most 2 items concurrently + */ +declare function forEachAsync(array: readonly T[], callback: (item: T, index: number, array: readonly T[]) => Promise, options?: ForEachAsyncOptions): Promise; + +export { forEachAsync }; diff --git a/node_modules/es-toolkit/dist/array/forEachAsync.js b/node_modules/es-toolkit/dist/array/forEachAsync.js new file mode 100644 index 0000000000000000000000000000000000000000..baa5b43a9569634adbd372902adaa1c1e3058d01 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const limitAsync = require('./limitAsync.js'); + +async function forEachAsync(array, callback, options) { + if (options?.concurrency != null) { + callback = limitAsync.limitAsync(callback, options.concurrency); + } + await Promise.all(array.map(callback)); +} + +exports.forEachAsync = forEachAsync; diff --git a/node_modules/es-toolkit/dist/array/forEachAsync.mjs b/node_modules/es-toolkit/dist/array/forEachAsync.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cce3f3ebe6e979524ea47e46e19d83e13af4166c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.mjs @@ -0,0 +1,10 @@ +import { limitAsync } from './limitAsync.mjs'; + +async function forEachAsync(array, callback, options) { + if (options?.concurrency != null) { + callback = limitAsync(callback, options.concurrency); + } + await Promise.all(array.map(callback)); +} + +export { forEachAsync }; diff --git a/node_modules/es-toolkit/dist/array/forEachRight.d.mts b/node_modules/es-toolkit/dist/array/forEachRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f3ccbf74084db0c5df6bde880b04cd51a673cb41 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.d.mts @@ -0,0 +1,48 @@ +/** + * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to iterate over. + * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration. + * The callback function receives three arguments: + * - 'value': The current element being processed in the array. + * - 'index': The index of the current element being processed in the array. + * - 'arr': The array 'forEachRight' was called upon. + * + * @example + * const array = [1, 2, 3]; + * const result: number[] = []; + * + * // Use the forEachRight function to iterate through the array and add each element to the result array. + * forEachRight(array, (value) => { + * result.push(value); + * }) + * + * console.log(result) // Output: [3, 2, 1] + */ +declare function forEachRight(arr: T[], callback: (value: T, index: number, arr: T[]) => void): void; +/** + * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to iterate over. + * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration. + * The callback function receives three arguments: + * - 'value': The current element being processed in the array. + * - 'index': The index of the current element being processed in the array. + * - 'arr': The array 'forEachRight' was called upon. + * + * @example + * const array = [1, 2, 3]; + * const result: number[] = []; + * + * // Use the forEachRight function to iterate through the array and add each element to the result array. + * forEachRight(array, (value) => { + * result.push(value); + * }) + * + * console.log(result) // Output: [3, 2, 1] + */ +declare function forEachRight(arr: readonly T[], callback: (value: T, index: number, arr: readonly T[]) => void): void; + +export { forEachRight }; diff --git a/node_modules/es-toolkit/dist/array/forEachRight.d.ts b/node_modules/es-toolkit/dist/array/forEachRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3ccbf74084db0c5df6bde880b04cd51a673cb41 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.d.ts @@ -0,0 +1,48 @@ +/** + * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to iterate over. + * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration. + * The callback function receives three arguments: + * - 'value': The current element being processed in the array. + * - 'index': The index of the current element being processed in the array. + * - 'arr': The array 'forEachRight' was called upon. + * + * @example + * const array = [1, 2, 3]; + * const result: number[] = []; + * + * // Use the forEachRight function to iterate through the array and add each element to the result array. + * forEachRight(array, (value) => { + * result.push(value); + * }) + * + * console.log(result) // Output: [3, 2, 1] + */ +declare function forEachRight(arr: T[], callback: (value: T, index: number, arr: T[]) => void): void; +/** + * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to iterate over. + * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration. + * The callback function receives three arguments: + * - 'value': The current element being processed in the array. + * - 'index': The index of the current element being processed in the array. + * - 'arr': The array 'forEachRight' was called upon. + * + * @example + * const array = [1, 2, 3]; + * const result: number[] = []; + * + * // Use the forEachRight function to iterate through the array and add each element to the result array. + * forEachRight(array, (value) => { + * result.push(value); + * }) + * + * console.log(result) // Output: [3, 2, 1] + */ +declare function forEachRight(arr: readonly T[], callback: (value: T, index: number, arr: readonly T[]) => void): void; + +export { forEachRight }; diff --git a/node_modules/es-toolkit/dist/array/forEachRight.js b/node_modules/es-toolkit/dist/array/forEachRight.js new file mode 100644 index 0000000000000000000000000000000000000000..2e3386fc29fc1bf7ecc6343bb97af27b355b6475 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function forEachRight(arr, callback) { + for (let i = arr.length - 1; i >= 0; i--) { + const element = arr[i]; + callback(element, i, arr); + } +} + +exports.forEachRight = forEachRight; diff --git a/node_modules/es-toolkit/dist/array/forEachRight.mjs b/node_modules/es-toolkit/dist/array/forEachRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f5d71768ae67d63c693f0f5cc565d1becb56253f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.mjs @@ -0,0 +1,8 @@ +function forEachRight(arr, callback) { + for (let i = arr.length - 1; i >= 0; i--) { + const element = arr[i]; + callback(element, i, arr); + } +} + +export { forEachRight }; diff --git a/node_modules/es-toolkit/dist/array/groupBy.d.mts b/node_modules/es-toolkit/dist/array/groupBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..178a47cdff2d93d2e039475dec543e3270ce31b8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.d.mts @@ -0,0 +1,41 @@ +/** + * Groups the elements of an array based on a provided key-generating function. + * + * This function takes an array and a function that generates a key from each element. It returns + * an object where the keys are the generated keys and the values are arrays of elements that share + * the same key. + * + * @template T - The type of elements in the array. + * @template K - The type of keys. + * @param {T[]} arr - The array to group. + * @param {(item: T, index: number, array: readonly T[]) => K} getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns {Record} An object where each key is associated with an array of elements that + * share that key. + * + * @example + * const array = [ + * { category: 'fruit', name: 'apple' }, + * { category: 'fruit', name: 'banana' }, + * { category: 'vegetable', name: 'carrot' } + * ]; + * const result = groupBy(array, item => item.category); + * // result will be: + * // { + * // fruit: [ + * // { category: 'fruit', name: 'apple' }, + * // { category: 'fruit', name: 'banana' } + * // ], + * // vegetable: [ + * // { category: 'vegetable', name: 'carrot' } + * // ] + * // } + * + * @example + * // Using index parameter + * const items = ['a', 'b', 'c', 'd']; + * const result = groupBy(items, (item, index) => index % 2 === 0 ? 'even' : 'odd'); + * // result will be: { even: ['a', 'c'], odd: ['b', 'd'] } + */ +declare function groupBy(arr: readonly T[], getKeyFromItem: (item: T, index: number, array: readonly T[]) => K): Record; + +export { groupBy }; diff --git a/node_modules/es-toolkit/dist/array/groupBy.d.ts b/node_modules/es-toolkit/dist/array/groupBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..178a47cdff2d93d2e039475dec543e3270ce31b8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.d.ts @@ -0,0 +1,41 @@ +/** + * Groups the elements of an array based on a provided key-generating function. + * + * This function takes an array and a function that generates a key from each element. It returns + * an object where the keys are the generated keys and the values are arrays of elements that share + * the same key. + * + * @template T - The type of elements in the array. + * @template K - The type of keys. + * @param {T[]} arr - The array to group. + * @param {(item: T, index: number, array: readonly T[]) => K} getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns {Record} An object where each key is associated with an array of elements that + * share that key. + * + * @example + * const array = [ + * { category: 'fruit', name: 'apple' }, + * { category: 'fruit', name: 'banana' }, + * { category: 'vegetable', name: 'carrot' } + * ]; + * const result = groupBy(array, item => item.category); + * // result will be: + * // { + * // fruit: [ + * // { category: 'fruit', name: 'apple' }, + * // { category: 'fruit', name: 'banana' } + * // ], + * // vegetable: [ + * // { category: 'vegetable', name: 'carrot' } + * // ] + * // } + * + * @example + * // Using index parameter + * const items = ['a', 'b', 'c', 'd']; + * const result = groupBy(items, (item, index) => index % 2 === 0 ? 'even' : 'odd'); + * // result will be: { even: ['a', 'c'], odd: ['b', 'd'] } + */ +declare function groupBy(arr: readonly T[], getKeyFromItem: (item: T, index: number, array: readonly T[]) => K): Record; + +export { groupBy }; diff --git a/node_modules/es-toolkit/dist/array/groupBy.js b/node_modules/es-toolkit/dist/array/groupBy.js new file mode 100644 index 0000000000000000000000000000000000000000..51d07224ae75d14e6f62938daa4db3170e252d3b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function groupBy(arr, getKeyFromItem) { + const result = {}; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = getKeyFromItem(item, i, arr); + if (!Object.hasOwn(result, key)) { + result[key] = []; + } + result[key].push(item); + } + return result; +} + +exports.groupBy = groupBy; diff --git a/node_modules/es-toolkit/dist/array/groupBy.mjs b/node_modules/es-toolkit/dist/array/groupBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d50b0da333d4239b849bd85343d292554bd01535 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.mjs @@ -0,0 +1,14 @@ +function groupBy(arr, getKeyFromItem) { + const result = {}; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = getKeyFromItem(item, i, arr); + if (!Object.hasOwn(result, key)) { + result[key] = []; + } + result[key].push(item); + } + return result; +} + +export { groupBy }; diff --git a/node_modules/es-toolkit/dist/array/head.d.mts b/node_modules/es-toolkit/dist/array/head.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8479a8142bf5eb4c8294a8a1b292e05757ef0fc8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.d.mts @@ -0,0 +1,34 @@ +/** + * Returns the first element of an array. + * + * This function takes an array and returns the first element of the array. + * If the array is empty, the function returns `undefined`. + * + * @template T - The type of elements in the array. + * @param {[T, ...T[]]} arr - A non-empty array from which to get the first element. + * @returns {T} The first element of the array. + * + * @example + * const arr = [1, 2, 3]; + * const firstElement = head(arr); + * // firstElement will be 1 + */ +declare function head(arr: readonly [T, ...T[]]): T; +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * This function takes an array and returns the first element of the array. + * If the array is empty, the function returns `undefined`. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to get the first element. + * @returns {T | undefined} The first element of the array, or `undefined` if the array is empty. + * + * @example + * const emptyArr: number[] = []; + * const noElement = head(emptyArr); + * // noElement will be undefined + */ +declare function head(arr: readonly T[]): T | undefined; + +export { head }; diff --git a/node_modules/es-toolkit/dist/array/head.d.ts b/node_modules/es-toolkit/dist/array/head.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8479a8142bf5eb4c8294a8a1b292e05757ef0fc8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.d.ts @@ -0,0 +1,34 @@ +/** + * Returns the first element of an array. + * + * This function takes an array and returns the first element of the array. + * If the array is empty, the function returns `undefined`. + * + * @template T - The type of elements in the array. + * @param {[T, ...T[]]} arr - A non-empty array from which to get the first element. + * @returns {T} The first element of the array. + * + * @example + * const arr = [1, 2, 3]; + * const firstElement = head(arr); + * // firstElement will be 1 + */ +declare function head(arr: readonly [T, ...T[]]): T; +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * This function takes an array and returns the first element of the array. + * If the array is empty, the function returns `undefined`. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to get the first element. + * @returns {T | undefined} The first element of the array, or `undefined` if the array is empty. + * + * @example + * const emptyArr: number[] = []; + * const noElement = head(emptyArr); + * // noElement will be undefined + */ +declare function head(arr: readonly T[]): T | undefined; + +export { head }; diff --git a/node_modules/es-toolkit/dist/array/head.js b/node_modules/es-toolkit/dist/array/head.js new file mode 100644 index 0000000000000000000000000000000000000000..4b0cfa25afac41a628dc435fdc1f98540b30e649 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function head(arr) { + return arr[0]; +} + +exports.head = head; diff --git a/node_modules/es-toolkit/dist/array/head.mjs b/node_modules/es-toolkit/dist/array/head.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d99ca36435704b896b005f5d4e077e4e5f4aa235 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.mjs @@ -0,0 +1,5 @@ +function head(arr) { + return arr[0]; +} + +export { head }; diff --git a/node_modules/es-toolkit/dist/array/index.d.mts b/node_modules/es-toolkit/dist/array/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1b809f0c9a8e5377860118f9f5b69a0741df778b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.d.mts @@ -0,0 +1,66 @@ +export { at } from './at.mjs'; +export { chunk } from './chunk.mjs'; +export { compact } from './compact.mjs'; +export { countBy } from './countBy.mjs'; +export { difference } from './difference.mjs'; +export { differenceBy } from './differenceBy.mjs'; +export { differenceWith } from './differenceWith.mjs'; +export { drop } from './drop.mjs'; +export { dropRight } from './dropRight.mjs'; +export { dropRightWhile } from './dropRightWhile.mjs'; +export { dropWhile } from './dropWhile.mjs'; +export { fill } from './fill.mjs'; +export { filterAsync } from './filterAsync.mjs'; +export { flatMap } from './flatMap.mjs'; +export { flatMapAsync } from './flatMapAsync.mjs'; +export { flatMapDeep } from './flatMapDeep.mjs'; +export { flatten } from './flatten.mjs'; +export { flattenDeep } from './flattenDeep.mjs'; +export { forEachAsync } from './forEachAsync.mjs'; +export { forEachRight } from './forEachRight.mjs'; +export { groupBy } from './groupBy.mjs'; +export { head } from './head.mjs'; +export { initial } from './initial.mjs'; +export { intersection } from './intersection.mjs'; +export { intersectionBy } from './intersectionBy.mjs'; +export { intersectionWith } from './intersectionWith.mjs'; +export { isSubset } from './isSubset.mjs'; +export { isSubsetWith } from './isSubsetWith.mjs'; +export { keyBy } from './keyBy.mjs'; +export { last } from './last.mjs'; +export { limitAsync } from './limitAsync.mjs'; +export { mapAsync } from './mapAsync.mjs'; +export { maxBy } from './maxBy.mjs'; +export { minBy } from './minBy.mjs'; +export { orderBy } from './orderBy.mjs'; +export { partition } from './partition.mjs'; +export { pull } from './pull.mjs'; +export { pullAt } from './pullAt.mjs'; +export { reduceAsync } from './reduceAsync.mjs'; +export { remove } from './remove.mjs'; +export { sample } from './sample.mjs'; +export { sampleSize } from './sampleSize.mjs'; +export { shuffle } from './shuffle.mjs'; +export { sortBy } from './sortBy.mjs'; +export { tail } from './tail.mjs'; +export { take } from './take.mjs'; +export { takeRight } from './takeRight.mjs'; +export { takeRightWhile } from './takeRightWhile.mjs'; +export { takeWhile } from './takeWhile.mjs'; +export { toFilled } from './toFilled.mjs'; +export { union } from './union.mjs'; +export { unionBy } from './unionBy.mjs'; +export { unionWith } from './unionWith.mjs'; +export { uniq } from './uniq.mjs'; +export { uniqBy } from './uniqBy.mjs'; +export { uniqWith } from './uniqWith.mjs'; +export { unzip } from './unzip.mjs'; +export { unzipWith } from './unzipWith.mjs'; +export { windowed } from './windowed.mjs'; +export { without } from './without.mjs'; +export { xor } from './xor.mjs'; +export { xorBy } from './xorBy.mjs'; +export { xorWith } from './xorWith.mjs'; +export { zip } from './zip.mjs'; +export { zipObject } from './zipObject.mjs'; +export { zipWith } from './zipWith.mjs'; diff --git a/node_modules/es-toolkit/dist/array/index.d.ts b/node_modules/es-toolkit/dist/array/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f19a0e5dc088edfc85babb86c0d516310f145433 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.d.ts @@ -0,0 +1,66 @@ +export { at } from './at.js'; +export { chunk } from './chunk.js'; +export { compact } from './compact.js'; +export { countBy } from './countBy.js'; +export { difference } from './difference.js'; +export { differenceBy } from './differenceBy.js'; +export { differenceWith } from './differenceWith.js'; +export { drop } from './drop.js'; +export { dropRight } from './dropRight.js'; +export { dropRightWhile } from './dropRightWhile.js'; +export { dropWhile } from './dropWhile.js'; +export { fill } from './fill.js'; +export { filterAsync } from './filterAsync.js'; +export { flatMap } from './flatMap.js'; +export { flatMapAsync } from './flatMapAsync.js'; +export { flatMapDeep } from './flatMapDeep.js'; +export { flatten } from './flatten.js'; +export { flattenDeep } from './flattenDeep.js'; +export { forEachAsync } from './forEachAsync.js'; +export { forEachRight } from './forEachRight.js'; +export { groupBy } from './groupBy.js'; +export { head } from './head.js'; +export { initial } from './initial.js'; +export { intersection } from './intersection.js'; +export { intersectionBy } from './intersectionBy.js'; +export { intersectionWith } from './intersectionWith.js'; +export { isSubset } from './isSubset.js'; +export { isSubsetWith } from './isSubsetWith.js'; +export { keyBy } from './keyBy.js'; +export { last } from './last.js'; +export { limitAsync } from './limitAsync.js'; +export { mapAsync } from './mapAsync.js'; +export { maxBy } from './maxBy.js'; +export { minBy } from './minBy.js'; +export { orderBy } from './orderBy.js'; +export { partition } from './partition.js'; +export { pull } from './pull.js'; +export { pullAt } from './pullAt.js'; +export { reduceAsync } from './reduceAsync.js'; +export { remove } from './remove.js'; +export { sample } from './sample.js'; +export { sampleSize } from './sampleSize.js'; +export { shuffle } from './shuffle.js'; +export { sortBy } from './sortBy.js'; +export { tail } from './tail.js'; +export { take } from './take.js'; +export { takeRight } from './takeRight.js'; +export { takeRightWhile } from './takeRightWhile.js'; +export { takeWhile } from './takeWhile.js'; +export { toFilled } from './toFilled.js'; +export { union } from './union.js'; +export { unionBy } from './unionBy.js'; +export { unionWith } from './unionWith.js'; +export { uniq } from './uniq.js'; +export { uniqBy } from './uniqBy.js'; +export { uniqWith } from './uniqWith.js'; +export { unzip } from './unzip.js'; +export { unzipWith } from './unzipWith.js'; +export { windowed } from './windowed.js'; +export { without } from './without.js'; +export { xor } from './xor.js'; +export { xorBy } from './xorBy.js'; +export { xorWith } from './xorWith.js'; +export { zip } from './zip.js'; +export { zipObject } from './zipObject.js'; +export { zipWith } from './zipWith.js'; diff --git a/node_modules/es-toolkit/dist/array/index.js b/node_modules/es-toolkit/dist/array/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6da4ac738e9a04596b64d07d7e4da556f25c9e68 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.js @@ -0,0 +1,139 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const at = require('./at.js'); +const chunk = require('./chunk.js'); +const compact = require('./compact.js'); +const countBy = require('./countBy.js'); +const difference = require('./difference.js'); +const differenceBy = require('./differenceBy.js'); +const differenceWith = require('./differenceWith.js'); +const drop = require('./drop.js'); +const dropRight = require('./dropRight.js'); +const dropRightWhile = require('./dropRightWhile.js'); +const dropWhile = require('./dropWhile.js'); +const fill = require('./fill.js'); +const filterAsync = require('./filterAsync.js'); +const flatMap = require('./flatMap.js'); +const flatMapAsync = require('./flatMapAsync.js'); +const flatMapDeep = require('./flatMapDeep.js'); +const flatten = require('./flatten.js'); +const flattenDeep = require('./flattenDeep.js'); +const forEachAsync = require('./forEachAsync.js'); +const forEachRight = require('./forEachRight.js'); +const groupBy = require('./groupBy.js'); +const head = require('./head.js'); +const initial = require('./initial.js'); +const intersection = require('./intersection.js'); +const intersectionBy = require('./intersectionBy.js'); +const intersectionWith = require('./intersectionWith.js'); +const isSubset = require('./isSubset.js'); +const isSubsetWith = require('./isSubsetWith.js'); +const keyBy = require('./keyBy.js'); +const last = require('./last.js'); +const limitAsync = require('./limitAsync.js'); +const mapAsync = require('./mapAsync.js'); +const maxBy = require('./maxBy.js'); +const minBy = require('./minBy.js'); +const orderBy = require('./orderBy.js'); +const partition = require('./partition.js'); +const pull = require('./pull.js'); +const pullAt = require('./pullAt.js'); +const reduceAsync = require('./reduceAsync.js'); +const remove = require('./remove.js'); +const sample = require('./sample.js'); +const sampleSize = require('./sampleSize.js'); +const shuffle = require('./shuffle.js'); +const sortBy = require('./sortBy.js'); +const tail = require('./tail.js'); +const take = require('./take.js'); +const takeRight = require('./takeRight.js'); +const takeRightWhile = require('./takeRightWhile.js'); +const takeWhile = require('./takeWhile.js'); +const toFilled = require('./toFilled.js'); +const union = require('./union.js'); +const unionBy = require('./unionBy.js'); +const unionWith = require('./unionWith.js'); +const uniq = require('./uniq.js'); +const uniqBy = require('./uniqBy.js'); +const uniqWith = require('./uniqWith.js'); +const unzip = require('./unzip.js'); +const unzipWith = require('./unzipWith.js'); +const windowed = require('./windowed.js'); +const without = require('./without.js'); +const xor = require('./xor.js'); +const xorBy = require('./xorBy.js'); +const xorWith = require('./xorWith.js'); +const zip = require('./zip.js'); +const zipObject = require('./zipObject.js'); +const zipWith = require('./zipWith.js'); + + + +exports.at = at.at; +exports.chunk = chunk.chunk; +exports.compact = compact.compact; +exports.countBy = countBy.countBy; +exports.difference = difference.difference; +exports.differenceBy = differenceBy.differenceBy; +exports.differenceWith = differenceWith.differenceWith; +exports.drop = drop.drop; +exports.dropRight = dropRight.dropRight; +exports.dropRightWhile = dropRightWhile.dropRightWhile; +exports.dropWhile = dropWhile.dropWhile; +exports.fill = fill.fill; +exports.filterAsync = filterAsync.filterAsync; +exports.flatMap = flatMap.flatMap; +exports.flatMapAsync = flatMapAsync.flatMapAsync; +exports.flatMapDeep = flatMapDeep.flatMapDeep; +exports.flatten = flatten.flatten; +exports.flattenDeep = flattenDeep.flattenDeep; +exports.forEachAsync = forEachAsync.forEachAsync; +exports.forEachRight = forEachRight.forEachRight; +exports.groupBy = groupBy.groupBy; +exports.head = head.head; +exports.initial = initial.initial; +exports.intersection = intersection.intersection; +exports.intersectionBy = intersectionBy.intersectionBy; +exports.intersectionWith = intersectionWith.intersectionWith; +exports.isSubset = isSubset.isSubset; +exports.isSubsetWith = isSubsetWith.isSubsetWith; +exports.keyBy = keyBy.keyBy; +exports.last = last.last; +exports.limitAsync = limitAsync.limitAsync; +exports.mapAsync = mapAsync.mapAsync; +exports.maxBy = maxBy.maxBy; +exports.minBy = minBy.minBy; +exports.orderBy = orderBy.orderBy; +exports.partition = partition.partition; +exports.pull = pull.pull; +exports.pullAt = pullAt.pullAt; +exports.reduceAsync = reduceAsync.reduceAsync; +exports.remove = remove.remove; +exports.sample = sample.sample; +exports.sampleSize = sampleSize.sampleSize; +exports.shuffle = shuffle.shuffle; +exports.sortBy = sortBy.sortBy; +exports.tail = tail.tail; +exports.take = take.take; +exports.takeRight = takeRight.takeRight; +exports.takeRightWhile = takeRightWhile.takeRightWhile; +exports.takeWhile = takeWhile.takeWhile; +exports.toFilled = toFilled.toFilled; +exports.union = union.union; +exports.unionBy = unionBy.unionBy; +exports.unionWith = unionWith.unionWith; +exports.uniq = uniq.uniq; +exports.uniqBy = uniqBy.uniqBy; +exports.uniqWith = uniqWith.uniqWith; +exports.unzip = unzip.unzip; +exports.unzipWith = unzipWith.unzipWith; +exports.windowed = windowed.windowed; +exports.without = without.without; +exports.xor = xor.xor; +exports.xorBy = xorBy.xorBy; +exports.xorWith = xorWith.xorWith; +exports.zip = zip.zip; +exports.zipObject = zipObject.zipObject; +exports.zipWith = zipWith.zipWith; diff --git a/node_modules/es-toolkit/dist/array/index.mjs b/node_modules/es-toolkit/dist/array/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1b809f0c9a8e5377860118f9f5b69a0741df778b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.mjs @@ -0,0 +1,66 @@ +export { at } from './at.mjs'; +export { chunk } from './chunk.mjs'; +export { compact } from './compact.mjs'; +export { countBy } from './countBy.mjs'; +export { difference } from './difference.mjs'; +export { differenceBy } from './differenceBy.mjs'; +export { differenceWith } from './differenceWith.mjs'; +export { drop } from './drop.mjs'; +export { dropRight } from './dropRight.mjs'; +export { dropRightWhile } from './dropRightWhile.mjs'; +export { dropWhile } from './dropWhile.mjs'; +export { fill } from './fill.mjs'; +export { filterAsync } from './filterAsync.mjs'; +export { flatMap } from './flatMap.mjs'; +export { flatMapAsync } from './flatMapAsync.mjs'; +export { flatMapDeep } from './flatMapDeep.mjs'; +export { flatten } from './flatten.mjs'; +export { flattenDeep } from './flattenDeep.mjs'; +export { forEachAsync } from './forEachAsync.mjs'; +export { forEachRight } from './forEachRight.mjs'; +export { groupBy } from './groupBy.mjs'; +export { head } from './head.mjs'; +export { initial } from './initial.mjs'; +export { intersection } from './intersection.mjs'; +export { intersectionBy } from './intersectionBy.mjs'; +export { intersectionWith } from './intersectionWith.mjs'; +export { isSubset } from './isSubset.mjs'; +export { isSubsetWith } from './isSubsetWith.mjs'; +export { keyBy } from './keyBy.mjs'; +export { last } from './last.mjs'; +export { limitAsync } from './limitAsync.mjs'; +export { mapAsync } from './mapAsync.mjs'; +export { maxBy } from './maxBy.mjs'; +export { minBy } from './minBy.mjs'; +export { orderBy } from './orderBy.mjs'; +export { partition } from './partition.mjs'; +export { pull } from './pull.mjs'; +export { pullAt } from './pullAt.mjs'; +export { reduceAsync } from './reduceAsync.mjs'; +export { remove } from './remove.mjs'; +export { sample } from './sample.mjs'; +export { sampleSize } from './sampleSize.mjs'; +export { shuffle } from './shuffle.mjs'; +export { sortBy } from './sortBy.mjs'; +export { tail } from './tail.mjs'; +export { take } from './take.mjs'; +export { takeRight } from './takeRight.mjs'; +export { takeRightWhile } from './takeRightWhile.mjs'; +export { takeWhile } from './takeWhile.mjs'; +export { toFilled } from './toFilled.mjs'; +export { union } from './union.mjs'; +export { unionBy } from './unionBy.mjs'; +export { unionWith } from './unionWith.mjs'; +export { uniq } from './uniq.mjs'; +export { uniqBy } from './uniqBy.mjs'; +export { uniqWith } from './uniqWith.mjs'; +export { unzip } from './unzip.mjs'; +export { unzipWith } from './unzipWith.mjs'; +export { windowed } from './windowed.mjs'; +export { without } from './without.mjs'; +export { xor } from './xor.mjs'; +export { xorBy } from './xorBy.mjs'; +export { xorWith } from './xorWith.mjs'; +export { zip } from './zip.mjs'; +export { zipObject } from './zipObject.mjs'; +export { zipWith } from './zipWith.mjs'; diff --git a/node_modules/es-toolkit/dist/array/initial.d.mts b/node_modules/es-toolkit/dist/array/initial.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b29c9e706876bee35901a8169aaa3322fbabb51c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.d.mts @@ -0,0 +1,54 @@ +/** + * Returns an empty array when the input is a tuple containing exactly one element. + * + * @template T The type of the single element. + * @param {[T]} arr - A tuple containing exactly one element. + * @returns {[]} An empty array since there is only one element. + * + * @example + * const array = [100] as const; + * const result = initial(array); + * // result will be [] + */ +declare function initial(arr: readonly [T]): []; +/** + * Returns an empty array when the input array is empty. + * + * @returns {[]} Always returns an empty array for an empty input. + * + * @example + * const array = [] as const; + * const result = initial(array); + * // result will be [] + */ +declare function initial(arr: readonly []): []; +/** + * Returns a new array containing all elements except the last one from a tuple with multiple elements. + * + * @template T The types of the initial elements. + * @template U The type of the last element in the tuple. + * @param {[...T[], U]} arr - A tuple with one or more elements. + * @returns {T[]} A new array containing all but the last element of the tuple. + * + * @example + * const array = ['apple', 'banana', 'cherry'] as const; + * const result = initial(array); + * // result will be ['apple', 'banana'] + */ +declare function initial(arr: readonly [...T[], U]): T[]; +/** + * Returns a new array containing all elements except the last one from the input array. + * If the input array is empty or has only one element, the function returns an empty array. + * + * @template T The type of elements in the array. + * @param {T[]} arr - The input array. + * @returns {T[]} A new array containing all but the last element of the input array. + * + * @example + * const arr = [1, 2, 3, 4]; + * const result = initial(arr); + * // result will be [1, 2, 3] + */ +declare function initial(arr: readonly T[]): T[]; + +export { initial }; diff --git a/node_modules/es-toolkit/dist/array/initial.d.ts b/node_modules/es-toolkit/dist/array/initial.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b29c9e706876bee35901a8169aaa3322fbabb51c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.d.ts @@ -0,0 +1,54 @@ +/** + * Returns an empty array when the input is a tuple containing exactly one element. + * + * @template T The type of the single element. + * @param {[T]} arr - A tuple containing exactly one element. + * @returns {[]} An empty array since there is only one element. + * + * @example + * const array = [100] as const; + * const result = initial(array); + * // result will be [] + */ +declare function initial(arr: readonly [T]): []; +/** + * Returns an empty array when the input array is empty. + * + * @returns {[]} Always returns an empty array for an empty input. + * + * @example + * const array = [] as const; + * const result = initial(array); + * // result will be [] + */ +declare function initial(arr: readonly []): []; +/** + * Returns a new array containing all elements except the last one from a tuple with multiple elements. + * + * @template T The types of the initial elements. + * @template U The type of the last element in the tuple. + * @param {[...T[], U]} arr - A tuple with one or more elements. + * @returns {T[]} A new array containing all but the last element of the tuple. + * + * @example + * const array = ['apple', 'banana', 'cherry'] as const; + * const result = initial(array); + * // result will be ['apple', 'banana'] + */ +declare function initial(arr: readonly [...T[], U]): T[]; +/** + * Returns a new array containing all elements except the last one from the input array. + * If the input array is empty or has only one element, the function returns an empty array. + * + * @template T The type of elements in the array. + * @param {T[]} arr - The input array. + * @returns {T[]} A new array containing all but the last element of the input array. + * + * @example + * const arr = [1, 2, 3, 4]; + * const result = initial(arr); + * // result will be [1, 2, 3] + */ +declare function initial(arr: readonly T[]): T[]; + +export { initial }; diff --git a/node_modules/es-toolkit/dist/array/initial.js b/node_modules/es-toolkit/dist/array/initial.js new file mode 100644 index 0000000000000000000000000000000000000000..73a8fe0dd9aa47437ceefe59cea2838e1fcdf5cf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function initial(arr) { + return arr.slice(0, -1); +} + +exports.initial = initial; diff --git a/node_modules/es-toolkit/dist/array/initial.mjs b/node_modules/es-toolkit/dist/array/initial.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a5cd45fd5878d1319344277bda576a8f266f2a73 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.mjs @@ -0,0 +1,5 @@ +function initial(arr) { + return arr.slice(0, -1); +} + +export { initial }; diff --git a/node_modules/es-toolkit/dist/array/intersection.d.mts b/node_modules/es-toolkit/dist/array/intersection.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2164a6b05bba486d45b9515a643a64d7137ca9ff --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.d.mts @@ -0,0 +1,21 @@ +/** + * Returns the intersection of two arrays. + * + * This function takes two arrays and returns a new array containing the elements that are + * present in both arrays. It effectively filters out any elements from the first array that + * are not found in the second array. + * + * @template T - The type of elements in the array. + * @param {T[]} firstArr - The first array to compare. + * @param {T[]} secondArr - The second array to compare. + * @returns {T[]} A new array containing the elements that are present in both arrays. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [3, 4, 5, 6, 7]; + * const result = intersection(array1, array2); + * // result will be [3, 4, 5] since these elements are in both arrays. + */ +declare function intersection(firstArr: readonly T[], secondArr: readonly T[]): T[]; + +export { intersection }; diff --git a/node_modules/es-toolkit/dist/array/intersection.d.ts b/node_modules/es-toolkit/dist/array/intersection.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2164a6b05bba486d45b9515a643a64d7137ca9ff --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.d.ts @@ -0,0 +1,21 @@ +/** + * Returns the intersection of two arrays. + * + * This function takes two arrays and returns a new array containing the elements that are + * present in both arrays. It effectively filters out any elements from the first array that + * are not found in the second array. + * + * @template T - The type of elements in the array. + * @param {T[]} firstArr - The first array to compare. + * @param {T[]} secondArr - The second array to compare. + * @returns {T[]} A new array containing the elements that are present in both arrays. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [3, 4, 5, 6, 7]; + * const result = intersection(array1, array2); + * // result will be [3, 4, 5] since these elements are in both arrays. + */ +declare function intersection(firstArr: readonly T[], secondArr: readonly T[]): T[]; + +export { intersection }; diff --git a/node_modules/es-toolkit/dist/array/intersection.js b/node_modules/es-toolkit/dist/array/intersection.js new file mode 100644 index 0000000000000000000000000000000000000000..bb3cdc3cdedf98f1eac5a7037eed8a4df7d83f6c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.js @@ -0,0 +1,10 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function intersection(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter(item => secondSet.has(item)); +} + +exports.intersection = intersection; diff --git a/node_modules/es-toolkit/dist/array/intersection.mjs b/node_modules/es-toolkit/dist/array/intersection.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ef02591d845710b9b5fcc7406a6fc07cad4529ce --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.mjs @@ -0,0 +1,6 @@ +function intersection(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter(item => secondSet.has(item)); +} + +export { intersection }; diff --git a/node_modules/es-toolkit/dist/array/intersectionBy.d.mts b/node_modules/es-toolkit/dist/array/intersectionBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0ddb0ee508edfce4214fbe583fe9bd2196ac0b29 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.d.mts @@ -0,0 +1,36 @@ +/** + * Returns the intersection of two arrays based on a mapping function. + * + * This function takes two arrays and a mapping function. It returns a new array containing + * the elements from the first array that, when mapped using the provided function, have matching + * mapped elements in the second array. It effectively filters out any elements from the first array + * that do not have corresponding mapped values in the second array. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @param {T[]} firstArr - The first array to compare. + * @param {U[]} secondArr - The second array to compare. + * @param {(item: T | U) => unknown} mapper - A function to map the elements of both arrays for comparison. + * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const mapper = item => item.id; + * const result = intersectionBy(array1, array2, mapper); + * // result will be [{ id: 2 }] since only this element has a matching id in both arrays. + * + * @example + * const array1 = [ + * { id: 1, name: 'jane' }, + * { id: 2, name: 'amy' }, + * { id: 3, name: 'michael' }, + * ]; + * const array2 = [2, 4]; + * const mapper = item => (typeof item === 'object' ? item.id : item); + * const result = intersectionBy(array1, array2, mapper); + * // result will be [{ id: 2, name: 'amy' }] since only this element has a matching id that is equal to seconds array's element. + */ +declare function intersectionBy(firstArr: readonly T[], secondArr: readonly U[], mapper: (item: T | U) => unknown): T[]; + +export { intersectionBy }; diff --git a/node_modules/es-toolkit/dist/array/intersectionBy.d.ts b/node_modules/es-toolkit/dist/array/intersectionBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ddb0ee508edfce4214fbe583fe9bd2196ac0b29 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.d.ts @@ -0,0 +1,36 @@ +/** + * Returns the intersection of two arrays based on a mapping function. + * + * This function takes two arrays and a mapping function. It returns a new array containing + * the elements from the first array that, when mapped using the provided function, have matching + * mapped elements in the second array. It effectively filters out any elements from the first array + * that do not have corresponding mapped values in the second array. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @param {T[]} firstArr - The first array to compare. + * @param {U[]} secondArr - The second array to compare. + * @param {(item: T | U) => unknown} mapper - A function to map the elements of both arrays for comparison. + * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const mapper = item => item.id; + * const result = intersectionBy(array1, array2, mapper); + * // result will be [{ id: 2 }] since only this element has a matching id in both arrays. + * + * @example + * const array1 = [ + * { id: 1, name: 'jane' }, + * { id: 2, name: 'amy' }, + * { id: 3, name: 'michael' }, + * ]; + * const array2 = [2, 4]; + * const mapper = item => (typeof item === 'object' ? item.id : item); + * const result = intersectionBy(array1, array2, mapper); + * // result will be [{ id: 2, name: 'amy' }] since only this element has a matching id that is equal to seconds array's element. + */ +declare function intersectionBy(firstArr: readonly T[], secondArr: readonly U[], mapper: (item: T | U) => unknown): T[]; + +export { intersectionBy }; diff --git a/node_modules/es-toolkit/dist/array/intersectionBy.js b/node_modules/es-toolkit/dist/array/intersectionBy.js new file mode 100644 index 0000000000000000000000000000000000000000..9dd44e25541bcb7263e89fae0886c6deea48cf26 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function intersectionBy(firstArr, secondArr, mapper) { + const result = []; + const mappedSecondSet = new Set(secondArr.map(mapper)); + for (let i = 0; i < firstArr.length; i++) { + const item = firstArr[i]; + const mappedItem = mapper(item); + if (mappedSecondSet.has(mappedItem)) { + result.push(item); + mappedSecondSet.delete(mappedItem); + } + } + return result; +} + +exports.intersectionBy = intersectionBy; diff --git a/node_modules/es-toolkit/dist/array/intersectionBy.mjs b/node_modules/es-toolkit/dist/array/intersectionBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c40fb8c9e45e828fc545d0fc1491e49737891af0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.mjs @@ -0,0 +1,15 @@ +function intersectionBy(firstArr, secondArr, mapper) { + const result = []; + const mappedSecondSet = new Set(secondArr.map(mapper)); + for (let i = 0; i < firstArr.length; i++) { + const item = firstArr[i]; + const mappedItem = mapper(item); + if (mappedSecondSet.has(mappedItem)) { + result.push(item); + mappedSecondSet.delete(mappedItem); + } + } + return result; +} + +export { intersectionBy }; diff --git a/node_modules/es-toolkit/dist/array/intersectionWith.d.mts b/node_modules/es-toolkit/dist/array/intersectionWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e5c6f5ca77a2d82a15b299b77f123ee2ac16e286 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.d.mts @@ -0,0 +1,37 @@ +/** + * Returns the intersection of two arrays based on a custom equality function. + * + * This function takes two arrays and a custom equality function. It returns a new array containing + * the elements from the first array that have matching elements in the second array, as determined + * by the custom equality function. It effectively filters out any elements from the first array that + * do not have corresponding matches in the second array according to the equality function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @param {T[]} firstArr - The first array to compare. + * @param {U[]} secondArr - The second array to compare. + * @param {(x: T, y: U) => boolean} areItemsEqual - A custom function to determine if two elements are equal. + * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise. + * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * const result = intersectionWith(array1, array2, areItemsEqual); + * // result will be [{ id: 2 }] since this element has a matching id in both arrays. + * + * @example + * const array1 = [ + * { id: 1, name: 'jane' }, + * { id: 2, name: 'amy' }, + * { id: 3, name: 'michael' }, + * ]; + * const array2 = [2, 4]; + * const areItemsEqual = (a, b) => a.id === b; + * const result = intersectionWith(array1, array2, areItemsEqual); + * // result will be [{ id: 2, name: 'amy' }] since this element has a matching id that is equal to seconds array's element. + */ +declare function intersectionWith(firstArr: readonly T[], secondArr: readonly U[], areItemsEqual: (x: T, y: U) => boolean): T[]; + +export { intersectionWith }; diff --git a/node_modules/es-toolkit/dist/array/intersectionWith.d.ts b/node_modules/es-toolkit/dist/array/intersectionWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e5c6f5ca77a2d82a15b299b77f123ee2ac16e286 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.d.ts @@ -0,0 +1,37 @@ +/** + * Returns the intersection of two arrays based on a custom equality function. + * + * This function takes two arrays and a custom equality function. It returns a new array containing + * the elements from the first array that have matching elements in the second array, as determined + * by the custom equality function. It effectively filters out any elements from the first array that + * do not have corresponding matches in the second array according to the equality function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @param {T[]} firstArr - The first array to compare. + * @param {U[]} secondArr - The second array to compare. + * @param {(x: T, y: U) => boolean} areItemsEqual - A custom function to determine if two elements are equal. + * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise. + * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const array2 = [{ id: 2 }, { id: 4 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * const result = intersectionWith(array1, array2, areItemsEqual); + * // result will be [{ id: 2 }] since this element has a matching id in both arrays. + * + * @example + * const array1 = [ + * { id: 1, name: 'jane' }, + * { id: 2, name: 'amy' }, + * { id: 3, name: 'michael' }, + * ]; + * const array2 = [2, 4]; + * const areItemsEqual = (a, b) => a.id === b; + * const result = intersectionWith(array1, array2, areItemsEqual); + * // result will be [{ id: 2, name: 'amy' }] since this element has a matching id that is equal to seconds array's element. + */ +declare function intersectionWith(firstArr: readonly T[], secondArr: readonly U[], areItemsEqual: (x: T, y: U) => boolean): T[]; + +export { intersectionWith }; diff --git a/node_modules/es-toolkit/dist/array/intersectionWith.js b/node_modules/es-toolkit/dist/array/intersectionWith.js new file mode 100644 index 0000000000000000000000000000000000000000..721c210788642b4bdd2f55c0f5f69d8b46d51dff --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function intersectionWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter(firstItem => { + return secondArr.some(secondItem => { + return areItemsEqual(firstItem, secondItem); + }); + }); +} + +exports.intersectionWith = intersectionWith; diff --git a/node_modules/es-toolkit/dist/array/intersectionWith.mjs b/node_modules/es-toolkit/dist/array/intersectionWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5c7a5c20bb49f84ba22601007f136fadb447f7a2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.mjs @@ -0,0 +1,9 @@ +function intersectionWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter(firstItem => { + return secondArr.some(secondItem => { + return areItemsEqual(firstItem, secondItem); + }); + }); +} + +export { intersectionWith }; diff --git a/node_modules/es-toolkit/dist/array/isSubset.d.mts b/node_modules/es-toolkit/dist/array/isSubset.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0c52f72540cdf23e950dcc58d5c101e47d7b5ab5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.d.mts @@ -0,0 +1,26 @@ +/** + * Checks if the `subset` array is entirely contained within the `superset` array. + * + * + * @template T - The type of elements contained in the arrays. + * @param {T[]} superset - The array that may contain all elements of the subset. + * @param {T[]} subset - The array to check against the superset. + * @returns {boolean} - Returns `true` if all elements of the `subset` are present in the `superset`, otherwise returns `false`. + * + * @example + * ```typescript + * const superset = [1, 2, 3, 4, 5]; + * const subset = [2, 3, 4]; + * isSubset(superset, subset); // true + * ``` + * + * @example + * ```typescript + * const superset = ['a', 'b', 'c']; + * const subset = ['a', 'd']; + * isSubset(superset, subset); // false + * ``` + */ +declare function isSubset(superset: readonly T[], subset: readonly T[]): boolean; + +export { isSubset }; diff --git a/node_modules/es-toolkit/dist/array/isSubset.d.ts b/node_modules/es-toolkit/dist/array/isSubset.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c52f72540cdf23e950dcc58d5c101e47d7b5ab5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.d.ts @@ -0,0 +1,26 @@ +/** + * Checks if the `subset` array is entirely contained within the `superset` array. + * + * + * @template T - The type of elements contained in the arrays. + * @param {T[]} superset - The array that may contain all elements of the subset. + * @param {T[]} subset - The array to check against the superset. + * @returns {boolean} - Returns `true` if all elements of the `subset` are present in the `superset`, otherwise returns `false`. + * + * @example + * ```typescript + * const superset = [1, 2, 3, 4, 5]; + * const subset = [2, 3, 4]; + * isSubset(superset, subset); // true + * ``` + * + * @example + * ```typescript + * const superset = ['a', 'b', 'c']; + * const subset = ['a', 'd']; + * isSubset(superset, subset); // false + * ``` + */ +declare function isSubset(superset: readonly T[], subset: readonly T[]): boolean; + +export { isSubset }; diff --git a/node_modules/es-toolkit/dist/array/isSubset.js b/node_modules/es-toolkit/dist/array/isSubset.js new file mode 100644 index 0000000000000000000000000000000000000000..1cd0f23a6670ea03c7671cd83e3a1581d1b8f258 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const difference = require('./difference.js'); + +function isSubset(superset, subset) { + return difference.difference(subset, superset).length === 0; +} + +exports.isSubset = isSubset; diff --git a/node_modules/es-toolkit/dist/array/isSubset.mjs b/node_modules/es-toolkit/dist/array/isSubset.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5b54581dec975ae958c59f559bc370c9c1f3b5be --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.mjs @@ -0,0 +1,7 @@ +import { difference } from './difference.mjs'; + +function isSubset(superset, subset) { + return difference(subset, superset).length === 0; +} + +export { isSubset }; diff --git a/node_modules/es-toolkit/dist/array/isSubsetWith.d.mts b/node_modules/es-toolkit/dist/array/isSubsetWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0a2fc20bd7db64bdfabff6c4d1dfa945bfae747b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.d.mts @@ -0,0 +1,33 @@ +/** + * Checks if the `subset` array is entirely contained within the `superset` array based on a custom equality function. + * + * This function takes two arrays and a custom comparison function. It returns a boolean indicating + * whether all elements in the subset array are present in the superset array, as determined by the provided + * custom equality function. + * + * @template T - The type of elements contained in the arrays. + * @param {T[]} superset - The array that may contain all elements of the subset. + * @param {T[]} subset - The array to check against the superset. + * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal. + * @returns {boolean} - Returns `true` if all elements of the subset are present in the superset + * according to the custom equality function, otherwise returns `false`. + * + * @example + * ```typescript + * const superset = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const subset = [{ id: 2 }, { id: 1 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * isSubsetWith(superset, subset, areItemsEqual); // true + * ``` + * + * @example + * ```typescript + * const superset = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const subset = [{ id: 4 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * isSubsetWith(superset, subset, areItemsEqual); // false + * ``` + */ +declare function isSubsetWith(superset: readonly T[], subset: readonly T[], areItemsEqual: (x: T, y: T) => boolean): boolean; + +export { isSubsetWith }; diff --git a/node_modules/es-toolkit/dist/array/isSubsetWith.d.ts b/node_modules/es-toolkit/dist/array/isSubsetWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a2fc20bd7db64bdfabff6c4d1dfa945bfae747b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.d.ts @@ -0,0 +1,33 @@ +/** + * Checks if the `subset` array is entirely contained within the `superset` array based on a custom equality function. + * + * This function takes two arrays and a custom comparison function. It returns a boolean indicating + * whether all elements in the subset array are present in the superset array, as determined by the provided + * custom equality function. + * + * @template T - The type of elements contained in the arrays. + * @param {T[]} superset - The array that may contain all elements of the subset. + * @param {T[]} subset - The array to check against the superset. + * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal. + * @returns {boolean} - Returns `true` if all elements of the subset are present in the superset + * according to the custom equality function, otherwise returns `false`. + * + * @example + * ```typescript + * const superset = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const subset = [{ id: 2 }, { id: 1 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * isSubsetWith(superset, subset, areItemsEqual); // true + * ``` + * + * @example + * ```typescript + * const superset = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const subset = [{ id: 4 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * isSubsetWith(superset, subset, areItemsEqual); // false + * ``` + */ +declare function isSubsetWith(superset: readonly T[], subset: readonly T[], areItemsEqual: (x: T, y: T) => boolean): boolean; + +export { isSubsetWith }; diff --git a/node_modules/es-toolkit/dist/array/isSubsetWith.js b/node_modules/es-toolkit/dist/array/isSubsetWith.js new file mode 100644 index 0000000000000000000000000000000000000000..82051ff691c264722070148baeaae7077eec39f5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const differenceWith = require('./differenceWith.js'); + +function isSubsetWith(superset, subset, areItemsEqual) { + return differenceWith.differenceWith(subset, superset, areItemsEqual).length === 0; +} + +exports.isSubsetWith = isSubsetWith; diff --git a/node_modules/es-toolkit/dist/array/isSubsetWith.mjs b/node_modules/es-toolkit/dist/array/isSubsetWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3e39bcb4a9111ea41f626e44ffddc7048b7dfbec --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.mjs @@ -0,0 +1,7 @@ +import { differenceWith } from './differenceWith.mjs'; + +function isSubsetWith(superset, subset, areItemsEqual) { + return differenceWith(subset, superset, areItemsEqual).length === 0; +} + +export { isSubsetWith }; diff --git a/node_modules/es-toolkit/dist/array/keyBy.d.mts b/node_modules/es-toolkit/dist/array/keyBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..df84f4f1986858668e1790672654f902fea64930 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.d.mts @@ -0,0 +1,36 @@ +/** + * Maps each element of an array based on a provided key-generating function. + * + * This function takes an array and a function that generates a key from each element. It returns + * an object where the keys are the generated keys and the values are the corresponding elements. + * If there are multiple elements generating the same key, the last element among them is used + * as the value. + * + * @template T - The type of elements in the array. + * @template K - The type of keys. + * @param {T[]} arr - The array of elements to be mapped. + * @param {(item: T, index: number, array: readonly T[]) => K} getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns {Record} An object where keys are mapped to each element of an array. + * + * @example + * const array = [ + * { category: 'fruit', name: 'apple' }, + * { category: 'fruit', name: 'banana' }, + * { category: 'vegetable', name: 'carrot' } + * ]; + * const result = keyBy(array, item => item.category); + * // result will be: + * // { + * // fruit: { category: 'fruit', name: 'banana' }, + * // vegetable: { category: 'vegetable', name: 'carrot' } + * // } + * + * @example + * // Using index parameter + * const items = ['a', 'b', 'c']; + * const result = keyBy(items, (item, index) => index); + * // result will be: { 0: 'a', 1: 'b', 2: 'c' } + */ +declare function keyBy(arr: readonly T[], getKeyFromItem: (item: T, index: number, array: readonly T[]) => K): Record; + +export { keyBy }; diff --git a/node_modules/es-toolkit/dist/array/keyBy.d.ts b/node_modules/es-toolkit/dist/array/keyBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..df84f4f1986858668e1790672654f902fea64930 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.d.ts @@ -0,0 +1,36 @@ +/** + * Maps each element of an array based on a provided key-generating function. + * + * This function takes an array and a function that generates a key from each element. It returns + * an object where the keys are the generated keys and the values are the corresponding elements. + * If there are multiple elements generating the same key, the last element among them is used + * as the value. + * + * @template T - The type of elements in the array. + * @template K - The type of keys. + * @param {T[]} arr - The array of elements to be mapped. + * @param {(item: T, index: number, array: readonly T[]) => K} getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns {Record} An object where keys are mapped to each element of an array. + * + * @example + * const array = [ + * { category: 'fruit', name: 'apple' }, + * { category: 'fruit', name: 'banana' }, + * { category: 'vegetable', name: 'carrot' } + * ]; + * const result = keyBy(array, item => item.category); + * // result will be: + * // { + * // fruit: { category: 'fruit', name: 'banana' }, + * // vegetable: { category: 'vegetable', name: 'carrot' } + * // } + * + * @example + * // Using index parameter + * const items = ['a', 'b', 'c']; + * const result = keyBy(items, (item, index) => index); + * // result will be: { 0: 'a', 1: 'b', 2: 'c' } + */ +declare function keyBy(arr: readonly T[], getKeyFromItem: (item: T, index: number, array: readonly T[]) => K): Record; + +export { keyBy }; diff --git a/node_modules/es-toolkit/dist/array/keyBy.js b/node_modules/es-toolkit/dist/array/keyBy.js new file mode 100644 index 0000000000000000000000000000000000000000..cf7eb18688f9467d7e2ed5786141e28ed8d60954 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function keyBy(arr, getKeyFromItem) { + const result = {}; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = getKeyFromItem(item, i, arr); + result[key] = item; + } + return result; +} + +exports.keyBy = keyBy; diff --git a/node_modules/es-toolkit/dist/array/keyBy.mjs b/node_modules/es-toolkit/dist/array/keyBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6efc6f53f0a2c52ee0fab60a6e751a639ac42589 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.mjs @@ -0,0 +1,11 @@ +function keyBy(arr, getKeyFromItem) { + const result = {}; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = getKeyFromItem(item, i, arr); + result[key] = item; + } + return result; +} + +export { keyBy }; diff --git a/node_modules/es-toolkit/dist/array/last.d.mts b/node_modules/es-toolkit/dist/array/last.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5ae9e0aa64adeaa04fea7236f1587965255cb8ce --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.d.mts @@ -0,0 +1,48 @@ +/** + * Returns the last element of an array. + * + * This function takes an array and returns the last element of the array. + * If the array is empty, the function returns `undefined`. + * + * Unlike some implementations, this function is optimized for performance + * by directly accessing the last index of the array. + * + * @template T - The type of elements in the array. + * @param {[...T[], T]} arr - The array from which to get the last element. + * @returns {T} The last element of the array, or `undefined` if the array is empty. + * + * @example + * const arr = [1, 2, 3]; + * const lastElement = last(arr); + * // lastElement will be 3 + * + * const emptyArr: number[] = []; + * const noElement = last(emptyArr); + * // noElement will be undefined + */ +declare function last(arr: readonly [...T[], T]): T; +/** + * Returns the last element of an array. + * + * This function takes an array and returns the last element of the array. + * If the array is empty, the function returns `undefined`. + * + * Unlike some implementations, this function is optimized for performance + * by directly accessing the last index of the array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to get the last element. + * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty. + * + * @example + * const arr = [1, 2, 3]; + * const lastElement = last(arr); + * // lastElement will be 3 + * + * const emptyArr: number[] = []; + * const noElement = last(emptyArr); + * // noElement will be undefined + */ +declare function last(arr: readonly T[]): T | undefined; + +export { last }; diff --git a/node_modules/es-toolkit/dist/array/last.d.ts b/node_modules/es-toolkit/dist/array/last.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ae9e0aa64adeaa04fea7236f1587965255cb8ce --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.d.ts @@ -0,0 +1,48 @@ +/** + * Returns the last element of an array. + * + * This function takes an array and returns the last element of the array. + * If the array is empty, the function returns `undefined`. + * + * Unlike some implementations, this function is optimized for performance + * by directly accessing the last index of the array. + * + * @template T - The type of elements in the array. + * @param {[...T[], T]} arr - The array from which to get the last element. + * @returns {T} The last element of the array, or `undefined` if the array is empty. + * + * @example + * const arr = [1, 2, 3]; + * const lastElement = last(arr); + * // lastElement will be 3 + * + * const emptyArr: number[] = []; + * const noElement = last(emptyArr); + * // noElement will be undefined + */ +declare function last(arr: readonly [...T[], T]): T; +/** + * Returns the last element of an array. + * + * This function takes an array and returns the last element of the array. + * If the array is empty, the function returns `undefined`. + * + * Unlike some implementations, this function is optimized for performance + * by directly accessing the last index of the array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array from which to get the last element. + * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty. + * + * @example + * const arr = [1, 2, 3]; + * const lastElement = last(arr); + * // lastElement will be 3 + * + * const emptyArr: number[] = []; + * const noElement = last(emptyArr); + * // noElement will be undefined + */ +declare function last(arr: readonly T[]): T | undefined; + +export { last }; diff --git a/node_modules/es-toolkit/dist/array/last.js b/node_modules/es-toolkit/dist/array/last.js new file mode 100644 index 0000000000000000000000000000000000000000..7567438cadfc38bb2df5856a5d6323e72efd1ce3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function last(arr) { + return arr[arr.length - 1]; +} + +exports.last = last; diff --git a/node_modules/es-toolkit/dist/array/last.mjs b/node_modules/es-toolkit/dist/array/last.mjs new file mode 100644 index 0000000000000000000000000000000000000000..22cf184d211b35a43f693511825b038dd369d0d6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.mjs @@ -0,0 +1,5 @@ +function last(arr) { + return arr[arr.length - 1]; +} + +export { last }; diff --git a/node_modules/es-toolkit/dist/array/limitAsync.d.mts b/node_modules/es-toolkit/dist/array/limitAsync.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0605d3339aa3c30d14ebf5dc78f02707a0106187 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.d.mts @@ -0,0 +1,34 @@ +/** + * Wraps an async function to limit the number of concurrent executions. + * + * This function creates a wrapper around an async callback that ensures at most + * `concurrency` number of executions can run simultaneously. Additional calls will + * wait until a slot becomes available. + * + * @template F - The type of the async function to wrap. + * @param {F} callback The async function to wrap with concurrency control. + * @param {number} concurrency Maximum number of concurrent executions allowed. + * @returns {F} A wrapped version of the callback with concurrency limiting. + * @example + * const limitedFetch = limitAsync(async (url) => { + * return await fetch(url); + * }, 3); + * + * // Only 3 fetches will run concurrently + * const urls = ['url1', 'url2', 'url3', 'url4', 'url5']; + * await Promise.all(urls.map(url => limitedFetch(url))); + * + * @example + * const processItem = async (item) => { + * // Expensive async operation + * return await heavyComputation(item); + * }; + * + * const limitedProcess = limitAsync(processItem, 2); + * const items = [1, 2, 3, 4, 5]; + * // At most 2 items will be processed concurrently + * await Promise.all(items.map(item => limitedProcess(item))); + */ +declare function limitAsync Promise>(callback: F, concurrency: number): F; + +export { limitAsync }; diff --git a/node_modules/es-toolkit/dist/array/limitAsync.d.ts b/node_modules/es-toolkit/dist/array/limitAsync.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0605d3339aa3c30d14ebf5dc78f02707a0106187 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.d.ts @@ -0,0 +1,34 @@ +/** + * Wraps an async function to limit the number of concurrent executions. + * + * This function creates a wrapper around an async callback that ensures at most + * `concurrency` number of executions can run simultaneously. Additional calls will + * wait until a slot becomes available. + * + * @template F - The type of the async function to wrap. + * @param {F} callback The async function to wrap with concurrency control. + * @param {number} concurrency Maximum number of concurrent executions allowed. + * @returns {F} A wrapped version of the callback with concurrency limiting. + * @example + * const limitedFetch = limitAsync(async (url) => { + * return await fetch(url); + * }, 3); + * + * // Only 3 fetches will run concurrently + * const urls = ['url1', 'url2', 'url3', 'url4', 'url5']; + * await Promise.all(urls.map(url => limitedFetch(url))); + * + * @example + * const processItem = async (item) => { + * // Expensive async operation + * return await heavyComputation(item); + * }; + * + * const limitedProcess = limitAsync(processItem, 2); + * const items = [1, 2, 3, 4, 5]; + * // At most 2 items will be processed concurrently + * await Promise.all(items.map(item => limitedProcess(item))); + */ +declare function limitAsync Promise>(callback: F, concurrency: number): F; + +export { limitAsync }; diff --git a/node_modules/es-toolkit/dist/array/limitAsync.js b/node_modules/es-toolkit/dist/array/limitAsync.js new file mode 100644 index 0000000000000000000000000000000000000000..530181e334d76c45bcb2d0a18d1110ec71f1c329 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const semaphore = require('../promise/semaphore.js'); + +function limitAsync(callback, concurrency) { + const semaphore$1 = new semaphore.Semaphore(concurrency); + return async function (...args) { + try { + await semaphore$1.acquire(); + return await callback.apply(this, args); + } + finally { + semaphore$1.release(); + } + }; +} + +exports.limitAsync = limitAsync; diff --git a/node_modules/es-toolkit/dist/array/limitAsync.mjs b/node_modules/es-toolkit/dist/array/limitAsync.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9926e36fc761c1147308479e5a1eb464dfcf2451 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.mjs @@ -0,0 +1,16 @@ +import { Semaphore } from '../promise/semaphore.mjs'; + +function limitAsync(callback, concurrency) { + const semaphore = new Semaphore(concurrency); + return async function (...args) { + try { + await semaphore.acquire(); + return await callback.apply(this, args); + } + finally { + semaphore.release(); + } + }; +} + +export { limitAsync }; diff --git a/node_modules/es-toolkit/dist/array/mapAsync.d.mts b/node_modules/es-toolkit/dist/array/mapAsync.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b6f23d5978dca76f097b02d9d1053867e1c2c7d5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.d.mts @@ -0,0 +1,34 @@ +interface MapAsyncOptions { + concurrency?: number; +} +/** + * Transforms each element in an array using an async callback function and returns + * a promise that resolves to an array of transformed values. + * + * @template T - The type of elements in the input array. + * @template R - The type of elements in the output array. + * @param {readonly T[]} array The array to transform. + * @param {(item: T, index: number, array: readonly T[]) => Promise} callback An async function that transforms each element. + * @param {MapAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves to an array of transformed values. + * @example + * const users = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const userDetails = await mapAsync(users, async (user) => { + * return await fetchUserDetails(user.id); + * }); + * // Returns: [{ id: 1, name: '...' }, { id: 2, name: '...' }, { id: 3, name: '...' }] + * + * @example + * // With concurrency limit + * const numbers = [1, 2, 3, 4, 5]; + * const results = await mapAsync( + * numbers, + * async (n) => await slowOperation(n), + * { concurrency: 2 } + * ); + * // Processes at most 2 operations concurrently + */ +declare function mapAsync(array: readonly T[], callback: (item: T, index: number, array: readonly T[]) => Promise, options?: MapAsyncOptions): Promise; + +export { mapAsync }; diff --git a/node_modules/es-toolkit/dist/array/mapAsync.d.ts b/node_modules/es-toolkit/dist/array/mapAsync.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6f23d5978dca76f097b02d9d1053867e1c2c7d5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.d.ts @@ -0,0 +1,34 @@ +interface MapAsyncOptions { + concurrency?: number; +} +/** + * Transforms each element in an array using an async callback function and returns + * a promise that resolves to an array of transformed values. + * + * @template T - The type of elements in the input array. + * @template R - The type of elements in the output array. + * @param {readonly T[]} array The array to transform. + * @param {(item: T, index: number, array: readonly T[]) => Promise} callback An async function that transforms each element. + * @param {MapAsyncOptions} [options] Optional configuration object. + * @param {number} [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns {Promise} A promise that resolves to an array of transformed values. + * @example + * const users = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const userDetails = await mapAsync(users, async (user) => { + * return await fetchUserDetails(user.id); + * }); + * // Returns: [{ id: 1, name: '...' }, { id: 2, name: '...' }, { id: 3, name: '...' }] + * + * @example + * // With concurrency limit + * const numbers = [1, 2, 3, 4, 5]; + * const results = await mapAsync( + * numbers, + * async (n) => await slowOperation(n), + * { concurrency: 2 } + * ); + * // Processes at most 2 operations concurrently + */ +declare function mapAsync(array: readonly T[], callback: (item: T, index: number, array: readonly T[]) => Promise, options?: MapAsyncOptions): Promise; + +export { mapAsync }; diff --git a/node_modules/es-toolkit/dist/array/mapAsync.js b/node_modules/es-toolkit/dist/array/mapAsync.js new file mode 100644 index 0000000000000000000000000000000000000000..2476b2d00e5ece9528092e6212b4030481aa73cf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const limitAsync = require('./limitAsync.js'); + +function mapAsync(array, callback, options) { + if (options?.concurrency != null) { + callback = limitAsync.limitAsync(callback, options.concurrency); + } + return Promise.all(array.map(callback)); +} + +exports.mapAsync = mapAsync; diff --git a/node_modules/es-toolkit/dist/array/mapAsync.mjs b/node_modules/es-toolkit/dist/array/mapAsync.mjs new file mode 100644 index 0000000000000000000000000000000000000000..13013977490e65ab584284f095c332bda8f833a1 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.mjs @@ -0,0 +1,10 @@ +import { limitAsync } from './limitAsync.mjs'; + +function mapAsync(array, callback, options) { + if (options?.concurrency != null) { + callback = limitAsync(callback, options.concurrency); + } + return Promise.all(array.map(callback)); +} + +export { mapAsync }; diff --git a/node_modules/es-toolkit/dist/array/maxBy.d.mts b/node_modules/es-toolkit/dist/array/maxBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3d113dbdd24113ac0e14e39aabe463917fc36041 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.d.mts @@ -0,0 +1,45 @@ +/** + * Finds the element in an array that has the maximum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {[T, ...T[]]} items The nonempty array of elements to search. + * @param {(element: T) => number} getValue A function that selects a numeric value from each element. + * @returns {T} The element with the maximum value as determined by the `getValue` function. + * @example + * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } + * maxBy([], x => x.a); // Returns: undefined + * maxBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'john', age: 30 } + */ +declare function maxBy(items: readonly [T, ...T[]], getValue: (element: T, index: number, array: readonly T[]) => number): T; +/** + * Finds the element in an array that has the maximum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {T[]} items The array of elements to search. + * @param {(element: T, index: number, array: readonly T[]) => number} getValue A function that selects a numeric value from each element. + * @returns {T | undefined} The element with the maximum value as determined by the `getValue` function, + * or `undefined` if the array is empty. + * @example + * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } + * maxBy([], x => x.a); // Returns: undefined + * maxBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'john', age: 30 } + */ +declare function maxBy(items: readonly T[], getValue: (element: T, index: number, array: readonly T[]) => number): T | undefined; + +export { maxBy }; diff --git a/node_modules/es-toolkit/dist/array/maxBy.d.ts b/node_modules/es-toolkit/dist/array/maxBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d113dbdd24113ac0e14e39aabe463917fc36041 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.d.ts @@ -0,0 +1,45 @@ +/** + * Finds the element in an array that has the maximum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {[T, ...T[]]} items The nonempty array of elements to search. + * @param {(element: T) => number} getValue A function that selects a numeric value from each element. + * @returns {T} The element with the maximum value as determined by the `getValue` function. + * @example + * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } + * maxBy([], x => x.a); // Returns: undefined + * maxBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'john', age: 30 } + */ +declare function maxBy(items: readonly [T, ...T[]], getValue: (element: T, index: number, array: readonly T[]) => number): T; +/** + * Finds the element in an array that has the maximum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {T[]} items The array of elements to search. + * @param {(element: T, index: number, array: readonly T[]) => number} getValue A function that selects a numeric value from each element. + * @returns {T | undefined} The element with the maximum value as determined by the `getValue` function, + * or `undefined` if the array is empty. + * @example + * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } + * maxBy([], x => x.a); // Returns: undefined + * maxBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'john', age: 30 } + */ +declare function maxBy(items: readonly T[], getValue: (element: T, index: number, array: readonly T[]) => number): T | undefined; + +export { maxBy }; diff --git a/node_modules/es-toolkit/dist/array/maxBy.js b/node_modules/es-toolkit/dist/array/maxBy.js new file mode 100644 index 0000000000000000000000000000000000000000..fe7349da5bd84612a1445222f139c0116f05c54f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function maxBy(items, getValue) { + if (items.length === 0) { + return undefined; + } + let maxElement = items[0]; + let max = getValue(maxElement, 0, items); + for (let i = 1; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (value > max) { + max = value; + maxElement = element; + } + } + return maxElement; +} + +exports.maxBy = maxBy; diff --git a/node_modules/es-toolkit/dist/array/maxBy.mjs b/node_modules/es-toolkit/dist/array/maxBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4e54e8bcdc6e7bc662c9048a7482965c6ddf3bf7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.mjs @@ -0,0 +1,18 @@ +function maxBy(items, getValue) { + if (items.length === 0) { + return undefined; + } + let maxElement = items[0]; + let max = getValue(maxElement, 0, items); + for (let i = 1; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (value > max) { + max = value; + maxElement = element; + } + } + return maxElement; +} + +export { maxBy }; diff --git a/node_modules/es-toolkit/dist/array/minBy.d.mts b/node_modules/es-toolkit/dist/array/minBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..481adb66eb8bfdb08e5f2e955447160e74263d26 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.d.mts @@ -0,0 +1,45 @@ +/** + * Finds the element in an array that has the minimum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {[T, ...T[]]} items The nonempty array of elements to search. + * @param {(element: T) => number} getValue A function that selects a numeric value from each element. + * @returns {T} The element with the minimum value as determined by the `getValue` function. + * @example + * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } + * minBy([], x => x.a); // Returns: undefined + * minBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'joe', age: 26 } + */ +declare function minBy(items: readonly [T, ...T[]], getValue: (element: T, index: number, array: readonly T[]) => number): T; +/** + * Finds the element in an array that has the minimum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {T[]} items The array of elements to search. + * @param {(element: T, index: number, array: readonly T[]) => number} getValue A function that selects a numeric value from each element. + * @returns {T | undefined} The element with the minimum value as determined by the `getValue` function, + * or `undefined` if the array is empty. + * @example + * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } + * minBy([], x => x.a); // Returns: undefined + * minBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'joe', age: 26 } + */ +declare function minBy(items: readonly T[], getValue: (element: T, index: number, array: readonly T[]) => number): T | undefined; + +export { minBy }; diff --git a/node_modules/es-toolkit/dist/array/minBy.d.ts b/node_modules/es-toolkit/dist/array/minBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..481adb66eb8bfdb08e5f2e955447160e74263d26 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.d.ts @@ -0,0 +1,45 @@ +/** + * Finds the element in an array that has the minimum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {[T, ...T[]]} items The nonempty array of elements to search. + * @param {(element: T) => number} getValue A function that selects a numeric value from each element. + * @returns {T} The element with the minimum value as determined by the `getValue` function. + * @example + * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } + * minBy([], x => x.a); // Returns: undefined + * minBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'joe', age: 26 } + */ +declare function minBy(items: readonly [T, ...T[]], getValue: (element: T, index: number, array: readonly T[]) => number): T; +/** + * Finds the element in an array that has the minimum value when applying + * the `getValue` function to each element. + * + * @template T - The type of elements in the array. + * @param {T[]} items The array of elements to search. + * @param {(element: T, index: number, array: readonly T[]) => number} getValue A function that selects a numeric value from each element. + * @returns {T | undefined} The element with the minimum value as determined by the `getValue` function, + * or `undefined` if the array is empty. + * @example + * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } + * minBy([], x => x.a); // Returns: undefined + * minBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'joe', age: 26 } + */ +declare function minBy(items: readonly T[], getValue: (element: T, index: number, array: readonly T[]) => number): T | undefined; + +export { minBy }; diff --git a/node_modules/es-toolkit/dist/array/minBy.js b/node_modules/es-toolkit/dist/array/minBy.js new file mode 100644 index 0000000000000000000000000000000000000000..0f480d05eb2f9dfe25b67e26431fcff36292359e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function minBy(items, getValue) { + if (items.length === 0) { + return undefined; + } + let minElement = items[0]; + let min = getValue(minElement, 0, items); + for (let i = 1; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (value < min) { + min = value; + minElement = element; + } + } + return minElement; +} + +exports.minBy = minBy; diff --git a/node_modules/es-toolkit/dist/array/minBy.mjs b/node_modules/es-toolkit/dist/array/minBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b1fba379f2ead66187fccbbc874944b798999608 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.mjs @@ -0,0 +1,18 @@ +function minBy(items, getValue) { + if (items.length === 0) { + return undefined; + } + let minElement = items[0]; + let min = getValue(minElement, 0, items); + for (let i = 1; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (value < min) { + min = value; + minElement = element; + } + } + return minElement; +} + +export { minBy }; diff --git a/node_modules/es-toolkit/dist/array/orderBy.d.mts b/node_modules/es-toolkit/dist/array/orderBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f661f5906a1c3b023d31e41319cac1167dfe2cbb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.d.mts @@ -0,0 +1,37 @@ +/** + * Sorts an array of objects based on the given `criteria` and their corresponding order directions. + * + * - If you provide keys, it sorts the objects by the values of those keys. + * - If you provide functions, it sorts based on the values returned by those functions. + * + * The function returns the array of objects sorted in corresponding order directions. + * If two objects have the same value for the current criterion, it uses the next criterion to determine their order. + * If the number of orders is less than the number of criteria, it uses the last order for the rest of the criteria. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array of objects to be sorted. + * @param {Array<((item: T) => unknown) | keyof T>} criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @param {Array<'asc' | 'desc'>} orders - An array of order directions ('asc' for ascending or 'desc' for descending). + * @returns {T[]} - The sorted array. + * + * @example + * // Sort an array of objects by 'user' in ascending order and 'age' in descending order. + * const users = [ + * { user: 'fred', age: 48 }, + * { user: 'barney', age: 34 }, + * { user: 'fred', age: 40 }, + * { user: 'barney', age: 36 }, + * ]; + * + * const result = orderBy(users, [obj => obj.user, 'age'], ['asc', 'desc']); + * // result will be: + * // [ + * // { user: 'barney', age: 36 }, + * // { user: 'barney', age: 34 }, + * // { user: 'fred', age: 48 }, + * // { user: 'fred', age: 40 }, + * // ] + */ +declare function orderBy(arr: readonly T[], criteria: Array<((item: T) => unknown) | keyof T>, orders: Array<'asc' | 'desc'>): T[]; + +export { orderBy }; diff --git a/node_modules/es-toolkit/dist/array/orderBy.d.ts b/node_modules/es-toolkit/dist/array/orderBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f661f5906a1c3b023d31e41319cac1167dfe2cbb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.d.ts @@ -0,0 +1,37 @@ +/** + * Sorts an array of objects based on the given `criteria` and their corresponding order directions. + * + * - If you provide keys, it sorts the objects by the values of those keys. + * - If you provide functions, it sorts based on the values returned by those functions. + * + * The function returns the array of objects sorted in corresponding order directions. + * If two objects have the same value for the current criterion, it uses the next criterion to determine their order. + * If the number of orders is less than the number of criteria, it uses the last order for the rest of the criteria. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array of objects to be sorted. + * @param {Array<((item: T) => unknown) | keyof T>} criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @param {Array<'asc' | 'desc'>} orders - An array of order directions ('asc' for ascending or 'desc' for descending). + * @returns {T[]} - The sorted array. + * + * @example + * // Sort an array of objects by 'user' in ascending order and 'age' in descending order. + * const users = [ + * { user: 'fred', age: 48 }, + * { user: 'barney', age: 34 }, + * { user: 'fred', age: 40 }, + * { user: 'barney', age: 36 }, + * ]; + * + * const result = orderBy(users, [obj => obj.user, 'age'], ['asc', 'desc']); + * // result will be: + * // [ + * // { user: 'barney', age: 36 }, + * // { user: 'barney', age: 34 }, + * // { user: 'fred', age: 48 }, + * // { user: 'fred', age: 40 }, + * // ] + */ +declare function orderBy(arr: readonly T[], criteria: Array<((item: T) => unknown) | keyof T>, orders: Array<'asc' | 'desc'>): T[]; + +export { orderBy }; diff --git a/node_modules/es-toolkit/dist/array/orderBy.js b/node_modules/es-toolkit/dist/array/orderBy.js new file mode 100644 index 0000000000000000000000000000000000000000..1222952b3c22983fd0447cbd3de14b4e2cd551ba --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const compareValues = require('../_internal/compareValues.js'); + +function orderBy(arr, criteria, orders) { + return arr.slice().sort((a, b) => { + const ordersLength = orders.length; + for (let i = 0; i < criteria.length; i++) { + const order = ordersLength > i ? orders[i] : orders[ordersLength - 1]; + const criterion = criteria[i]; + const criterionIsFunction = typeof criterion === 'function'; + const valueA = criterionIsFunction ? criterion(a) : a[criterion]; + const valueB = criterionIsFunction ? criterion(b) : b[criterion]; + const result = compareValues.compareValues(valueA, valueB, order); + if (result !== 0) { + return result; + } + } + return 0; + }); +} + +exports.orderBy = orderBy; diff --git a/node_modules/es-toolkit/dist/array/orderBy.mjs b/node_modules/es-toolkit/dist/array/orderBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..38a3d0f0264d7330fa75dec1e28182a9146cd4ba --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.mjs @@ -0,0 +1,21 @@ +import { compareValues } from '../_internal/compareValues.mjs'; + +function orderBy(arr, criteria, orders) { + return arr.slice().sort((a, b) => { + const ordersLength = orders.length; + for (let i = 0; i < criteria.length; i++) { + const order = ordersLength > i ? orders[i] : orders[ordersLength - 1]; + const criterion = criteria[i]; + const criterionIsFunction = typeof criterion === 'function'; + const valueA = criterionIsFunction ? criterion(a) : a[criterion]; + const valueB = criterionIsFunction ? criterion(b) : b[criterion]; + const result = compareValues(valueA, valueB, order); + if (result !== 0) { + return result; + } + } + return 0; + }); +} + +export { orderBy }; diff --git a/node_modules/es-toolkit/dist/array/partition.d.mts b/node_modules/es-toolkit/dist/array/partition.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9d7b3760f7fa69be005b1ea194476648eb88239a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.d.mts @@ -0,0 +1,49 @@ +/** + * Splits an array into two groups based on a predicate function. + * + * This function takes an array and a predicate function. It returns a tuple of two arrays: + * the first array contains elements for which the predicate function returns true, and + * the second array contains elements for which the predicate function returns false. + * + * @template T - The type of elements in the array. + * @template {T} U - The type being filtered for. + * @param {T[]} arr - The array to partition. + * @param {(value: T, index: number, array: readonly T[]) => value is U} isInTruthy - A type guard that determines whether an + * element should be placed in the truthy array. The function is called with each element + * of the array and its index. + * @returns {[U[], Exclude[]]} A tuple containing two arrays: the first array contains elements for + * which the predicate returned true, and the second array contains elements for which the + * predicate returned false. + * + * @example + * const array = [1, 2, 3, 4] as const; + * const isEven = (x: number): x is 2 | 4 => x % 2 === 0; + * const [even, odd]: [(2 | 4)[], (2 | 4)[]] = partition(array, isEven); + * // even will be [2, 4], and odd will be [1, 3] + */ +declare function partition(arr: readonly T[], isInTruthy: (value: T, index: number, array: readonly T[]) => value is U): [truthy: U[], falsy: Array>]; +/** + * Splits an array into two groups based on a predicate function. + * + * This function takes an array and a predicate function. It returns a tuple of two arrays: + * the first array contains elements for which the predicate function returns true, and + * the second array contains elements for which the predicate function returns false. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to partition. + * @param {(value: T, index: number) => boolean} isInTruthy - A predicate function that determines + * whether an element should be placed in the truthy array. The function is called with each + * element of the array and its index. + * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for + * which the predicate returned true, and the second array contains elements for which the + * predicate returned false. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const isEven = x => x % 2 === 0; + * const [even, odd] = partition(array, isEven); + * // even will be [2, 4], and odd will be [1, 3, 5] + */ +declare function partition(arr: readonly T[], isInTruthy: (value: T, index: number, array: readonly T[]) => boolean): [truthy: T[], falsy: T[]]; + +export { partition }; diff --git a/node_modules/es-toolkit/dist/array/partition.d.ts b/node_modules/es-toolkit/dist/array/partition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d7b3760f7fa69be005b1ea194476648eb88239a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.d.ts @@ -0,0 +1,49 @@ +/** + * Splits an array into two groups based on a predicate function. + * + * This function takes an array and a predicate function. It returns a tuple of two arrays: + * the first array contains elements for which the predicate function returns true, and + * the second array contains elements for which the predicate function returns false. + * + * @template T - The type of elements in the array. + * @template {T} U - The type being filtered for. + * @param {T[]} arr - The array to partition. + * @param {(value: T, index: number, array: readonly T[]) => value is U} isInTruthy - A type guard that determines whether an + * element should be placed in the truthy array. The function is called with each element + * of the array and its index. + * @returns {[U[], Exclude[]]} A tuple containing two arrays: the first array contains elements for + * which the predicate returned true, and the second array contains elements for which the + * predicate returned false. + * + * @example + * const array = [1, 2, 3, 4] as const; + * const isEven = (x: number): x is 2 | 4 => x % 2 === 0; + * const [even, odd]: [(2 | 4)[], (2 | 4)[]] = partition(array, isEven); + * // even will be [2, 4], and odd will be [1, 3] + */ +declare function partition(arr: readonly T[], isInTruthy: (value: T, index: number, array: readonly T[]) => value is U): [truthy: U[], falsy: Array>]; +/** + * Splits an array into two groups based on a predicate function. + * + * This function takes an array and a predicate function. It returns a tuple of two arrays: + * the first array contains elements for which the predicate function returns true, and + * the second array contains elements for which the predicate function returns false. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to partition. + * @param {(value: T, index: number) => boolean} isInTruthy - A predicate function that determines + * whether an element should be placed in the truthy array. The function is called with each + * element of the array and its index. + * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for + * which the predicate returned true, and the second array contains elements for which the + * predicate returned false. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const isEven = x => x % 2 === 0; + * const [even, odd] = partition(array, isEven); + * // even will be [2, 4], and odd will be [1, 3, 5] + */ +declare function partition(arr: readonly T[], isInTruthy: (value: T, index: number, array: readonly T[]) => boolean): [truthy: T[], falsy: T[]]; + +export { partition }; diff --git a/node_modules/es-toolkit/dist/array/partition.js b/node_modules/es-toolkit/dist/array/partition.js new file mode 100644 index 0000000000000000000000000000000000000000..5a4fe87534bcc79edde2269dbabd8889a27fa7f6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function partition(arr, isInTruthy) { + const truthy = []; + const falsy = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (isInTruthy(item, i, arr)) { + truthy.push(item); + } + else { + falsy.push(item); + } + } + return [truthy, falsy]; +} + +exports.partition = partition; diff --git a/node_modules/es-toolkit/dist/array/partition.mjs b/node_modules/es-toolkit/dist/array/partition.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4517b5db5b963bdf96734c6eb1bf103b192706ac --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.mjs @@ -0,0 +1,16 @@ +function partition(arr, isInTruthy) { + const truthy = []; + const falsy = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (isInTruthy(item, i, arr)) { + truthy.push(item); + } + else { + falsy.push(item); + } + } + return [truthy, falsy]; +} + +export { partition }; diff --git a/node_modules/es-toolkit/dist/array/pull.d.mts b/node_modules/es-toolkit/dist/array/pull.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c60c87694a34f71164daac78bb42eeb06325d45e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.d.mts @@ -0,0 +1,19 @@ +/** + * Removes all specified values from an array. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `difference`. + * + * @template T, U + * @param {T[]} arr - The array to modify. + * @param {unknown[]} valuesToRemove - The values to remove from the array. + * @returns {T[]} The modified array with the specified values removed. + * + * @example + * const numbers = [1, 2, 3, 4, 5, 2, 4]; + * pull(numbers, [2, 4]); + * console.log(numbers); // [1, 3, 5] + */ +declare function pull(arr: T[], valuesToRemove: readonly unknown[]): T[]; + +export { pull }; diff --git a/node_modules/es-toolkit/dist/array/pull.d.ts b/node_modules/es-toolkit/dist/array/pull.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c60c87694a34f71164daac78bb42eeb06325d45e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.d.ts @@ -0,0 +1,19 @@ +/** + * Removes all specified values from an array. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `difference`. + * + * @template T, U + * @param {T[]} arr - The array to modify. + * @param {unknown[]} valuesToRemove - The values to remove from the array. + * @returns {T[]} The modified array with the specified values removed. + * + * @example + * const numbers = [1, 2, 3, 4, 5, 2, 4]; + * pull(numbers, [2, 4]); + * console.log(numbers); // [1, 3, 5] + */ +declare function pull(arr: T[], valuesToRemove: readonly unknown[]): T[]; + +export { pull }; diff --git a/node_modules/es-toolkit/dist/array/pull.js b/node_modules/es-toolkit/dist/array/pull.js new file mode 100644 index 0000000000000000000000000000000000000000..2f40b4473e1b33712cb85a90ae4ab01e4249935e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function pull(arr, valuesToRemove) { + const valuesSet = new Set(valuesToRemove); + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + if (valuesSet.has(arr[i])) { + continue; + } + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return arr; +} + +exports.pull = pull; diff --git a/node_modules/es-toolkit/dist/array/pull.mjs b/node_modules/es-toolkit/dist/array/pull.mjs new file mode 100644 index 0000000000000000000000000000000000000000..14b7c77f0b83b92708db89ff012fd2ea2dbb3197 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.mjs @@ -0,0 +1,18 @@ +function pull(arr, valuesToRemove) { + const valuesSet = new Set(valuesToRemove); + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + if (valuesSet.has(arr[i])) { + continue; + } + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return arr; +} + +export { pull }; diff --git a/node_modules/es-toolkit/dist/array/pullAt.d.mts b/node_modules/es-toolkit/dist/array/pullAt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a4d829877cd455685a1ceaa0de1918056dadbc76 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.d.mts @@ -0,0 +1,19 @@ +/** + * Removes elements from an array at specified indices and returns the removed elements. + * + * This function supports negative indices, which count from the end of the array. + * + * @template T + * @param {T[]} arr - The array from which elements will be removed. + * @param {number[]} indicesToRemove - An array of indices specifying the positions of elements to remove. + * @returns {Array} An array containing the elements that were removed from the original array. + * + * @example + * const numbers = [10, 20, 30, 40, 50]; + * const removed = pullAt(numbers, [1, 3, 4]); + * console.log(removed); // [20, 40, 50] + * console.log(numbers); // [10, 30] + */ +declare function pullAt(arr: T[], indicesToRemove: number[]): T[]; + +export { pullAt }; diff --git a/node_modules/es-toolkit/dist/array/pullAt.d.ts b/node_modules/es-toolkit/dist/array/pullAt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4d829877cd455685a1ceaa0de1918056dadbc76 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.d.ts @@ -0,0 +1,19 @@ +/** + * Removes elements from an array at specified indices and returns the removed elements. + * + * This function supports negative indices, which count from the end of the array. + * + * @template T + * @param {T[]} arr - The array from which elements will be removed. + * @param {number[]} indicesToRemove - An array of indices specifying the positions of elements to remove. + * @returns {Array} An array containing the elements that were removed from the original array. + * + * @example + * const numbers = [10, 20, 30, 40, 50]; + * const removed = pullAt(numbers, [1, 3, 4]); + * console.log(removed); // [20, 40, 50] + * console.log(numbers); // [10, 30] + */ +declare function pullAt(arr: T[], indicesToRemove: number[]): T[]; + +export { pullAt }; diff --git a/node_modules/es-toolkit/dist/array/pullAt.js b/node_modules/es-toolkit/dist/array/pullAt.js new file mode 100644 index 0000000000000000000000000000000000000000..317125c88d82c1929f89eb77b5bb329ac3f2f56f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const at = require('./at.js'); + +function pullAt(arr, indicesToRemove) { + const removed = at.at(arr, indicesToRemove); + const indices = new Set(indicesToRemove.slice().sort((x, y) => y - x)); + for (const index of indices) { + arr.splice(index, 1); + } + return removed; +} + +exports.pullAt = pullAt; diff --git a/node_modules/es-toolkit/dist/array/pullAt.mjs b/node_modules/es-toolkit/dist/array/pullAt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c69690725eec8bc5171671dc53e9c0164a3c69fd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.mjs @@ -0,0 +1,12 @@ +import { at } from './at.mjs'; + +function pullAt(arr, indicesToRemove) { + const removed = at(arr, indicesToRemove); + const indices = new Set(indicesToRemove.slice().sort((x, y) => y - x)); + for (const index of indices) { + arr.splice(index, 1); + } + return removed; +} + +export { pullAt }; diff --git a/node_modules/es-toolkit/dist/array/reduceAsync.d.mts b/node_modules/es-toolkit/dist/array/reduceAsync.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ad548c6d47c2d556897ced9af98535bca115b115 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.d.mts @@ -0,0 +1,71 @@ +/** + * Reduces an array to a single value using an async reducer function. + * + * Applies the reducer function sequentially to each element (left to right), + * carrying an accumulated result from one call to the next. Unlike other async + * array methods, reduce must process elements sequentially and does not support + * concurrency limiting. + * + * @template T - The type of elements in the array. + * @template U - The type of the accumulated result. + * @param {readonly T[]} array The array to reduce. + * @param {(accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise} reducer An async function that processes each element. + * @param {U} initialValue The initial value of the accumulator. + * @returns {Promise} A promise that resolves to the final accumulated value. + * @example + * const numbers = [1, 2, 3, 4, 5]; + * const sum = await reduceAsync( + * numbers, + * async (acc, n) => acc + await fetchValue(n), + * 0 + * ); + * // Returns: sum of all fetched values + * + * @example + * const users = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const userMap = await reduceAsync( + * users, + * async (acc, user) => { + * const details = await fetchUserDetails(user.id); + * acc[user.id] = details; + * return acc; + * }, + * {} as Record + * ); + * // Returns: { 1: {...}, 2: {...}, 3: {...} } + */ +declare function reduceAsync(array: readonly T[], reducer: (accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise, initialValue: U): Promise; +/** + * Reduces an array to a single value using an async reducer function. + * + * Applies the reducer function sequentially to each element (left to right), + * carrying an accumulated result from one call to the next. Unlike other async + * array methods, reduce must process elements sequentially and does not support + * concurrency limiting. + * + * When no initial value is provided, the first element of the array is used as + * the initial value and the reduction starts from the second element. + * + * @template T - The type of elements in the array. + * @param {readonly T[]} array The array to reduce. + * @param {(accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise} reducer An async function that processes each element. + * @returns {Promise} A promise that resolves to the final accumulated value, or undefined if the array is empty. + * @example + * const numbers = [1, 2, 3, 4, 5]; + * const sum = await reduceAsync( + * numbers, + * async (acc, n) => acc + n + * ); + * // Returns: 15 + * + * @example + * const emptyArray: number[] = []; + * const result = await reduceAsync( + * emptyArray, + * async (acc, n) => acc + n + * ); + * // Returns: undefined + */ +declare function reduceAsync(array: readonly T[], reducer: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise): Promise; + +export { reduceAsync }; diff --git a/node_modules/es-toolkit/dist/array/reduceAsync.d.ts b/node_modules/es-toolkit/dist/array/reduceAsync.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ad548c6d47c2d556897ced9af98535bca115b115 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.d.ts @@ -0,0 +1,71 @@ +/** + * Reduces an array to a single value using an async reducer function. + * + * Applies the reducer function sequentially to each element (left to right), + * carrying an accumulated result from one call to the next. Unlike other async + * array methods, reduce must process elements sequentially and does not support + * concurrency limiting. + * + * @template T - The type of elements in the array. + * @template U - The type of the accumulated result. + * @param {readonly T[]} array The array to reduce. + * @param {(accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise} reducer An async function that processes each element. + * @param {U} initialValue The initial value of the accumulator. + * @returns {Promise} A promise that resolves to the final accumulated value. + * @example + * const numbers = [1, 2, 3, 4, 5]; + * const sum = await reduceAsync( + * numbers, + * async (acc, n) => acc + await fetchValue(n), + * 0 + * ); + * // Returns: sum of all fetched values + * + * @example + * const users = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const userMap = await reduceAsync( + * users, + * async (acc, user) => { + * const details = await fetchUserDetails(user.id); + * acc[user.id] = details; + * return acc; + * }, + * {} as Record + * ); + * // Returns: { 1: {...}, 2: {...}, 3: {...} } + */ +declare function reduceAsync(array: readonly T[], reducer: (accumulator: U, currentValue: T, currentIndex: number, array: readonly T[]) => Promise, initialValue: U): Promise; +/** + * Reduces an array to a single value using an async reducer function. + * + * Applies the reducer function sequentially to each element (left to right), + * carrying an accumulated result from one call to the next. Unlike other async + * array methods, reduce must process elements sequentially and does not support + * concurrency limiting. + * + * When no initial value is provided, the first element of the array is used as + * the initial value and the reduction starts from the second element. + * + * @template T - The type of elements in the array. + * @param {readonly T[]} array The array to reduce. + * @param {(accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise} reducer An async function that processes each element. + * @returns {Promise} A promise that resolves to the final accumulated value, or undefined if the array is empty. + * @example + * const numbers = [1, 2, 3, 4, 5]; + * const sum = await reduceAsync( + * numbers, + * async (acc, n) => acc + n + * ); + * // Returns: 15 + * + * @example + * const emptyArray: number[] = []; + * const result = await reduceAsync( + * emptyArray, + * async (acc, n) => acc + n + * ); + * // Returns: undefined + */ +declare function reduceAsync(array: readonly T[], reducer: (accumulator: T, currentValue: T, currentIndex: number, array: readonly T[]) => Promise): Promise; + +export { reduceAsync }; diff --git a/node_modules/es-toolkit/dist/array/reduceAsync.js b/node_modules/es-toolkit/dist/array/reduceAsync.js new file mode 100644 index 0000000000000000000000000000000000000000..796a96c25485fa22c6f3bbb9306c0fbf60aaf390 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +async function reduceAsync(array, reducer, initialValue) { + let startIndex = 0; + if (initialValue == null) { + initialValue = array[0]; + startIndex = 1; + } + let accumulator = initialValue; + for (let i = startIndex; i < array.length; i++) { + accumulator = await reducer(accumulator, array[i], i, array); + } + return accumulator; +} + +exports.reduceAsync = reduceAsync; diff --git a/node_modules/es-toolkit/dist/array/reduceAsync.mjs b/node_modules/es-toolkit/dist/array/reduceAsync.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f18eacf38223cb46485b2e5b07388e29498f0e51 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.mjs @@ -0,0 +1,14 @@ +async function reduceAsync(array, reducer, initialValue) { + let startIndex = 0; + if (initialValue == null) { + initialValue = array[0]; + startIndex = 1; + } + let accumulator = initialValue; + for (let i = startIndex; i < array.length; i++) { + accumulator = await reducer(accumulator, array[i], i, array); + } + return accumulator; +} + +export { reduceAsync }; diff --git a/node_modules/es-toolkit/dist/array/remove.d.mts b/node_modules/es-toolkit/dist/array/remove.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..86b54b56e5201a5c5db34f00ea161e2861df3ae3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.d.mts @@ -0,0 +1,19 @@ +/** + * Removes elements from an array based on a predicate function. + * + * This function changes `arr` in place. + * If you want to remove elements without modifying the original array, use `filter`. + * + * @template T + * @param {T[]} arr - The array to modify. + * @param {(value: T, index: number, array: T[]) => boolean} shouldRemoveElement - The function invoked per iteration to determine if an element should be removed. + * @returns {T[]} The modified array with the specified elements removed. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * remove(numbers, (value) => value % 2 === 0); + * console.log(numbers); // [1, 3, 5] + */ +declare function remove(arr: T[], shouldRemoveElement: (value: T, index: number, array: T[]) => boolean): T[]; + +export { remove }; diff --git a/node_modules/es-toolkit/dist/array/remove.d.ts b/node_modules/es-toolkit/dist/array/remove.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..86b54b56e5201a5c5db34f00ea161e2861df3ae3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.d.ts @@ -0,0 +1,19 @@ +/** + * Removes elements from an array based on a predicate function. + * + * This function changes `arr` in place. + * If you want to remove elements without modifying the original array, use `filter`. + * + * @template T + * @param {T[]} arr - The array to modify. + * @param {(value: T, index: number, array: T[]) => boolean} shouldRemoveElement - The function invoked per iteration to determine if an element should be removed. + * @returns {T[]} The modified array with the specified elements removed. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * remove(numbers, (value) => value % 2 === 0); + * console.log(numbers); // [1, 3, 5] + */ +declare function remove(arr: T[], shouldRemoveElement: (value: T, index: number, array: T[]) => boolean): T[]; + +export { remove }; diff --git a/node_modules/es-toolkit/dist/array/remove.js b/node_modules/es-toolkit/dist/array/remove.js new file mode 100644 index 0000000000000000000000000000000000000000..b5a5a31de9fd1731d500007abf025a9711f8344f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function remove(arr, shouldRemoveElement) { + const originalArr = arr.slice(); + const removed = []; + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + if (shouldRemoveElement(arr[i], i, originalArr)) { + removed.push(arr[i]); + continue; + } + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return removed; +} + +exports.remove = remove; diff --git a/node_modules/es-toolkit/dist/array/remove.mjs b/node_modules/es-toolkit/dist/array/remove.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9454402175e61a40b49a12ea2c321288af4477b5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.mjs @@ -0,0 +1,20 @@ +function remove(arr, shouldRemoveElement) { + const originalArr = arr.slice(); + const removed = []; + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + if (shouldRemoveElement(arr[i], i, originalArr)) { + removed.push(arr[i]); + continue; + } + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return removed; +} + +export { remove }; diff --git a/node_modules/es-toolkit/dist/array/sample.d.mts b/node_modules/es-toolkit/dist/array/sample.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..94acdb5d7b37c9ef0dafcf8a5680b2bd52dac9c4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.d.mts @@ -0,0 +1,17 @@ +/** + * Returns a random element from an array. + * + * This function takes an array and returns a single element selected randomly from the array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to sample from. + * @returns {T} A random element from the array. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const randomElement = sample(array); + * // randomElement will be one of the elements from the array, selected randomly. + */ +declare function sample(arr: readonly T[]): T; + +export { sample }; diff --git a/node_modules/es-toolkit/dist/array/sample.d.ts b/node_modules/es-toolkit/dist/array/sample.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..94acdb5d7b37c9ef0dafcf8a5680b2bd52dac9c4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.d.ts @@ -0,0 +1,17 @@ +/** + * Returns a random element from an array. + * + * This function takes an array and returns a single element selected randomly from the array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to sample from. + * @returns {T} A random element from the array. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const randomElement = sample(array); + * // randomElement will be one of the elements from the array, selected randomly. + */ +declare function sample(arr: readonly T[]): T; + +export { sample }; diff --git a/node_modules/es-toolkit/dist/array/sample.js b/node_modules/es-toolkit/dist/array/sample.js new file mode 100644 index 0000000000000000000000000000000000000000..53706b0d2d5308511d5aa942627af18e5b866207 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.js @@ -0,0 +1,10 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function sample(arr) { + const randomIndex = Math.floor(Math.random() * arr.length); + return arr[randomIndex]; +} + +exports.sample = sample; diff --git a/node_modules/es-toolkit/dist/array/sample.mjs b/node_modules/es-toolkit/dist/array/sample.mjs new file mode 100644 index 0000000000000000000000000000000000000000..69927888af4f0b079bbccbf1a1373eb0e8b952b3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.mjs @@ -0,0 +1,6 @@ +function sample(arr) { + const randomIndex = Math.floor(Math.random() * arr.length); + return arr[randomIndex]; +} + +export { sample }; diff --git a/node_modules/es-toolkit/dist/array/sampleSize.d.mts b/node_modules/es-toolkit/dist/array/sampleSize.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b72eb8c833fa373b8cef14d86403fbff5a4f5979 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.d.mts @@ -0,0 +1,21 @@ +/** + * Returns a sample element array of a specified `size`. + * + * This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm. + * + * {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm} + * + * @template T - The type of elements in the array. + * @param {T[]} array - The array to sample from. + * @param {number} size - The size of sample. + * @returns {T[]} A new array with sample size applied. + * @throws {Error} Throws an error if `size` is greater than the length of `array`. + * + * @example + * const result = sampleSize([1, 2, 3], 2) + * // result will be an array containing two of the elements from the array. + * // [1, 2] or [1, 3] or [2, 3] + */ +declare function sampleSize(array: readonly T[], size: number): T[]; + +export { sampleSize }; diff --git a/node_modules/es-toolkit/dist/array/sampleSize.d.ts b/node_modules/es-toolkit/dist/array/sampleSize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b72eb8c833fa373b8cef14d86403fbff5a4f5979 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.d.ts @@ -0,0 +1,21 @@ +/** + * Returns a sample element array of a specified `size`. + * + * This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm. + * + * {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm} + * + * @template T - The type of elements in the array. + * @param {T[]} array - The array to sample from. + * @param {number} size - The size of sample. + * @returns {T[]} A new array with sample size applied. + * @throws {Error} Throws an error if `size` is greater than the length of `array`. + * + * @example + * const result = sampleSize([1, 2, 3], 2) + * // result will be an array containing two of the elements from the array. + * // [1, 2] or [1, 3] or [2, 3] + */ +declare function sampleSize(array: readonly T[], size: number): T[]; + +export { sampleSize }; diff --git a/node_modules/es-toolkit/dist/array/sampleSize.js b/node_modules/es-toolkit/dist/array/sampleSize.js new file mode 100644 index 0000000000000000000000000000000000000000..dfd15bbc8ce3743e787caa2ac44f9a8b9b99894c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const randomInt = require('../math/randomInt.js'); + +function sampleSize(array, size) { + if (size > array.length) { + throw new Error('Size must be less than or equal to the length of array.'); + } + const result = new Array(size); + const selected = new Set(); + for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) { + let index = randomInt.randomInt(0, step + 1); + if (selected.has(index)) { + index = step; + } + selected.add(index); + result[resultIndex] = array[index]; + } + return result; +} + +exports.sampleSize = sampleSize; diff --git a/node_modules/es-toolkit/dist/array/sampleSize.mjs b/node_modules/es-toolkit/dist/array/sampleSize.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b48928e24ba234f9909a75a31b2660f131b193f1 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.mjs @@ -0,0 +1,20 @@ +import { randomInt } from '../math/randomInt.mjs'; + +function sampleSize(array, size) { + if (size > array.length) { + throw new Error('Size must be less than or equal to the length of array.'); + } + const result = new Array(size); + const selected = new Set(); + for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) { + let index = randomInt(0, step + 1); + if (selected.has(index)) { + index = step; + } + selected.add(index); + result[resultIndex] = array[index]; + } + return result; +} + +export { sampleSize }; diff --git a/node_modules/es-toolkit/dist/array/shuffle.d.mts b/node_modules/es-toolkit/dist/array/shuffle.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..783f1f0351b190777e31805d8c771791217bb9ed --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.d.mts @@ -0,0 +1,17 @@ +/** + * Randomizes the order of elements in an array using the Fisher-Yates algorithm. + * + * This function takes an array and returns a new array with its elements shuffled in a random order. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to shuffle. + * @returns {T[]} A new array with its elements shuffled in random order. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const shuffledArray = shuffle(array); + * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2] + */ +declare function shuffle(arr: readonly T[]): T[]; + +export { shuffle }; diff --git a/node_modules/es-toolkit/dist/array/shuffle.d.ts b/node_modules/es-toolkit/dist/array/shuffle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..783f1f0351b190777e31805d8c771791217bb9ed --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.d.ts @@ -0,0 +1,17 @@ +/** + * Randomizes the order of elements in an array using the Fisher-Yates algorithm. + * + * This function takes an array and returns a new array with its elements shuffled in a random order. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to shuffle. + * @returns {T[]} A new array with its elements shuffled in random order. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const shuffledArray = shuffle(array); + * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2] + */ +declare function shuffle(arr: readonly T[]): T[]; + +export { shuffle }; diff --git a/node_modules/es-toolkit/dist/array/shuffle.js b/node_modules/es-toolkit/dist/array/shuffle.js new file mode 100644 index 0000000000000000000000000000000000000000..16701a8be6b6e19415f68a083d779230685caec6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function shuffle(arr) { + const result = arr.slice(); + for (let i = result.length - 1; i >= 1; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [result[i], result[j]] = [result[j], result[i]]; + } + return result; +} + +exports.shuffle = shuffle; diff --git a/node_modules/es-toolkit/dist/array/shuffle.mjs b/node_modules/es-toolkit/dist/array/shuffle.mjs new file mode 100644 index 0000000000000000000000000000000000000000..be8732d088d0c329f77a0d72bb0724715ded12bf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.mjs @@ -0,0 +1,10 @@ +function shuffle(arr) { + const result = arr.slice(); + for (let i = result.length - 1; i >= 1; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [result[i], result[j]] = [result[j], result[i]]; + } + return result; +} + +export { shuffle }; diff --git a/node_modules/es-toolkit/dist/array/sortBy.d.mts b/node_modules/es-toolkit/dist/array/sortBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3b63eb205a3fe123f0ee12e06a3a1f5014709841 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.d.mts @@ -0,0 +1,35 @@ +/** + * Sorts an array of objects based on the given `criteria`. + * + * - If you provide keys, it sorts the objects by the values of those keys. + * - If you provide functions, it sorts based on the values returned by those functions. + * + * The function returns the array of objects sorted in ascending order. + * If two objects have the same value for the current criterion, it uses the next criterion to determine their order. + * + * @template T - The type of the objects in the array. + * @param {T[]} arr - The array of objects to be sorted. + * @param {Array<((item: T) => unknown) | keyof T>} criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @returns {T[]} - The sorted array. + * + * @example + * const users = [ + * { user: 'foo', age: 24 }, + * { user: 'bar', age: 7 }, + * { user: 'foo', age: 8 }, + * { user: 'bar', age: 29 }, + * ]; + * + * sortBy(users, ['user', 'age']); + * sortBy(users, [obj => obj.user, 'age']); + * // results will be: + * // [ + * // { user : 'bar', age: 7 }, + * // { user : 'bar', age: 29 }, + * // { user : 'foo', age: 8 }, + * // { user : 'foo', age: 24 }, + * // ] + */ +declare function sortBy(arr: readonly T[], criteria: Array<((item: T) => unknown) | keyof T>): T[]; + +export { sortBy }; diff --git a/node_modules/es-toolkit/dist/array/sortBy.d.ts b/node_modules/es-toolkit/dist/array/sortBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3b63eb205a3fe123f0ee12e06a3a1f5014709841 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.d.ts @@ -0,0 +1,35 @@ +/** + * Sorts an array of objects based on the given `criteria`. + * + * - If you provide keys, it sorts the objects by the values of those keys. + * - If you provide functions, it sorts based on the values returned by those functions. + * + * The function returns the array of objects sorted in ascending order. + * If two objects have the same value for the current criterion, it uses the next criterion to determine their order. + * + * @template T - The type of the objects in the array. + * @param {T[]} arr - The array of objects to be sorted. + * @param {Array<((item: T) => unknown) | keyof T>} criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @returns {T[]} - The sorted array. + * + * @example + * const users = [ + * { user: 'foo', age: 24 }, + * { user: 'bar', age: 7 }, + * { user: 'foo', age: 8 }, + * { user: 'bar', age: 29 }, + * ]; + * + * sortBy(users, ['user', 'age']); + * sortBy(users, [obj => obj.user, 'age']); + * // results will be: + * // [ + * // { user : 'bar', age: 7 }, + * // { user : 'bar', age: 29 }, + * // { user : 'foo', age: 8 }, + * // { user : 'foo', age: 24 }, + * // ] + */ +declare function sortBy(arr: readonly T[], criteria: Array<((item: T) => unknown) | keyof T>): T[]; + +export { sortBy }; diff --git a/node_modules/es-toolkit/dist/array/sortBy.js b/node_modules/es-toolkit/dist/array/sortBy.js new file mode 100644 index 0000000000000000000000000000000000000000..f834bb74ff2c3b17c724ffb6bb6b2ff743ccad53 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const orderBy = require('./orderBy.js'); + +function sortBy(arr, criteria) { + return orderBy.orderBy(arr, criteria, ['asc']); +} + +exports.sortBy = sortBy; diff --git a/node_modules/es-toolkit/dist/array/sortBy.mjs b/node_modules/es-toolkit/dist/array/sortBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b9ebe38a2222b9ca47a8c7a798f09f01eb072306 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.mjs @@ -0,0 +1,7 @@ +import { orderBy } from './orderBy.mjs'; + +function sortBy(arr, criteria) { + return orderBy(arr, criteria, ['asc']); +} + +export { sortBy }; diff --git a/node_modules/es-toolkit/dist/array/tail.d.mts b/node_modules/es-toolkit/dist/array/tail.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d38cca86bea3e0e80d6b249a738ce6621a6f0ae5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.d.mts @@ -0,0 +1,67 @@ +/** + * Returns an empty array when the input is a single-element array. + * + * @template T - The type of the single element in the array. + * @param {[T]} arr - The single-element array to process. + * @returns {[]} An empty array. + * + * @example + * const arr = [1]; + * const result = tail(arr); + * // result will be [] + */ +declare function tail(arr: readonly [T]): []; +/** + * Returns an empty array when the input is an empty array. + * + * @template T - The type of elements in the array. + * @param {[]} arr - The empty array to process. + * @returns {[]} An empty array. + * + * @example + * const arr = []; + * const result = tail(arr); + * // result will be [] + */ +declare function tail(arr: readonly []): []; +/** + * Returns a new array with all elements except for the first when the input is a tuple array. + * + * @template T - The type of the first element in the tuple array. + * @template U - The type of the remaining elements in the tuple array. + * @param {[T, ...U[]]} arr - The tuple array to process. + * @returns {U[]} A new array containing all elements of the input array except for the first one. + * + * @example + * const arr = [1, 2, 3]; + * const result = tail(arr); + * // result will be [2, 3] + */ +declare function tail(arr: readonly [T, ...U[]]): U[]; +/** + * Returns a new array with all elements except for the first. + * + * This function takes an array and returns a new array containing all the elements + * except for the first one. If the input array is empty or has only one element, + * an empty array is returned. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to get the tail of. + * @returns {T[]} A new array containing all elements of the input array except for the first one. + * + * @example + * const arr1 = [1, 2, 3]; + * const result = tail(arr1); + * // result will be [2, 3] + * + * const arr2 = [1]; + * const result2 = tail(arr2); + * // result2 will be [] + * + * const arr3 = []; + * const result3 = tail(arr3); + * // result3 will be [] + */ +declare function tail(arr: readonly T[]): T[]; + +export { tail }; diff --git a/node_modules/es-toolkit/dist/array/tail.d.ts b/node_modules/es-toolkit/dist/array/tail.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d38cca86bea3e0e80d6b249a738ce6621a6f0ae5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.d.ts @@ -0,0 +1,67 @@ +/** + * Returns an empty array when the input is a single-element array. + * + * @template T - The type of the single element in the array. + * @param {[T]} arr - The single-element array to process. + * @returns {[]} An empty array. + * + * @example + * const arr = [1]; + * const result = tail(arr); + * // result will be [] + */ +declare function tail(arr: readonly [T]): []; +/** + * Returns an empty array when the input is an empty array. + * + * @template T - The type of elements in the array. + * @param {[]} arr - The empty array to process. + * @returns {[]} An empty array. + * + * @example + * const arr = []; + * const result = tail(arr); + * // result will be [] + */ +declare function tail(arr: readonly []): []; +/** + * Returns a new array with all elements except for the first when the input is a tuple array. + * + * @template T - The type of the first element in the tuple array. + * @template U - The type of the remaining elements in the tuple array. + * @param {[T, ...U[]]} arr - The tuple array to process. + * @returns {U[]} A new array containing all elements of the input array except for the first one. + * + * @example + * const arr = [1, 2, 3]; + * const result = tail(arr); + * // result will be [2, 3] + */ +declare function tail(arr: readonly [T, ...U[]]): U[]; +/** + * Returns a new array with all elements except for the first. + * + * This function takes an array and returns a new array containing all the elements + * except for the first one. If the input array is empty or has only one element, + * an empty array is returned. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to get the tail of. + * @returns {T[]} A new array containing all elements of the input array except for the first one. + * + * @example + * const arr1 = [1, 2, 3]; + * const result = tail(arr1); + * // result will be [2, 3] + * + * const arr2 = [1]; + * const result2 = tail(arr2); + * // result2 will be [] + * + * const arr3 = []; + * const result3 = tail(arr3); + * // result3 will be [] + */ +declare function tail(arr: readonly T[]): T[]; + +export { tail }; diff --git a/node_modules/es-toolkit/dist/array/tail.js b/node_modules/es-toolkit/dist/array/tail.js new file mode 100644 index 0000000000000000000000000000000000000000..573dae0ca3fc594e7ab465debf83d379eb7978a1 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function tail(arr) { + return arr.slice(1); +} + +exports.tail = tail; diff --git a/node_modules/es-toolkit/dist/array/tail.mjs b/node_modules/es-toolkit/dist/array/tail.mjs new file mode 100644 index 0000000000000000000000000000000000000000..870853baf9f15225662e1fc2860ec005c2f7e7b8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.mjs @@ -0,0 +1,5 @@ +function tail(arr) { + return arr.slice(1); +} + +export { tail }; diff --git a/node_modules/es-toolkit/dist/array/take.d.mts b/node_modules/es-toolkit/dist/array/take.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..707d30e64f55f384e6ce2cc38acb05fda1384644 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.d.mts @@ -0,0 +1,31 @@ +/** + * Returns a new array containing the first `count` elements from the input array `arr`. + * If `count` is greater than the length of `arr`, the entire array is returned. + * + * @template T - Type of elements in the input array. + * + * @param {T[]} arr - The array to take elements from. + * @param {number} count - The number of elements to take. + * @param {unknown} guard - If truthy, ignores `count` and defaults to 1. + * @returns {T[]} A new array containing the first `count` elements from `arr`. + * + * @example + * // Returns [1, 2, 3] + * take([1, 2, 3, 4, 5], 3); + * + * @example + * // Returns ['a', 'b'] + * take(['a', 'b', 'c'], 2); + * + * @example + * // Returns [1, 2, 3] + * take([1, 2, 3], 5); + * + * @example + * // Returns [[1], [1], [1]] + * const arr = [1, 2, 3]; + * const result = arr.map((v, i, array) => take(array, i, true)); + */ +declare function take(arr: readonly T[], count?: number, guard?: unknown): T[]; + +export { take }; diff --git a/node_modules/es-toolkit/dist/array/take.d.ts b/node_modules/es-toolkit/dist/array/take.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..707d30e64f55f384e6ce2cc38acb05fda1384644 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.d.ts @@ -0,0 +1,31 @@ +/** + * Returns a new array containing the first `count` elements from the input array `arr`. + * If `count` is greater than the length of `arr`, the entire array is returned. + * + * @template T - Type of elements in the input array. + * + * @param {T[]} arr - The array to take elements from. + * @param {number} count - The number of elements to take. + * @param {unknown} guard - If truthy, ignores `count` and defaults to 1. + * @returns {T[]} A new array containing the first `count` elements from `arr`. + * + * @example + * // Returns [1, 2, 3] + * take([1, 2, 3, 4, 5], 3); + * + * @example + * // Returns ['a', 'b'] + * take(['a', 'b', 'c'], 2); + * + * @example + * // Returns [1, 2, 3] + * take([1, 2, 3], 5); + * + * @example + * // Returns [[1], [1], [1]] + * const arr = [1, 2, 3]; + * const result = arr.map((v, i, array) => take(array, i, true)); + */ +declare function take(arr: readonly T[], count?: number, guard?: unknown): T[]; + +export { take }; diff --git a/node_modules/es-toolkit/dist/array/take.js b/node_modules/es-toolkit/dist/array/take.js new file mode 100644 index 0000000000000000000000000000000000000000..80afda4f2560c16816a39397782eccb1effee2bb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const toInteger = require('../compat/util/toInteger.js'); + +function take(arr, count, guard) { + count = guard || count === undefined ? 1 : toInteger.toInteger(count); + return arr.slice(0, count); +} + +exports.take = take; diff --git a/node_modules/es-toolkit/dist/array/take.mjs b/node_modules/es-toolkit/dist/array/take.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfe7a84f2a3c0d5e2515d6d7c9a90f012542400e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.mjs @@ -0,0 +1,8 @@ +import { toInteger } from '../compat/util/toInteger.mjs'; + +function take(arr, count, guard) { + count = guard || count === undefined ? 1 : toInteger(count); + return arr.slice(0, count); +} + +export { take }; diff --git a/node_modules/es-toolkit/dist/array/takeRight.d.mts b/node_modules/es-toolkit/dist/array/takeRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2cb70600272f8dca11a0e7ecd663c5b4573dedd7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.d.mts @@ -0,0 +1,24 @@ +/** + * Returns a new array containing the last `count` elements from the input array `arr`. + * If `count` is greater than the length of `arr`, the entire array is returned. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to take elements from. + * @param {number} [count=1] - The number of elements to take. + * @returns {T[]} A new array containing the last `count` elements from `arr`. + * + * @example + * // Returns [4, 5] + * takeRight([1, 2, 3, 4, 5], 2); + * + * @example + * // Returns ['b', 'c'] + * takeRight(['a', 'b', 'c'], 2); + * + * @example + * // Returns [1, 2, 3] + * takeRight([1, 2, 3], 5); + */ +declare function takeRight(arr: readonly T[], count?: number, guard?: unknown): T[]; + +export { takeRight }; diff --git a/node_modules/es-toolkit/dist/array/takeRight.d.ts b/node_modules/es-toolkit/dist/array/takeRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2cb70600272f8dca11a0e7ecd663c5b4573dedd7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.d.ts @@ -0,0 +1,24 @@ +/** + * Returns a new array containing the last `count` elements from the input array `arr`. + * If `count` is greater than the length of `arr`, the entire array is returned. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to take elements from. + * @param {number} [count=1] - The number of elements to take. + * @returns {T[]} A new array containing the last `count` elements from `arr`. + * + * @example + * // Returns [4, 5] + * takeRight([1, 2, 3, 4, 5], 2); + * + * @example + * // Returns ['b', 'c'] + * takeRight(['a', 'b', 'c'], 2); + * + * @example + * // Returns [1, 2, 3] + * takeRight([1, 2, 3], 5); + */ +declare function takeRight(arr: readonly T[], count?: number, guard?: unknown): T[]; + +export { takeRight }; diff --git a/node_modules/es-toolkit/dist/array/takeRight.js b/node_modules/es-toolkit/dist/array/takeRight.js new file mode 100644 index 0000000000000000000000000000000000000000..81d18dfbda1cadaa80dd789d5ca0d53ef6781d67 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const toInteger = require('../compat/util/toInteger.js'); + +function takeRight(arr, count, guard) { + count = guard || count === undefined ? 1 : toInteger.toInteger(count); + if (count <= 0 || arr.length === 0) { + return []; + } + return arr.slice(-count); +} + +exports.takeRight = takeRight; diff --git a/node_modules/es-toolkit/dist/array/takeRight.mjs b/node_modules/es-toolkit/dist/array/takeRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dd265fb58f5c4d923bb15ef221da330260b81474 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.mjs @@ -0,0 +1,11 @@ +import { toInteger } from '../compat/util/toInteger.mjs'; + +function takeRight(arr, count, guard) { + count = guard || count === undefined ? 1 : toInteger(count); + if (count <= 0 || arr.length === 0) { + return []; + } + return arr.slice(-count); +} + +export { takeRight }; diff --git a/node_modules/es-toolkit/dist/array/takeRightWhile.d.mts b/node_modules/es-toolkit/dist/array/takeRightWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..23c35d7a537f8b8674535c7902667491793c88c0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.d.mts @@ -0,0 +1,25 @@ +/** + * Takes elements from the end of the array while the predicate function returns `true`. + * + * @template T - Type of elements in the input array. + * + * @param {T[]} arr - The array to take elements from. + * @param {(item: T, index: number, array: readonly T[]) => boolean} shouldContinueTaking - The function invoked per element with the item, its index, and the array. + * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`. + * + * @example + * // Returns [3, 2, 1] + * takeRightWhile([5, 4, 3, 2, 1], n => n < 4); + * + * @example + * // Returns [] + * takeRightWhile([1, 2, 3], n => n > 3); + * + * @example + * // Using index parameter + * takeRightWhile([10, 20, 30, 40], (x, index) => index > 1); + * // Returns: [30, 40] + */ +declare function takeRightWhile(arr: readonly T[], shouldContinueTaking: (item: T, index: number, array: readonly T[]) => boolean): T[]; + +export { takeRightWhile }; diff --git a/node_modules/es-toolkit/dist/array/takeRightWhile.d.ts b/node_modules/es-toolkit/dist/array/takeRightWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..23c35d7a537f8b8674535c7902667491793c88c0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.d.ts @@ -0,0 +1,25 @@ +/** + * Takes elements from the end of the array while the predicate function returns `true`. + * + * @template T - Type of elements in the input array. + * + * @param {T[]} arr - The array to take elements from. + * @param {(item: T, index: number, array: readonly T[]) => boolean} shouldContinueTaking - The function invoked per element with the item, its index, and the array. + * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`. + * + * @example + * // Returns [3, 2, 1] + * takeRightWhile([5, 4, 3, 2, 1], n => n < 4); + * + * @example + * // Returns [] + * takeRightWhile([1, 2, 3], n => n > 3); + * + * @example + * // Using index parameter + * takeRightWhile([10, 20, 30, 40], (x, index) => index > 1); + * // Returns: [30, 40] + */ +declare function takeRightWhile(arr: readonly T[], shouldContinueTaking: (item: T, index: number, array: readonly T[]) => boolean): T[]; + +export { takeRightWhile }; diff --git a/node_modules/es-toolkit/dist/array/takeRightWhile.js b/node_modules/es-toolkit/dist/array/takeRightWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..2569c945d37202e0fa76e7276d1c03bd3b6ea600 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function takeRightWhile(arr, shouldContinueTaking) { + for (let i = arr.length - 1; i >= 0; i--) { + if (!shouldContinueTaking(arr[i], i, arr)) { + return arr.slice(i + 1); + } + } + return arr.slice(); +} + +exports.takeRightWhile = takeRightWhile; diff --git a/node_modules/es-toolkit/dist/array/takeRightWhile.mjs b/node_modules/es-toolkit/dist/array/takeRightWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..68e1195f1fd8d1f03f6e25ba3e4cae379a0ef5c4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.mjs @@ -0,0 +1,10 @@ +function takeRightWhile(arr, shouldContinueTaking) { + for (let i = arr.length - 1; i >= 0; i--) { + if (!shouldContinueTaking(arr[i], i, arr)) { + return arr.slice(i + 1); + } + } + return arr.slice(); +} + +export { takeRightWhile }; diff --git a/node_modules/es-toolkit/dist/array/takeWhile.d.mts b/node_modules/es-toolkit/dist/array/takeWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1d28e7bd34b84c6ce42a42ea53571c979e780c1e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.d.mts @@ -0,0 +1,26 @@ +/** + * Returns a new array containing the leading elements of the provided array + * that satisfy the provided predicate function. It stops taking elements as soon + * as an element does not satisfy the predicate. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to process. + * @param {(element: T, index: number, array: readonly T[]) => boolean} shouldContinueTaking - The predicate function that is called with each element, its index, and the array. Elements are included in the result as long as this function returns true. + * @returns {T[]} A new array containing the leading elements that satisfy the predicate. + * + * @example + * // Returns [1, 2] + * takeWhile([1, 2, 3, 4], x => x < 3); + * + * @example + * // Returns [] + * takeWhile([1, 2, 3, 4], x => x > 3); + * + * @example + * // Using index parameter + * takeWhile([10, 20, 30, 40], (x, index) => index < 2); + * // Returns: [10, 20] + */ +declare function takeWhile(arr: readonly T[], shouldContinueTaking: (element: T, index: number, array: readonly T[]) => boolean): T[]; + +export { takeWhile }; diff --git a/node_modules/es-toolkit/dist/array/takeWhile.d.ts b/node_modules/es-toolkit/dist/array/takeWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d28e7bd34b84c6ce42a42ea53571c979e780c1e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.d.ts @@ -0,0 +1,26 @@ +/** + * Returns a new array containing the leading elements of the provided array + * that satisfy the provided predicate function. It stops taking elements as soon + * as an element does not satisfy the predicate. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to process. + * @param {(element: T, index: number, array: readonly T[]) => boolean} shouldContinueTaking - The predicate function that is called with each element, its index, and the array. Elements are included in the result as long as this function returns true. + * @returns {T[]} A new array containing the leading elements that satisfy the predicate. + * + * @example + * // Returns [1, 2] + * takeWhile([1, 2, 3, 4], x => x < 3); + * + * @example + * // Returns [] + * takeWhile([1, 2, 3, 4], x => x > 3); + * + * @example + * // Using index parameter + * takeWhile([10, 20, 30, 40], (x, index) => index < 2); + * // Returns: [10, 20] + */ +declare function takeWhile(arr: readonly T[], shouldContinueTaking: (element: T, index: number, array: readonly T[]) => boolean): T[]; + +export { takeWhile }; diff --git a/node_modules/es-toolkit/dist/array/takeWhile.js b/node_modules/es-toolkit/dist/array/takeWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..bd37f39ce6776215d4ce89e9c95f44857d89fd47 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function takeWhile(arr, shouldContinueTaking) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (!shouldContinueTaking(item, i, arr)) { + break; + } + result.push(item); + } + return result; +} + +exports.takeWhile = takeWhile; diff --git a/node_modules/es-toolkit/dist/array/takeWhile.mjs b/node_modules/es-toolkit/dist/array/takeWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..614af2b6e9dc46cdf66d90e4a7cbb80827b925a6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.mjs @@ -0,0 +1,13 @@ +function takeWhile(arr, shouldContinueTaking) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (!shouldContinueTaking(item, i, arr)) { + break; + } + result.push(item); + } + return result; +} + +export { takeWhile }; diff --git a/node_modules/es-toolkit/dist/array/toFilled.d.mts b/node_modules/es-toolkit/dist/array/toFilled.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c2f3108c884ffb0c8622b4c3dd0268ad85d80edf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.d.mts @@ -0,0 +1,92 @@ +/** + * Creates a new array filled with the specified value from the start position up to, but not including, the end position. + * This function does not mutate the original array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the new array with. + * @param {Array} arr - The array to base the new array on. + * @param {U} value - The value to fill the new array with. + * @returns {Array} The new array with the filled values. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * let result = toFilled(array, '*', 2); + * console.log(result); // [1, 2, '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', 1, 4); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*'); + * console.log(result); // ['*', '*', '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', -4, -1); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + */ +declare function toFilled(arr: readonly T[], value: U): Array; +/** + * Creates a new array filled with the specified value from the start position up to, but not including, the end position. + * This function does not mutate the original array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the new array with. + * @param {Array} arr - The array to base the new array on. + * @param {U} value - The value to fill the new array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @returns {Array} The new array with the filled values. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * let result = toFilled(array, '*', 2); + * console.log(result); // [1, 2, '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', 1, 4); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*'); + * console.log(result); // ['*', '*', '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', -4, -1); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + */ +declare function toFilled(arr: readonly T[], value: U, start: number): Array; +/** + * Creates a new array filled with the specified value from the start position up to, but not including, the end position. + * This function does not mutate the original array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the new array with. + * @param {Array} arr - The array to base the new array on. + * @param {U} value - The value to fill the new array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @param {number} [end=arr.length] - The end position. Defaults to the array's length. + * @returns {Array} The new array with the filled values. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * let result = toFilled(array, '*', 2); + * console.log(result); // [1, 2, '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', 1, 4); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*'); + * console.log(result); // ['*', '*', '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', -4, -1); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + */ +declare function toFilled(arr: readonly T[], value: U, start: number, end: number): Array; + +export { toFilled }; diff --git a/node_modules/es-toolkit/dist/array/toFilled.d.ts b/node_modules/es-toolkit/dist/array/toFilled.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c2f3108c884ffb0c8622b4c3dd0268ad85d80edf --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.d.ts @@ -0,0 +1,92 @@ +/** + * Creates a new array filled with the specified value from the start position up to, but not including, the end position. + * This function does not mutate the original array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the new array with. + * @param {Array} arr - The array to base the new array on. + * @param {U} value - The value to fill the new array with. + * @returns {Array} The new array with the filled values. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * let result = toFilled(array, '*', 2); + * console.log(result); // [1, 2, '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', 1, 4); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*'); + * console.log(result); // ['*', '*', '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', -4, -1); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + */ +declare function toFilled(arr: readonly T[], value: U): Array; +/** + * Creates a new array filled with the specified value from the start position up to, but not including, the end position. + * This function does not mutate the original array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the new array with. + * @param {Array} arr - The array to base the new array on. + * @param {U} value - The value to fill the new array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @returns {Array} The new array with the filled values. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * let result = toFilled(array, '*', 2); + * console.log(result); // [1, 2, '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', 1, 4); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*'); + * console.log(result); // ['*', '*', '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', -4, -1); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + */ +declare function toFilled(arr: readonly T[], value: U, start: number): Array; +/** + * Creates a new array filled with the specified value from the start position up to, but not including, the end position. + * This function does not mutate the original array. + * + * @template T - The type of elements in the original array. + * @template U - The type of the value to fill the new array with. + * @param {Array} arr - The array to base the new array on. + * @param {U} value - The value to fill the new array with. + * @param {number} [start=0] - The start position. Defaults to 0. + * @param {number} [end=arr.length] - The end position. Defaults to the array's length. + * @returns {Array} The new array with the filled values. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * let result = toFilled(array, '*', 2); + * console.log(result); // [1, 2, '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', 1, 4); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*'); + * console.log(result); // ['*', '*', '*', '*', '*'] + * console.log(array); // [1, 2, 3, 4, 5] + * + * result = toFilled(array, '*', -4, -1); + * console.log(result); // [1, '*', '*', '*', 5] + * console.log(array); // [1, 2, 3, 4, 5] + */ +declare function toFilled(arr: readonly T[], value: U, start: number, end: number): Array; + +export { toFilled }; diff --git a/node_modules/es-toolkit/dist/array/toFilled.js b/node_modules/es-toolkit/dist/array/toFilled.js new file mode 100644 index 0000000000000000000000000000000000000000..ec00e0bf08c5113f37d490c2c726efffd49c9e75 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function toFilled(arr, value, start = 0, end = arr.length) { + const length = arr.length; + const finalStart = Math.max(start >= 0 ? start : length + start, 0); + const finalEnd = Math.min(end >= 0 ? end : length + end, length); + const newArr = arr.slice(); + for (let i = finalStart; i < finalEnd; i++) { + newArr[i] = value; + } + return newArr; +} + +exports.toFilled = toFilled; diff --git a/node_modules/es-toolkit/dist/array/toFilled.mjs b/node_modules/es-toolkit/dist/array/toFilled.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3b099e35cb3ad3be41c241b0e507cd456990c9ca --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.mjs @@ -0,0 +1,12 @@ +function toFilled(arr, value, start = 0, end = arr.length) { + const length = arr.length; + const finalStart = Math.max(start >= 0 ? start : length + start, 0); + const finalEnd = Math.min(end >= 0 ? end : length + end, length); + const newArr = arr.slice(); + for (let i = finalStart; i < finalEnd; i++) { + newArr[i] = value; + } + return newArr; +} + +export { toFilled }; diff --git a/node_modules/es-toolkit/dist/array/union.d.mts b/node_modules/es-toolkit/dist/array/union.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..005b0a7daaaf824b3a8327be84b48f6848fa189b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.d.mts @@ -0,0 +1,20 @@ +/** + * Creates an array of unique values from all given arrays. + * + * This function takes two arrays, merges them into a single array, and returns a new array + * containing only the unique values from the merged array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr1 - The first array to merge and filter for unique values. + * @param {T[]} arr2 - The second array to merge and filter for unique values. + * @returns {T[]} A new array of unique values. + * + * @example + * const array1 = [1, 2, 3]; + * const array2 = [3, 4, 5]; + * const result = union(array1, array2); + * // result will be [1, 2, 3, 4, 5] + */ +declare function union(arr1: readonly T[], arr2: readonly T[]): T[]; + +export { union }; diff --git a/node_modules/es-toolkit/dist/array/union.d.ts b/node_modules/es-toolkit/dist/array/union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..005b0a7daaaf824b3a8327be84b48f6848fa189b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.d.ts @@ -0,0 +1,20 @@ +/** + * Creates an array of unique values from all given arrays. + * + * This function takes two arrays, merges them into a single array, and returns a new array + * containing only the unique values from the merged array. + * + * @template T - The type of elements in the array. + * @param {T[]} arr1 - The first array to merge and filter for unique values. + * @param {T[]} arr2 - The second array to merge and filter for unique values. + * @returns {T[]} A new array of unique values. + * + * @example + * const array1 = [1, 2, 3]; + * const array2 = [3, 4, 5]; + * const result = union(array1, array2); + * // result will be [1, 2, 3, 4, 5] + */ +declare function union(arr1: readonly T[], arr2: readonly T[]): T[]; + +export { union }; diff --git a/node_modules/es-toolkit/dist/array/union.js b/node_modules/es-toolkit/dist/array/union.js new file mode 100644 index 0000000000000000000000000000000000000000..e415fb76b60d74df62f3faf3abdf08a1156be67e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const uniq = require('./uniq.js'); + +function union(arr1, arr2) { + return uniq.uniq(arr1.concat(arr2)); +} + +exports.union = union; diff --git a/node_modules/es-toolkit/dist/array/union.mjs b/node_modules/es-toolkit/dist/array/union.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c63152af19d16b3b4f888154d4deece8fc520bd0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.mjs @@ -0,0 +1,7 @@ +import { uniq } from './uniq.mjs'; + +function union(arr1, arr2) { + return uniq(arr1.concat(arr2)); +} + +export { union }; diff --git a/node_modules/es-toolkit/dist/array/unionBy.d.mts b/node_modules/es-toolkit/dist/array/unionBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6593b4b9eb0a31f08aa53e886f9c0c382a1304e2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.d.mts @@ -0,0 +1,25 @@ +/** + * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality. + * + * @template T - The type of elements in the array. + * @template U - The type of mapped elements. + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @param {(item: T) => U} mapper - The function to map array elements to comparison values. + * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function. + * + * @example + * // Custom mapping function for numbers (modulo comparison) + * const moduloMapper = (x) => x % 3; + * unionBy([1, 2, 3], [4, 5, 6], moduloMapper); + * // Returns [1, 2, 3] + * + * @example + * // Custom mapping function for objects with an 'id' property + * const idMapper = (obj) => obj.id; + * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper); + * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }] + */ +declare function unionBy(arr1: readonly T[], arr2: readonly T[], mapper: (item: T) => U): T[]; + +export { unionBy }; diff --git a/node_modules/es-toolkit/dist/array/unionBy.d.ts b/node_modules/es-toolkit/dist/array/unionBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6593b4b9eb0a31f08aa53e886f9c0c382a1304e2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.d.ts @@ -0,0 +1,25 @@ +/** + * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality. + * + * @template T - The type of elements in the array. + * @template U - The type of mapped elements. + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @param {(item: T) => U} mapper - The function to map array elements to comparison values. + * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function. + * + * @example + * // Custom mapping function for numbers (modulo comparison) + * const moduloMapper = (x) => x % 3; + * unionBy([1, 2, 3], [4, 5, 6], moduloMapper); + * // Returns [1, 2, 3] + * + * @example + * // Custom mapping function for objects with an 'id' property + * const idMapper = (obj) => obj.id; + * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper); + * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }] + */ +declare function unionBy(arr1: readonly T[], arr2: readonly T[], mapper: (item: T) => U): T[]; + +export { unionBy }; diff --git a/node_modules/es-toolkit/dist/array/unionBy.js b/node_modules/es-toolkit/dist/array/unionBy.js new file mode 100644 index 0000000000000000000000000000000000000000..f3854bd7bd7ed7d41c2b1957ace1fdecbee0461c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const uniqBy = require('./uniqBy.js'); + +function unionBy(arr1, arr2, mapper) { + return uniqBy.uniqBy(arr1.concat(arr2), mapper); +} + +exports.unionBy = unionBy; diff --git a/node_modules/es-toolkit/dist/array/unionBy.mjs b/node_modules/es-toolkit/dist/array/unionBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..013bb9b1427fad019b85297307c4727dc62fc236 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.mjs @@ -0,0 +1,7 @@ +import { uniqBy } from './uniqBy.mjs'; + +function unionBy(arr1, arr2, mapper) { + return uniqBy(arr1.concat(arr2), mapper); +} + +export { unionBy }; diff --git a/node_modules/es-toolkit/dist/array/unionWith.d.mts b/node_modules/es-toolkit/dist/array/unionWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4ed2495661786848d730da368727117b3dea4da6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.d.mts @@ -0,0 +1,23 @@ +/** + * Creates an array of unique values from two given arrays based on a custom equality function. + * + * This function takes two arrays and a custom equality function, merges the arrays, and returns + * a new array containing only the unique values as determined by the custom equality function. + * + * @template T - The type of elements in the array. + * @param {T[]} arr1 - The first array to merge and filter for unique values. + * @param {T[]} arr2 - The second array to merge and filter for unique values. + * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal. + * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise. + * @returns {T[]} A new array of unique values based on the custom equality function. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }]; + * const array2 = [{ id: 2 }, { id: 3 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * const result = unionWith(array1, array2, areItemsEqual); + * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays + */ +declare function unionWith(arr1: readonly T[], arr2: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[]; + +export { unionWith }; diff --git a/node_modules/es-toolkit/dist/array/unionWith.d.ts b/node_modules/es-toolkit/dist/array/unionWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ed2495661786848d730da368727117b3dea4da6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.d.ts @@ -0,0 +1,23 @@ +/** + * Creates an array of unique values from two given arrays based on a custom equality function. + * + * This function takes two arrays and a custom equality function, merges the arrays, and returns + * a new array containing only the unique values as determined by the custom equality function. + * + * @template T - The type of elements in the array. + * @param {T[]} arr1 - The first array to merge and filter for unique values. + * @param {T[]} arr2 - The second array to merge and filter for unique values. + * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal. + * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise. + * @returns {T[]} A new array of unique values based on the custom equality function. + * + * @example + * const array1 = [{ id: 1 }, { id: 2 }]; + * const array2 = [{ id: 2 }, { id: 3 }]; + * const areItemsEqual = (a, b) => a.id === b.id; + * const result = unionWith(array1, array2, areItemsEqual); + * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays + */ +declare function unionWith(arr1: readonly T[], arr2: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[]; + +export { unionWith }; diff --git a/node_modules/es-toolkit/dist/array/unionWith.js b/node_modules/es-toolkit/dist/array/unionWith.js new file mode 100644 index 0000000000000000000000000000000000000000..14857499aa3209675e906c5df9c026a49c602cf0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const uniqWith = require('./uniqWith.js'); + +function unionWith(arr1, arr2, areItemsEqual) { + return uniqWith.uniqWith(arr1.concat(arr2), areItemsEqual); +} + +exports.unionWith = unionWith; diff --git a/node_modules/es-toolkit/dist/array/unionWith.mjs b/node_modules/es-toolkit/dist/array/unionWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7c00c078e2f8283224add7053afdcb2600d28789 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.mjs @@ -0,0 +1,7 @@ +import { uniqWith } from './uniqWith.mjs'; + +function unionWith(arr1, arr2, areItemsEqual) { + return uniqWith(arr1.concat(arr2), areItemsEqual); +} + +export { unionWith }; diff --git a/node_modules/es-toolkit/dist/array/uniq.d.mts b/node_modules/es-toolkit/dist/array/uniq.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..63ec962f6cbceb31f72de12f9f95d043aeb69f25 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.d.mts @@ -0,0 +1,18 @@ +/** + * Creates a duplicate-free version of an array. + * + * This function takes an array and returns a new array containing only the unique values + * from the original array, preserving the order of first occurrence. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to process. + * @returns {T[]} A new array with only unique values from the original array. + * + * @example + * const array = [1, 2, 2, 3, 4, 4, 5]; + * const result = uniq(array); + * // result will be [1, 2, 3, 4, 5] + */ +declare function uniq(arr: readonly T[]): T[]; + +export { uniq }; diff --git a/node_modules/es-toolkit/dist/array/uniq.d.ts b/node_modules/es-toolkit/dist/array/uniq.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..63ec962f6cbceb31f72de12f9f95d043aeb69f25 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.d.ts @@ -0,0 +1,18 @@ +/** + * Creates a duplicate-free version of an array. + * + * This function takes an array and returns a new array containing only the unique values + * from the original array, preserving the order of first occurrence. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to process. + * @returns {T[]} A new array with only unique values from the original array. + * + * @example + * const array = [1, 2, 2, 3, 4, 4, 5]; + * const result = uniq(array); + * // result will be [1, 2, 3, 4, 5] + */ +declare function uniq(arr: readonly T[]): T[]; + +export { uniq }; diff --git a/node_modules/es-toolkit/dist/array/uniq.js b/node_modules/es-toolkit/dist/array/uniq.js new file mode 100644 index 0000000000000000000000000000000000000000..91a1d34cc4b2f31dd8da1c55d323eae0a2912823 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function uniq(arr) { + return [...new Set(arr)]; +} + +exports.uniq = uniq; diff --git a/node_modules/es-toolkit/dist/array/uniq.mjs b/node_modules/es-toolkit/dist/array/uniq.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0d2be28a613b75e3875af2e19324db7d6860e20c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.mjs @@ -0,0 +1,5 @@ +function uniq(arr) { + return [...new Set(arr)]; +} + +export { uniq }; diff --git a/node_modules/es-toolkit/dist/array/uniqBy.d.mts b/node_modules/es-toolkit/dist/array/uniqBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1c4763a1f7e2cab944c430d2ea1503002739171f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.d.mts @@ -0,0 +1,31 @@ +/** + * Returns a new array containing only the unique elements from the original array, + * based on the values returned by the mapper function. + * + * When duplicates are found, the first occurrence is kept and the rest are discarded. + * + * @template T - The type of elements in the array. + * @template U - The type of mapped elements. + * @param {T[]} arr - The array to process. + * @param {(item: T) => U} mapper - The function used to convert the array elements. + * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function. + * + * @example + * ```ts + * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor); + * // [1.2, 2.1, 3.2, 5.7, 7.19] + * ``` + * + * @example + * const array = [ + * { category: 'fruit', name: 'apple' }, + * { category: 'fruit', name: 'banana' }, + * { category: 'vegetable', name: 'carrot' }, + * ]; + * uniqBy(array, item => item.category).length + * // 2 + * ``` + */ +declare function uniqBy(arr: readonly T[], mapper: (item: T, index: number, array: readonly T[]) => U): T[]; + +export { uniqBy }; diff --git a/node_modules/es-toolkit/dist/array/uniqBy.d.ts b/node_modules/es-toolkit/dist/array/uniqBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c4763a1f7e2cab944c430d2ea1503002739171f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.d.ts @@ -0,0 +1,31 @@ +/** + * Returns a new array containing only the unique elements from the original array, + * based on the values returned by the mapper function. + * + * When duplicates are found, the first occurrence is kept and the rest are discarded. + * + * @template T - The type of elements in the array. + * @template U - The type of mapped elements. + * @param {T[]} arr - The array to process. + * @param {(item: T) => U} mapper - The function used to convert the array elements. + * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function. + * + * @example + * ```ts + * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor); + * // [1.2, 2.1, 3.2, 5.7, 7.19] + * ``` + * + * @example + * const array = [ + * { category: 'fruit', name: 'apple' }, + * { category: 'fruit', name: 'banana' }, + * { category: 'vegetable', name: 'carrot' }, + * ]; + * uniqBy(array, item => item.category).length + * // 2 + * ``` + */ +declare function uniqBy(arr: readonly T[], mapper: (item: T, index: number, array: readonly T[]) => U): T[]; + +export { uniqBy }; diff --git a/node_modules/es-toolkit/dist/array/uniqBy.js b/node_modules/es-toolkit/dist/array/uniqBy.js new file mode 100644 index 0000000000000000000000000000000000000000..a0b45108aefab2afdd1c9ac2d038cfcd8759efd0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function uniqBy(arr, mapper) { + const map = new Map(); + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = mapper(item, i, arr); + if (!map.has(key)) { + map.set(key, item); + } + } + return Array.from(map.values()); +} + +exports.uniqBy = uniqBy; diff --git a/node_modules/es-toolkit/dist/array/uniqBy.mjs b/node_modules/es-toolkit/dist/array/uniqBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..40a3c9deed8eac5b1a9813b2cbc6e4caa776fb13 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.mjs @@ -0,0 +1,13 @@ +function uniqBy(arr, mapper) { + const map = new Map(); + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const key = mapper(item, i, arr); + if (!map.has(key)) { + map.set(key, item); + } + } + return Array.from(map.values()); +} + +export { uniqBy }; diff --git a/node_modules/es-toolkit/dist/array/uniqWith.d.mts b/node_modules/es-toolkit/dist/array/uniqWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1256b39168246b8202f6518604899cdd00a946a3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.d.mts @@ -0,0 +1,18 @@ +/** + * Returns a new array containing only the unique elements from the original array, + * based on the values returned by the comparator function. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to process. + * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements. + * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function. + * + * @example + * ```ts + * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1); + * // [1.2, 3.2, 5.7, 7.19] + * ``` + */ +declare function uniqWith(arr: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[]; + +export { uniqWith }; diff --git a/node_modules/es-toolkit/dist/array/uniqWith.d.ts b/node_modules/es-toolkit/dist/array/uniqWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1256b39168246b8202f6518604899cdd00a946a3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.d.ts @@ -0,0 +1,18 @@ +/** + * Returns a new array containing only the unique elements from the original array, + * based on the values returned by the comparator function. + * + * @template T - The type of elements in the array. + * @param {T[]} arr - The array to process. + * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements. + * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function. + * + * @example + * ```ts + * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1); + * // [1.2, 3.2, 5.7, 7.19] + * ``` + */ +declare function uniqWith(arr: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[]; + +export { uniqWith }; diff --git a/node_modules/es-toolkit/dist/array/uniqWith.js b/node_modules/es-toolkit/dist/array/uniqWith.js new file mode 100644 index 0000000000000000000000000000000000000000..6036a0c3ba6259a667a246f53001823c516613ca --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function uniqWith(arr, areItemsEqual) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const isUniq = result.every(v => !areItemsEqual(v, item)); + if (isUniq) { + result.push(item); + } + } + return result; +} + +exports.uniqWith = uniqWith; diff --git a/node_modules/es-toolkit/dist/array/uniqWith.mjs b/node_modules/es-toolkit/dist/array/uniqWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f8e9f368d2b1791aa424e379fbff30a2229da1d7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.mjs @@ -0,0 +1,13 @@ +function uniqWith(arr, areItemsEqual) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + const isUniq = result.every(v => !areItemsEqual(v, item)); + if (isUniq) { + result.push(item); + } + } + return result; +} + +export { uniqWith }; diff --git a/node_modules/es-toolkit/dist/array/unzip.d.mts b/node_modules/es-toolkit/dist/array/unzip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9b096af39ac42cf7172adf9293873c12cd5ccc5e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.d.mts @@ -0,0 +1,19 @@ +/** + * Gathers elements in the same position in an internal array + * from a grouped array of elements and returns them as a new array. + * + * @template T - The type of elements in the nested array. + * @param {Array<[...T]>} zipped - The nested array to unzip. + * @returns {Unzip} A new array of unzipped elements. + * + * @example + * const zipped = [['a', true, 1],['b', false, 2]]; + * const result = unzip(zipped); + * // result will be [['a', 'b'], [true, false], [1, 2]] + */ +declare function unzip(zipped: ReadonlyArray<[...T]>): Unzip; +type Unzip = { + [I in keyof K]: Array; +}; + +export { unzip }; diff --git a/node_modules/es-toolkit/dist/array/unzip.d.ts b/node_modules/es-toolkit/dist/array/unzip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b096af39ac42cf7172adf9293873c12cd5ccc5e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.d.ts @@ -0,0 +1,19 @@ +/** + * Gathers elements in the same position in an internal array + * from a grouped array of elements and returns them as a new array. + * + * @template T - The type of elements in the nested array. + * @param {Array<[...T]>} zipped - The nested array to unzip. + * @returns {Unzip} A new array of unzipped elements. + * + * @example + * const zipped = [['a', true, 1],['b', false, 2]]; + * const result = unzip(zipped); + * // result will be [['a', 'b'], [true, false], [1, 2]] + */ +declare function unzip(zipped: ReadonlyArray<[...T]>): Unzip; +type Unzip = { + [I in keyof K]: Array; +}; + +export { unzip }; diff --git a/node_modules/es-toolkit/dist/array/unzip.js b/node_modules/es-toolkit/dist/array/unzip.js new file mode 100644 index 0000000000000000000000000000000000000000..91fba16506c5c4b189ecb2dafc823d6c05648694 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function unzip(zipped) { + let maxLen = 0; + for (let i = 0; i < zipped.length; i++) { + if (zipped[i].length > maxLen) { + maxLen = zipped[i].length; + } + } + const result = new Array(maxLen); + for (let i = 0; i < maxLen; i++) { + result[i] = new Array(zipped.length); + for (let j = 0; j < zipped.length; j++) { + result[i][j] = zipped[j][i]; + } + } + return result; +} + +exports.unzip = unzip; diff --git a/node_modules/es-toolkit/dist/array/unzip.mjs b/node_modules/es-toolkit/dist/array/unzip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..29b64b1eb54800cce1298598ed5515a56cfc5540 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.mjs @@ -0,0 +1,18 @@ +function unzip(zipped) { + let maxLen = 0; + for (let i = 0; i < zipped.length; i++) { + if (zipped[i].length > maxLen) { + maxLen = zipped[i].length; + } + } + const result = new Array(maxLen); + for (let i = 0; i < maxLen; i++) { + result[i] = new Array(zipped.length); + for (let j = 0; j < zipped.length; j++) { + result[i][j] = zipped[j][i]; + } + } + return result; +} + +export { unzip }; diff --git a/node_modules/es-toolkit/dist/array/unzipWith.d.mts b/node_modules/es-toolkit/dist/array/unzipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4bd635f96063d57f3b0a3b564d48a7867e4636fb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.d.mts @@ -0,0 +1,17 @@ +/** + * Unzips an array of arrays, applying an `iteratee` function to regrouped elements. + * + * @template T, R + * @param {T[][]} target - The nested array to unzip. This is an array of arrays, + * where each inner array contains elements to be unzipped. + * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements. + * @returns {R[]} A new array of unzipped and transformed elements. + * + * @example + * const nestedArray = [[1, 2], [3, 4], [5, 6]]; + * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3); + * // result will be [9, 12] + */ +declare function unzipWith(target: readonly T[][], iteratee: (...args: T[]) => R): R[]; + +export { unzipWith }; diff --git a/node_modules/es-toolkit/dist/array/unzipWith.d.ts b/node_modules/es-toolkit/dist/array/unzipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4bd635f96063d57f3b0a3b564d48a7867e4636fb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.d.ts @@ -0,0 +1,17 @@ +/** + * Unzips an array of arrays, applying an `iteratee` function to regrouped elements. + * + * @template T, R + * @param {T[][]} target - The nested array to unzip. This is an array of arrays, + * where each inner array contains elements to be unzipped. + * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements. + * @returns {R[]} A new array of unzipped and transformed elements. + * + * @example + * const nestedArray = [[1, 2], [3, 4], [5, 6]]; + * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3); + * // result will be [9, 12] + */ +declare function unzipWith(target: readonly T[][], iteratee: (...args: T[]) => R): R[]; + +export { unzipWith }; diff --git a/node_modules/es-toolkit/dist/array/unzipWith.js b/node_modules/es-toolkit/dist/array/unzipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..c41afb66af87bbda71dda0fa999fabcafd4acf49 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function unzipWith(target, iteratee) { + const maxLength = Math.max(...target.map(innerArray => innerArray.length)); + const result = new Array(maxLength); + for (let i = 0; i < maxLength; i++) { + const group = new Array(target.length); + for (let j = 0; j < target.length; j++) { + group[j] = target[j][i]; + } + result[i] = iteratee(...group); + } + return result; +} + +exports.unzipWith = unzipWith; diff --git a/node_modules/es-toolkit/dist/array/unzipWith.mjs b/node_modules/es-toolkit/dist/array/unzipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..23810f403d4ac1ba8c0e5bc40b110c6a9bf8b1dc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.mjs @@ -0,0 +1,14 @@ +function unzipWith(target, iteratee) { + const maxLength = Math.max(...target.map(innerArray => innerArray.length)); + const result = new Array(maxLength); + for (let i = 0; i < maxLength; i++) { + const group = new Array(target.length); + for (let j = 0; j < target.length; j++) { + group[j] = target[j][i]; + } + result[i] = iteratee(...group); + } + return result; +} + +export { unzipWith }; diff --git a/node_modules/es-toolkit/dist/array/windowed.d.mts b/node_modules/es-toolkit/dist/array/windowed.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..dfd21209d2b5cd614d8fe96b33041ac5b7cfea52 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.d.mts @@ -0,0 +1,50 @@ +/** + * Options for the windowed function. + * + * @interface WindowedOptions + * @property {boolean} [partialWindows=false] - Whether to include partial windows at the end of the array. + */ +interface WindowedOptions { + /** + * Whether to include partial windows at the end of the array. + * + * By default, `windowed` only includes full windows in the result, + * ignoring any leftover elements that can't form a full window. + * + * If `partialWindows` is true, the function will also include these smaller, partial windows at the end of the result. + */ + partialWindows?: boolean; +} +/** + * Creates an array of sub-arrays (windows) from the input array, each of the specified size. + * The windows can overlap depending on the step size provided. + * + * By default, only full windows are included in the result, and any leftover elements that can't form a full window are ignored. + * + * If the `partialWindows` option is set to true in the options object, the function will also include partial windows at the end of the result. + * Partial windows are smaller sub-arrays created when there aren't enough elements left in the input array to form a full window. + * + * @template T + * @param {readonly T[]} arr - The input array to create windows from. + * @param {number} size - The size of each window. Must be a positive integer. + * @param {number} [step=1] - The step size between the start of each window. Must be a positive integer. + * @param {WindowedOptions} [options={}] - Options object to configure the behavior of the function. + * @param {boolean} [options.partialWindows=false] - Whether to include partial windows at the end of the array. + * @returns {T[][]} An array of windows (sub-arrays) created from the input array. + * @throws {Error} If the size or step is not a positive integer. + * + * @example + * windowed([1, 2, 3, 4], 2); + * // => [[1, 2], [2, 3], [3, 4]] + * + * @example + * windowed([1, 2, 3, 4, 5, 6], 3, 2); + * // => [[1, 2, 3], [3, 4, 5]] + * + * @example + * windowed([1, 2, 3, 4, 5, 6], 3, 2, { partialWindows: true }); + * // => [[1, 2, 3], [3, 4, 5], [5, 6]] + */ +declare function windowed(arr: readonly T[], size: number, step?: number, { partialWindows }?: WindowedOptions): T[][]; + +export { type WindowedOptions, windowed }; diff --git a/node_modules/es-toolkit/dist/array/windowed.d.ts b/node_modules/es-toolkit/dist/array/windowed.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfd21209d2b5cd614d8fe96b33041ac5b7cfea52 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.d.ts @@ -0,0 +1,50 @@ +/** + * Options for the windowed function. + * + * @interface WindowedOptions + * @property {boolean} [partialWindows=false] - Whether to include partial windows at the end of the array. + */ +interface WindowedOptions { + /** + * Whether to include partial windows at the end of the array. + * + * By default, `windowed` only includes full windows in the result, + * ignoring any leftover elements that can't form a full window. + * + * If `partialWindows` is true, the function will also include these smaller, partial windows at the end of the result. + */ + partialWindows?: boolean; +} +/** + * Creates an array of sub-arrays (windows) from the input array, each of the specified size. + * The windows can overlap depending on the step size provided. + * + * By default, only full windows are included in the result, and any leftover elements that can't form a full window are ignored. + * + * If the `partialWindows` option is set to true in the options object, the function will also include partial windows at the end of the result. + * Partial windows are smaller sub-arrays created when there aren't enough elements left in the input array to form a full window. + * + * @template T + * @param {readonly T[]} arr - The input array to create windows from. + * @param {number} size - The size of each window. Must be a positive integer. + * @param {number} [step=1] - The step size between the start of each window. Must be a positive integer. + * @param {WindowedOptions} [options={}] - Options object to configure the behavior of the function. + * @param {boolean} [options.partialWindows=false] - Whether to include partial windows at the end of the array. + * @returns {T[][]} An array of windows (sub-arrays) created from the input array. + * @throws {Error} If the size or step is not a positive integer. + * + * @example + * windowed([1, 2, 3, 4], 2); + * // => [[1, 2], [2, 3], [3, 4]] + * + * @example + * windowed([1, 2, 3, 4, 5, 6], 3, 2); + * // => [[1, 2, 3], [3, 4, 5]] + * + * @example + * windowed([1, 2, 3, 4, 5, 6], 3, 2, { partialWindows: true }); + * // => [[1, 2, 3], [3, 4, 5], [5, 6]] + */ +declare function windowed(arr: readonly T[], size: number, step?: number, { partialWindows }?: WindowedOptions): T[][]; + +export { type WindowedOptions, windowed }; diff --git a/node_modules/es-toolkit/dist/array/windowed.js b/node_modules/es-toolkit/dist/array/windowed.js new file mode 100644 index 0000000000000000000000000000000000000000..b565b66d5ca7913f55297c8fd50121df75477b21 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function windowed(arr, size, step = 1, { partialWindows = false } = {}) { + if (size <= 0 || !Number.isInteger(size)) { + throw new Error('Size must be a positive integer.'); + } + if (step <= 0 || !Number.isInteger(step)) { + throw new Error('Step must be a positive integer.'); + } + const result = []; + const end = partialWindows ? arr.length : arr.length - size + 1; + for (let i = 0; i < end; i += step) { + result.push(arr.slice(i, i + size)); + } + return result; +} + +exports.windowed = windowed; diff --git a/node_modules/es-toolkit/dist/array/windowed.mjs b/node_modules/es-toolkit/dist/array/windowed.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d476e5dc05df3a2bdc1a5d7daf9bed88a3daaaff --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.mjs @@ -0,0 +1,16 @@ +function windowed(arr, size, step = 1, { partialWindows = false } = {}) { + if (size <= 0 || !Number.isInteger(size)) { + throw new Error('Size must be a positive integer.'); + } + if (step <= 0 || !Number.isInteger(step)) { + throw new Error('Step must be a positive integer.'); + } + const result = []; + const end = partialWindows ? arr.length : arr.length - size + 1; + for (let i = 0; i < end; i += step) { + result.push(arr.slice(i, i + size)); + } + return result; +} + +export { windowed }; diff --git a/node_modules/es-toolkit/dist/array/without.d.mts b/node_modules/es-toolkit/dist/array/without.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..882430789550d8048a6b468c91a62aeaffe16459 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.d.mts @@ -0,0 +1,23 @@ +/** + * Creates an array that excludes all specified values. + * + * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). + * + * @template T The type of elements in the array. + * @param {T[]} array - The array to filter. + * @param {...T[]} values - The values to exclude. + * @returns {T[]} A new array without the specified values. + * + * @example + * // Removes the specified values from the array + * without([1, 2, 3, 4, 5], 2, 4); + * // Returns: [1, 3, 5] + * + * @example + * // Removes specified string values from the array + * without(['a', 'b', 'c', 'a'], 'a'); + * // Returns: ['b', 'c'] + */ +declare function without(array: readonly T[], ...values: T[]): T[]; + +export { without }; diff --git a/node_modules/es-toolkit/dist/array/without.d.ts b/node_modules/es-toolkit/dist/array/without.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..882430789550d8048a6b468c91a62aeaffe16459 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.d.ts @@ -0,0 +1,23 @@ +/** + * Creates an array that excludes all specified values. + * + * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). + * + * @template T The type of elements in the array. + * @param {T[]} array - The array to filter. + * @param {...T[]} values - The values to exclude. + * @returns {T[]} A new array without the specified values. + * + * @example + * // Removes the specified values from the array + * without([1, 2, 3, 4, 5], 2, 4); + * // Returns: [1, 3, 5] + * + * @example + * // Removes specified string values from the array + * without(['a', 'b', 'c', 'a'], 'a'); + * // Returns: ['b', 'c'] + */ +declare function without(array: readonly T[], ...values: T[]): T[]; + +export { without }; diff --git a/node_modules/es-toolkit/dist/array/without.js b/node_modules/es-toolkit/dist/array/without.js new file mode 100644 index 0000000000000000000000000000000000000000..35a381c3cf934a56f58bb4fb4064ff6fbed4153a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const difference = require('./difference.js'); + +function without(array, ...values) { + return difference.difference(array, values); +} + +exports.without = without; diff --git a/node_modules/es-toolkit/dist/array/without.mjs b/node_modules/es-toolkit/dist/array/without.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1ba1bc413c7e64483d81afd247d21ea7b3ff7e54 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.mjs @@ -0,0 +1,7 @@ +import { difference } from './difference.mjs'; + +function without(array, ...values) { + return difference(array, values); +} + +export { without }; diff --git a/node_modules/es-toolkit/dist/array/xor.d.mts b/node_modules/es-toolkit/dist/array/xor.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e4025168dfe27a6db519a738a9bbefd6990e414f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.d.mts @@ -0,0 +1,20 @@ +/** + * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements + * which are in either of the arrays, but not in their intersection. + * + * @template T - The type of elements in the array. + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both. + * + * @example + * // Returns [1, 2, 5, 6] + * xor([1, 2, 3, 4], [3, 4, 5, 6]); + * + * @example + * // Returns ['a', 'c'] + * xor(['a', 'b'], ['b', 'c']); + */ +declare function xor(arr1: readonly T[], arr2: readonly T[]): T[]; + +export { xor }; diff --git a/node_modules/es-toolkit/dist/array/xor.d.ts b/node_modules/es-toolkit/dist/array/xor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4025168dfe27a6db519a738a9bbefd6990e414f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.d.ts @@ -0,0 +1,20 @@ +/** + * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements + * which are in either of the arrays, but not in their intersection. + * + * @template T - The type of elements in the array. + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both. + * + * @example + * // Returns [1, 2, 5, 6] + * xor([1, 2, 3, 4], [3, 4, 5, 6]); + * + * @example + * // Returns ['a', 'c'] + * xor(['a', 'b'], ['b', 'c']); + */ +declare function xor(arr1: readonly T[], arr2: readonly T[]): T[]; + +export { xor }; diff --git a/node_modules/es-toolkit/dist/array/xor.js b/node_modules/es-toolkit/dist/array/xor.js new file mode 100644 index 0000000000000000000000000000000000000000..027340f69502818e176755ab2dc2c1c6f9a0a18a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const difference = require('./difference.js'); +const intersection = require('./intersection.js'); +const union = require('./union.js'); + +function xor(arr1, arr2) { + return difference.difference(union.union(arr1, arr2), intersection.intersection(arr1, arr2)); +} + +exports.xor = xor; diff --git a/node_modules/es-toolkit/dist/array/xor.mjs b/node_modules/es-toolkit/dist/array/xor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9632ea39f064115ef315a7a2e0f40b27db6c30b4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.mjs @@ -0,0 +1,9 @@ +import { difference } from './difference.mjs'; +import { intersection } from './intersection.mjs'; +import { union } from './union.mjs'; + +function xor(arr1, arr2) { + return difference(union(arr1, arr2), intersection(arr1, arr2)); +} + +export { xor }; diff --git a/node_modules/es-toolkit/dist/array/xorBy.d.mts b/node_modules/es-toolkit/dist/array/xorBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7375e7e9709d4b35e45dab2e7e40184bcf2fd0e3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.d.mts @@ -0,0 +1,22 @@ +/** + * Computes the symmetric difference between two arrays using a custom mapping function. + * The symmetric difference is the set of elements which are in either of the arrays, + * but not in their intersection, determined by the result of the mapping function. + * + * @template T - Type of elements in the input arrays. + * @template U - Type of the values returned by the mapping function. + * + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @param {(item: T) => U} mapper - The function to map array elements to comparison values. + * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function. + * + * @example + * // Custom mapping function for objects with an 'id' property + * const idMapper = obj => obj.id; + * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper); + * // Returns [{ id: 1 }, { id: 3 }] + */ +declare function xorBy(arr1: readonly T[], arr2: readonly T[], mapper: (item: T) => U): T[]; + +export { xorBy }; diff --git a/node_modules/es-toolkit/dist/array/xorBy.d.ts b/node_modules/es-toolkit/dist/array/xorBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7375e7e9709d4b35e45dab2e7e40184bcf2fd0e3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.d.ts @@ -0,0 +1,22 @@ +/** + * Computes the symmetric difference between two arrays using a custom mapping function. + * The symmetric difference is the set of elements which are in either of the arrays, + * but not in their intersection, determined by the result of the mapping function. + * + * @template T - Type of elements in the input arrays. + * @template U - Type of the values returned by the mapping function. + * + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @param {(item: T) => U} mapper - The function to map array elements to comparison values. + * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function. + * + * @example + * // Custom mapping function for objects with an 'id' property + * const idMapper = obj => obj.id; + * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper); + * // Returns [{ id: 1 }, { id: 3 }] + */ +declare function xorBy(arr1: readonly T[], arr2: readonly T[], mapper: (item: T) => U): T[]; + +export { xorBy }; diff --git a/node_modules/es-toolkit/dist/array/xorBy.js b/node_modules/es-toolkit/dist/array/xorBy.js new file mode 100644 index 0000000000000000000000000000000000000000..baf516b1bc809b0a0e426c7eeef5b05d5d8cb609 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const differenceBy = require('./differenceBy.js'); +const intersectionBy = require('./intersectionBy.js'); +const unionBy = require('./unionBy.js'); + +function xorBy(arr1, arr2, mapper) { + const union = unionBy.unionBy(arr1, arr2, mapper); + const intersection = intersectionBy.intersectionBy(arr1, arr2, mapper); + return differenceBy.differenceBy(union, intersection, mapper); +} + +exports.xorBy = xorBy; diff --git a/node_modules/es-toolkit/dist/array/xorBy.mjs b/node_modules/es-toolkit/dist/array/xorBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d3798586317a1bf2b0897430dc86924305b07b8d --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.mjs @@ -0,0 +1,11 @@ +import { differenceBy } from './differenceBy.mjs'; +import { intersectionBy } from './intersectionBy.mjs'; +import { unionBy } from './unionBy.mjs'; + +function xorBy(arr1, arr2, mapper) { + const union = unionBy(arr1, arr2, mapper); + const intersection = intersectionBy(arr1, arr2, mapper); + return differenceBy(union, intersection, mapper); +} + +export { xorBy }; diff --git a/node_modules/es-toolkit/dist/array/xorWith.d.mts b/node_modules/es-toolkit/dist/array/xorWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1aff58fb7ddfc01ed65cb561fa85101b2db112ac --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.d.mts @@ -0,0 +1,21 @@ +/** + * Computes the symmetric difference between two arrays using a custom equality function. + * The symmetric difference is the set of elements which are in either of the arrays, + * but not in their intersection. + * + * @template T - Type of elements in the input arrays. + * + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements. + * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function. + * + * @example + * // Custom equality function for objects with an 'id' property + * const areObjectsEqual = (a, b) => a.id === b.id; + * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual); + * // Returns [{ id: 1 }, { id: 3 }] + */ +declare function xorWith(arr1: readonly T[], arr2: readonly T[], areElementsEqual: (item1: T, item2: T) => boolean): T[]; + +export { xorWith }; diff --git a/node_modules/es-toolkit/dist/array/xorWith.d.ts b/node_modules/es-toolkit/dist/array/xorWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1aff58fb7ddfc01ed65cb561fa85101b2db112ac --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.d.ts @@ -0,0 +1,21 @@ +/** + * Computes the symmetric difference between two arrays using a custom equality function. + * The symmetric difference is the set of elements which are in either of the arrays, + * but not in their intersection. + * + * @template T - Type of elements in the input arrays. + * + * @param {T[]} arr1 - The first array. + * @param {T[]} arr2 - The second array. + * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements. + * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function. + * + * @example + * // Custom equality function for objects with an 'id' property + * const areObjectsEqual = (a, b) => a.id === b.id; + * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual); + * // Returns [{ id: 1 }, { id: 3 }] + */ +declare function xorWith(arr1: readonly T[], arr2: readonly T[], areElementsEqual: (item1: T, item2: T) => boolean): T[]; + +export { xorWith }; diff --git a/node_modules/es-toolkit/dist/array/xorWith.js b/node_modules/es-toolkit/dist/array/xorWith.js new file mode 100644 index 0000000000000000000000000000000000000000..54f7264317c45d5c8401f81183f4b3e67e5f12ec --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const differenceWith = require('./differenceWith.js'); +const intersectionWith = require('./intersectionWith.js'); +const unionWith = require('./unionWith.js'); + +function xorWith(arr1, arr2, areElementsEqual) { + const union = unionWith.unionWith(arr1, arr2, areElementsEqual); + const intersection = intersectionWith.intersectionWith(arr1, arr2, areElementsEqual); + return differenceWith.differenceWith(union, intersection, areElementsEqual); +} + +exports.xorWith = xorWith; diff --git a/node_modules/es-toolkit/dist/array/xorWith.mjs b/node_modules/es-toolkit/dist/array/xorWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a6b316bd0d108d20fe97facc763deab66079702c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.mjs @@ -0,0 +1,11 @@ +import { differenceWith } from './differenceWith.mjs'; +import { intersectionWith } from './intersectionWith.mjs'; +import { unionWith } from './unionWith.mjs'; + +function xorWith(arr1, arr2, areElementsEqual) { + const union = unionWith(arr1, arr2, areElementsEqual); + const intersection = intersectionWith(arr1, arr2, areElementsEqual); + return differenceWith(union, intersection, areElementsEqual); +} + +export { xorWith }; diff --git a/node_modules/es-toolkit/dist/array/zip.d.mts b/node_modules/es-toolkit/dist/array/zip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c306f957630859f446bef8dcfce174b7656e17fd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.d.mts @@ -0,0 +1,106 @@ +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {T[]} arr1 - The first array to zip. + * @returns {Array<[T]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const result = zip(arr1); + * // result will be [[1], [2], [3]] + */ +declare function zip(arr1: readonly T[]): Array<[T]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @returns {Array<[T, U]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zip(arr1, arr2); + * // result will be [[1, 'a'], [2, 'b'], [3, 'c']] + */ +declare function zip(arr1: readonly T[], arr2: readonly U[]): Array<[T, U]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @returns {Array<[T, U, V]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +declare function zip(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[]): Array<[T, U, V]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @param {W[]} arr4 - The fourth array to zip. + * @returns {Array<[T, U, V, W]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const result = zip(arr1, arr2, arr3, arr4); + * // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]] + */ +declare function zip(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[]): Array<[T, U, V, W]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {...Array} arrs - The arrays to zip together. + * @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +declare function zip(...arrs: Array): T[][]; + +export { zip }; diff --git a/node_modules/es-toolkit/dist/array/zip.d.ts b/node_modules/es-toolkit/dist/array/zip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c306f957630859f446bef8dcfce174b7656e17fd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.d.ts @@ -0,0 +1,106 @@ +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {T[]} arr1 - The first array to zip. + * @returns {Array<[T]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const result = zip(arr1); + * // result will be [[1], [2], [3]] + */ +declare function zip(arr1: readonly T[]): Array<[T]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @returns {Array<[T, U]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zip(arr1, arr2); + * // result will be [[1, 'a'], [2, 'b'], [3, 'c']] + */ +declare function zip(arr1: readonly T[], arr2: readonly U[]): Array<[T, U]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @returns {Array<[T, U, V]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +declare function zip(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[]): Array<[T, U, V]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @param {W[]} arr4 - The fourth array to zip. + * @returns {Array<[T, U, V, W]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const result = zip(arr1, arr2, arr3, arr4); + * // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]] + */ +declare function zip(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[]): Array<[T, U, V, W]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {...Array} arrs - The arrays to zip together. + * @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +declare function zip(...arrs: Array): T[][]; + +export { zip }; diff --git a/node_modules/es-toolkit/dist/array/zip.js b/node_modules/es-toolkit/dist/array/zip.js new file mode 100644 index 0000000000000000000000000000000000000000..19d7b440b5b8a3d1e69d5eaec44dd9d45807debc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function zip(...arrs) { + let rowCount = 0; + for (let i = 0; i < arrs.length; i++) { + if (arrs[i].length > rowCount) { + rowCount = arrs[i].length; + } + } + const columnCount = arrs.length; + const result = Array(rowCount); + for (let i = 0; i < rowCount; ++i) { + const row = Array(columnCount); + for (let j = 0; j < columnCount; ++j) { + row[j] = arrs[j][i]; + } + result[i] = row; + } + return result; +} + +exports.zip = zip; diff --git a/node_modules/es-toolkit/dist/array/zip.mjs b/node_modules/es-toolkit/dist/array/zip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..60ece2128bd86ffb545df78e614f60f980c23afd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.mjs @@ -0,0 +1,20 @@ +function zip(...arrs) { + let rowCount = 0; + for (let i = 0; i < arrs.length; i++) { + if (arrs[i].length > rowCount) { + rowCount = arrs[i].length; + } + } + const columnCount = arrs.length; + const result = Array(rowCount); + for (let i = 0; i < rowCount; ++i) { + const row = Array(columnCount); + for (let j = 0; j < columnCount; ++j) { + row[j] = arrs[j][i]; + } + result[i] = row; + } + return result; +} + +export { zip }; diff --git a/node_modules/es-toolkit/dist/array/zipObject.d.mts b/node_modules/es-toolkit/dist/array/zipObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f761a01ebafcb616af030aa9c0fb9bbbd29a6ae4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.d.mts @@ -0,0 +1,33 @@ +/** + * Combines two arrays, one of property names and one of corresponding values, into a single object. + * + * This function takes two arrays: one containing property names and another containing corresponding values. + * It returns a new object where the property names from the first array are keys, and the corresponding elements + * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will + * have `undefined` as their values. + * + * @template P - The type of elements in the array. + * @template V - The type of elements in the array. + * @param {P[]} keys - An array of property names. + * @param {V[]} values - An array of values corresponding to the property names. + * @returns {Record} - A new object composed of the given property names and values. + * + * @example + * const keys = ['a', 'b', 'c']; + * const values = [1, 2, 3]; + * const result = zipObject(keys, values); + * // result will be { a: 1, b: 2, c: 3 } + * + * const keys2 = ['a', 'b', 'c']; + * const values2 = [1, 2]; + * const result2 = zipObject(keys2, values2); + * // result2 will be { a: 1, b: 2, c: undefined } + * + * const keys2 = ['a', 'b']; + * const values2 = [1, 2, 3]; + * const result2 = zipObject(keys2, values2); + * // result2 will be { a: 1, b: 2 } + */ +declare function zipObject

(keys: readonly P[], values: readonly V[]): Record; + +export { zipObject }; diff --git a/node_modules/es-toolkit/dist/array/zipObject.d.ts b/node_modules/es-toolkit/dist/array/zipObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f761a01ebafcb616af030aa9c0fb9bbbd29a6ae4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.d.ts @@ -0,0 +1,33 @@ +/** + * Combines two arrays, one of property names and one of corresponding values, into a single object. + * + * This function takes two arrays: one containing property names and another containing corresponding values. + * It returns a new object where the property names from the first array are keys, and the corresponding elements + * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will + * have `undefined` as their values. + * + * @template P - The type of elements in the array. + * @template V - The type of elements in the array. + * @param {P[]} keys - An array of property names. + * @param {V[]} values - An array of values corresponding to the property names. + * @returns {Record} - A new object composed of the given property names and values. + * + * @example + * const keys = ['a', 'b', 'c']; + * const values = [1, 2, 3]; + * const result = zipObject(keys, values); + * // result will be { a: 1, b: 2, c: 3 } + * + * const keys2 = ['a', 'b', 'c']; + * const values2 = [1, 2]; + * const result2 = zipObject(keys2, values2); + * // result2 will be { a: 1, b: 2, c: undefined } + * + * const keys2 = ['a', 'b']; + * const values2 = [1, 2, 3]; + * const result2 = zipObject(keys2, values2); + * // result2 will be { a: 1, b: 2 } + */ +declare function zipObject

(keys: readonly P[], values: readonly V[]): Record; + +export { zipObject }; diff --git a/node_modules/es-toolkit/dist/array/zipObject.js b/node_modules/es-toolkit/dist/array/zipObject.js new file mode 100644 index 0000000000000000000000000000000000000000..4ff4c8cd7b3e0249f8a0e56bf34086ad9e4b2f4e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function zipObject(keys, values) { + const result = {}; + for (let i = 0; i < keys.length; i++) { + result[keys[i]] = values[i]; + } + return result; +} + +exports.zipObject = zipObject; diff --git a/node_modules/es-toolkit/dist/array/zipObject.mjs b/node_modules/es-toolkit/dist/array/zipObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0de346d34b65aec5a8d4b601924f5f6768a74957 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.mjs @@ -0,0 +1,9 @@ +function zipObject(keys, values) { + const result = {}; + for (let i = 0; i < keys.length; i++) { + result[keys[i]] = values[i]; + } + return result; +} + +export { zipObject }; diff --git a/node_modules/es-toolkit/dist/array/zipWith.d.mts b/node_modules/es-toolkit/dist/array/zipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d28f3fc191cd39d0119b91fc8b968e9ec6988efc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.d.mts @@ -0,0 +1,72 @@ +/** + * Combines multiple arrays into a single array using a custom combiner function. + * + * This function takes multiple arrays and a combiner function, and returns a new array where each element + * is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @template T - The type of elements in the first array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {(item: T, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @example + * // Example usage with two arrays: + * const arr1 = [1, 2, 3]; + * const arr2 = [4, 5, 6]; + * const result = zipWith(arr1, arr2, (a, b) => a + b); + * // result will be [5, 7, 9] + * + * @example + * // Example usage with three arrays: + * const arr1 = [1, 2]; + * const arr2 = [3, 4]; + * const arr3 = [5, 6]; + * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`); + * // result will be [`135`, `246`] + */ +declare function zipWith(arr1: readonly T[], combine: (item: T, index: number) => R): R[]; +/** + * Combines two arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {(item1: T, item2: U, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: readonly T[], arr2: readonly U[], combine: (item1: T, item2: U, index: number) => R): R[]; +/** + * Combines three arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @param {(item1: T, item2: U, item3: V, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], combine: (item1: T, item2: U, item3: V, index: number) => R): R[]; +/** + * Combines four arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @param {W[]} arr4 - The fourth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[], combine: (item1: T, item2: U, item3: V, item4: W, index: number) => R): R[]; + +export { zipWith }; diff --git a/node_modules/es-toolkit/dist/array/zipWith.d.ts b/node_modules/es-toolkit/dist/array/zipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d28f3fc191cd39d0119b91fc8b968e9ec6988efc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.d.ts @@ -0,0 +1,72 @@ +/** + * Combines multiple arrays into a single array using a custom combiner function. + * + * This function takes multiple arrays and a combiner function, and returns a new array where each element + * is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @template T - The type of elements in the first array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {(item: T, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @example + * // Example usage with two arrays: + * const arr1 = [1, 2, 3]; + * const arr2 = [4, 5, 6]; + * const result = zipWith(arr1, arr2, (a, b) => a + b); + * // result will be [5, 7, 9] + * + * @example + * // Example usage with three arrays: + * const arr1 = [1, 2]; + * const arr2 = [3, 4]; + * const arr3 = [5, 6]; + * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`); + * // result will be [`135`, `246`] + */ +declare function zipWith(arr1: readonly T[], combine: (item: T, index: number) => R): R[]; +/** + * Combines two arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {(item1: T, item2: U, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: readonly T[], arr2: readonly U[], combine: (item1: T, item2: U, index: number) => R): R[]; +/** + * Combines three arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @param {(item1: T, item2: U, item3: V, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], combine: (item1: T, item2: U, item3: V, index: number) => R): R[]; +/** + * Combines four arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template R - The type of elements in the resulting array. + * @param {T[]} arr1 - The first array to zip. + * @param {U[]} arr2 - The second array to zip. + * @param {V[]} arr3 - The third array to zip. + * @param {W[]} arr4 - The fourth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W, index: number) => R} combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[], combine: (item1: T, item2: U, item3: V, item4: W, index: number) => R): R[]; + +export { zipWith }; diff --git a/node_modules/es-toolkit/dist/array/zipWith.js b/node_modules/es-toolkit/dist/array/zipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..9d869cf9b3801106e25eaf4603f30c21163a7e31 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function zipWith(arr1, ...rest) { + const arrs = [arr1, ...rest.slice(0, -1)]; + const combine = rest[rest.length - 1]; + const maxIndex = Math.max(...arrs.map(arr => arr.length)); + const result = Array(maxIndex); + for (let i = 0; i < maxIndex; i++) { + const elements = arrs.map(arr => arr[i]); + result[i] = combine(...elements, i); + } + return result; +} + +exports.zipWith = zipWith; diff --git a/node_modules/es-toolkit/dist/array/zipWith.mjs b/node_modules/es-toolkit/dist/array/zipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..65575cba651cf6ec24bd94bbbce31f8b9c1585ad --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.mjs @@ -0,0 +1,13 @@ +function zipWith(arr1, ...rest) { + const arrs = [arr1, ...rest.slice(0, -1)]; + const combine = rest[rest.length - 1]; + const maxIndex = Math.max(...arrs.map(arr => arr.length)); + const result = Array(maxIndex); + for (let i = 0; i < maxIndex; i++) { + const elements = arrs.map(arr => arr[i]); + result[i] = combine(...elements, i); + } + return result; +} + +export { zipWith }; diff --git a/node_modules/es-toolkit/dist/browser.global.js b/node_modules/es-toolkit/dist/browser.global.js new file mode 100644 index 0000000000000000000000000000000000000000..5065873d51cf59ce61469cb07655a7240e57124b --- /dev/null +++ b/node_modules/es-toolkit/dist/browser.global.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)._={})}(this,(function(e){"use strict";function castArray(e){return 0===arguments.length?[]:Array.isArray(e)?e:[e]}function toArray$1(e){return Array.isArray(e)?e:Array.from(e)}function isArrayLike(e){return null!=e&&"function"!=typeof e&&function isLength$1(e){return Number.isSafeInteger(e)&&e>=0}(e.length)}function chunk(e,t=1){return 0!==(t=Math.max(Math.floor(t),0))&&isArrayLike(e)?function chunk$1(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("Size must be an integer greater than zero.");const n=Math.ceil(e.length/t),r=Array(n);for(let i=0;i{for(let i=0;i{})):isMatchWithInternal(e,t,(function doesMatch(e,t,r,i,o,s){const u=n(e,t,r,i,o,s);return void 0!==u?Boolean(u):isMatchWithInternal(e,t,doesMatch,s)}),new Map)}function isMatchWithInternal(e,t,n,r){if(t===e)return!0;switch(typeof t){case"object":return function isObjectMatch(e,t,n,r){if(null==t)return!0;if(Array.isArray(t))return isArrayMatch(e,t,n,r);if(t instanceof Map)return function isMapMatch(e,t,n,r){if(0===t.size)return!0;if(!(e instanceof Map))return!1;for(const[i,o]of t.entries()){if(!1===n(e.get(i),o,i,e,t,r))return!1}return!0}(e,t,n,r);if(t instanceof Set)return function isSetMatch(e,t,n,r){if(0===t.size)return!0;if(!(e instanceof Set))return!1;return isArrayMatch([...e],[...t],n,r)}(e,t,n,r);const i=Object.keys(t);if(null==e||isPrimitive(e))return 0===i.length;if(0===i.length)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let o=0;o0?isMatchWithInternal(e,{...t},n,r):isEqualsSameValueZero(e,t);default:return isObject(e)?"string"!=typeof t||""===t:isEqualsSameValueZero(e,t)}}function isArrayMatch(e,t,n,r){if(0===t.length)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let o=0;o{}))}function getSymbols(e){return Object.getOwnPropertySymbols(e).filter((t=>Object.prototype.propertyIsEnumerable.call(e,t)))}function getTag(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",o="[object Arguments]",s="[object Symbol]",u="[object Date]",a="[object Map]",c="[object Set]",l="[object Array]",f="[object Function]",p="[object ArrayBuffer]",y="[object Object]",h="[object Error]",g="[object DataView]",d="[object Uint8Array]",m="[object Uint8ClampedArray]",b="[object Uint16Array]",A="[object Uint32Array]",O="[object BigUint64Array]",$="[object Int8Array]",j="[object Int16Array]",w="[object Int32Array]",k="[object BigInt64Array]",I="[object Float32Array]",v="[object Float64Array]";function isTypedArray$1(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function cloneDeepWithImpl(e,f,h,O=new Map,k=void 0){const S=k?.(e,f,h,O);if(void 0!==S)return S;if(isPrimitive(e))return e;if(O.has(e))return O.get(e);if(Array.isArray(e)){const t=new Array(e.length);O.set(e,t);for(let n=0;nisMatch(t,e)}function cloneDeepWith(e,t){return function cloneDeepWith$1(e,t){return cloneDeepWithImpl(e,void 0,e,new Map,t)}(e,((s,u,a,c)=>{const l=t?.(s,u,a,c);if(void 0!==l)return l;if("object"==typeof e){if(getTag(e)===y&&"function"!=typeof e.constructor){const t={};c.set(e,t);copyProperties(t,e,a,c);return t}switch(Object.prototype.toString.call(e)){case r:case n:case i:{const t=new e.constructor(e?.valueOf());copyProperties(t,e);return t}case o:{const t={};copyProperties(t,e);t.length=e.length;t[Symbol.iterator]=e[Symbol.iterator];return t}default:return}}}))}function cloneDeep(e){return cloneDeepWith(e)}const S=/^(?:0|[1-9]\d*)$/;function isIndex(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e!n.has(e)))}function isObjectLike(e){return"object"==typeof e&&null!==e}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function difference(e,...t){if(!isArrayLikeObject(e))return[];const n=toArray$1(e),r=[];for(let e=0;en(e))));return e.filter((e=>!r.has(n(e))))}(Array.from(e),r,iteratee(n))}function differenceWith(e,...t){if(!isArrayLikeObject(e))return[];const n=last(t),r=flattenArrayLike(t);return"function"==typeof n?function differenceWith$1(e,t,n){return e.filter((e=>t.every((t=>!n(e,t)))))}(Array.from(e),r,n):difference$1(Array.from(e),r)}function isSymbol$1(e){return"symbol"==typeof e||e instanceof Symbol}function toNumber(e){return isSymbol$1(e)?NaN:Number(e)}function toFinite(e){if(!e)return 0===e?e:0;if((e=toNumber(e))===1/0||e===-1/0){return(e<0?-1:1)*Number.MAX_VALUE}return e==e?e:0}function toInteger(e){const t=toFinite(e),n=t%1;return n?t-n:t}function drop(e,t=1,n){if(!isArrayLike(e))return[];t=n?1:toInteger(t);return function drop$1(e,t){t=Math.max(t,0);return e.slice(t)}(toArray$1(e),t)}function dropRight(e,t=1,n){if(!isArrayLike(e))return[];t=n?1:toInteger(t);return function dropRight$1(e,t){return 0===(t=Math.min(-t,0))?e.slice():e.slice(0,t)}(toArray$1(e),t)}function dropRightWhile$1(e,t){for(let n=e.length-1;n>=0;n--)if(!t(e[n],n,e))return e.slice(0,n+1);return[]}function dropRightWhile(e,t=identity$1){return isArrayLike(e)?function dropRightWhileImpl(e,t){switch(typeof t){case"function":return dropRightWhile$1(e,((e,n,r)=>Boolean(t(e,n,r))));case"object":if(Array.isArray(t)&&2===t.length){return dropRightWhile$1(e,matchesProperty(t[0],t[1]))}return dropRightWhile$1(e,matches(t));case"symbol":case"number":case"string":return dropRightWhile$1(e,property(t))}}(Array.from(e),t):[]}function dropWhile$1(e,t){const n=e.findIndex(((e,n,r)=>!t(e,n,r)));return-1===n?[]:e.slice(n)}function dropWhile(e,t=identity$1){return isArrayLike(e)?function dropWhileImpl(e,t){switch(typeof t){case"function":return dropWhile$1(e,((e,n,r)=>Boolean(t(e,n,r))));case"object":if(Array.isArray(t)&&2===t.length){return dropWhile$1(e,matchesProperty(t[0],t[1]))}return dropWhile$1(e,matches(t));case"number":case"symbol":case"string":return dropWhile$1(e,property(t))}}(toArray$1(e),t):[]}function range$1(e,t,n=1){if(null==t){t=e;e=0}if(!Number.isInteger(n)||0===n)throw new Error("The step value must be a non-zero integer.");const r=Math.max(Math.ceil((t-e)/n),0),i=new Array(r);for(let t=0;t=0;r--){const i=n[r];if(!1===t(e[i],i,e))break}return e}function isIterateeCall(e,t,n){return!!isObject(n)&&(!!("number"==typeof t&&isArrayLike(n)&&isIndex(t)&&t=0?n:i+n,0),s=Math.min(r>=0?r:i+r,i);for(let n=o;n=0;r--){const n=t[r],o=e[n];if(i(o,n,e))return o}}}function findLastIndex(e,t=identity$1,n=(e?e.length-1:0)){if(!e)return-1;n=n<0?Math.max(e.length+n,0):Math.min(n,e.length-1);const r=toArray$1(e).slice(0,n+1);switch(typeof t){case"function":return r.findLastIndex(t);case"object":if(Array.isArray(t)&&2===t.length){const e=t[0],n=t[1];return r.findLastIndex(matchesProperty(e,n))}return r.findLastIndex(matches(t));case"number":case"symbol":case"string":return r.findLastIndex(property(t))}}function head(e){if(isArrayLike(e))return function head$1(e){return e[0]}(toArray$1(e))}function flatten(e,t=1){const n=[],r=Math.floor(t);if(!isArrayLike(e))return n;const recursive=(e,t)=>{for(let i=0;ie.length||t instanceof RegExp)return!1;n<0&&(n=Math.max(0,e.length+n));return e.includes(t,n)}if(Array.isArray(e))return e.includes(t,n);const i=Object.keys(e);n<0&&(n=Math.max(0,i.length+n));for(let r=n;rn.has(e)))}function uniq$1(e){return[...new Set(e)]}function intersection(...e){if(0===e.length)return[];if(!isArrayLikeObject(e[0]))return[];let t=uniq$1(Array.from(e[0]));for(let n=1;nn(e))):"string"==typeof n&&(r=intersectionBy$1(r,Array.from(i),property(n)))}return r}function intersectionWith$1(e,t,n){return e.filter((e=>t.some((t=>n(e,t)))))}function uniq(e){return isArrayLike(e)?uniq$1(Array.from(e)):[]}function intersectionWith(e,...t){if(null==e)return[];const n=last(t);let r=isEqualsSameValueZero,i=uniq;if("function"==typeof n){r=n;i=uniqPreserve0;t.pop()}let o=i(Array.from(e));for(let e=0;eisEqualWithImpl(i,t,void 0,e,S,W,x)));if(-1===o)return!1;n.splice(o,1)}return!0}case l:case d:case m:case b:case A:case O:case $:case j:case w:case k:case I:case v:if("undefined"!=typeof Buffer&&Buffer.isBuffer(e)!==Buffer.isBuffer(S))return!1;if(e.length!==S.length)return!1;for(let t=0;t0&&(u=get(o,e))}else if("string"==typeof t&&t.includes(".")){u=get(o,t.split(".").slice(0,-1).join("."))}i.push(null==s?void 0:s.apply(u,n))}return i}function join(e,t){return isArrayLike(e)?Array.from(e).join(t):""}function reduce(e,t=identity$1,n){if(!e)return n;let r,i=0;if(isArrayLike(e)){r=range$1(0,e.length);if(null==n&&e.length>0){n=e[0];i+=1}}else{r=Object.keys(e);if(null==n){n=e[r[0]];i+=1}}for(let o=i;o{e[n(t)]=t;return e}),{})}function lastIndexOf(e,t,n){if(!isArrayLike(e)||0===e.length)return-1;const r=e.length;let i=n??r-1;null!=n&&(i=i<0?Math.max(r+i,0):Math.min(i,r-1));if(Number.isNaN(t))for(let t=i;t>=0;t--)if(Number.isNaN(e[t]))return t;return Array.from(e).lastIndexOf(t,i)}function nth(e,t=0){if(isArrayLikeObject(e)&&0!==e.length){(t=toInteger(t))<0&&(t+=e.length);return e[t]}}function getPriority(e){return"symbol"==typeof e?1:null===e?2:void 0===e?3:e!=e?4:0}const compareValues=(e,t,n)=>{if(e!==t){const r=getPriority(e),i=getPriority(t);if(r===i&&0===r){if(et)return"desc"===n?-1:1}return"desc"===n?i-r:r-i}return 0},W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,x=/^\w*$/;function isKey(e,t){return!Array.isArray(e)&&(!("number"!=typeof e&&"boolean"!=typeof e&&null!=e&&!isSymbol$1(e))||("string"==typeof e&&(x.test(e)||!W.test(e))||null!=t&&Object.hasOwn(t,e)))}function orderBy(e,t,n,r){if(null==e)return[];n=r?void 0:n;Array.isArray(e)||(e=Object.values(e));Array.isArray(t)||(t=null==t?[null]:[t]);0===t.length&&(t=[null]);Array.isArray(n)||(n=null==n?[]:[n]);n=n.map((e=>String(e)));const getValueByNestedPath=(e,t)=>{let n=e;for(let e=0;e{Array.isArray(e)&&1===e.length&&(e=e[0]);return null==e||"function"==typeof e||Array.isArray(e)||isKey(e)?e:{key:e,path:toPath(e)}}));return e.map((e=>({original:e,criteria:i.map((t=>((e,t)=>null==t||null==e?t:"object"==typeof e&&"key"in e?Object.hasOwn(t,e.key)?t[e.key]:getValueByNestedPath(t,e.path):"function"==typeof e?e(t):Array.isArray(e)?getValueByNestedPath(t,e):"object"==typeof t?t[e]:t)(t,e)))}))).slice().sort(((e,t)=>{for(let r=0;re.original))}function partition(e,t=identity$1){if(!e)return[[],[]];const n=isArrayLike(e)?e:Object.values(e);t=iteratee(t);const r=[],i=[];for(let e=0;er(e))));let o=0;for(let t=0;tisEqualsSameValueZero(e,t));const i=Array.isArray(t)?t:Array.from(t),o=i.includes(void 0);for(let t=0;tn(e[t],r)))||(e[r++]=e[t])}else o||delete e[r++];e.length=r;return e}function at(e,...t){if(0===t.length)return[];const n=[];for(let e=0;eisIndex(t,e.length)?Number(t):t)).sort(((e,t)=>t-e));for(const t of new Set(i)){if(isIndex(t,e.length)){Array.prototype.splice.call(e,t,1);continue}if(isKey(t,e)){delete e[toKey(t)];continue}const n=isArray(t)?t:toPath(t);unset(e,n)}return r}function reduceRight(e,t=identity$1,n){if(!e)return n;let r,i;if(isArrayLike(e)){r=range$1(0,e.length).reverse();if(null==n&&e.length>0){n=e[e.length-1];i=1}else i=0}else{r=Object.keys(e).reverse();if(null==n){n=e[r[0]];i=1}else i=0}for(let o=i;o=t)throw new Error("Invalid input: The maximum value must be greater than the minimum value.");return Math.random()*(t-e)+e}function randomInt(e,t){return Math.floor(random$1(e,t))}function clamp(e,t,n){if(void 0===n){n=t;t=void 0}if(void 0!==n){n=toNumber(n);e=Math.min(e,Number.isNaN(n)?0:n)}if(void 0!==t){t=toNumber(t);e=Math.max(e,Number.isNaN(t)?0:t)}return e}function isMap(e){return function isMap$1(e){return e instanceof Map}(e)}function toArray(e){return null==e?[]:isArrayLike(e)||isMap(e)?Array.from(e):"object"==typeof e?Object.values(e):[]}function sampleSize(e,t,n){const r=toArray(e);return function sampleSize$1(e,t){if(t>e.length)throw new Error("Size must be less than or equal to the length of array.");const n=new Array(t),r=new Set;for(let i=e.length-t,o=0;i=1;e--){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function values(e){return null==e?[]:Object.values(e)}function isNil(e){return null==e}function shuffle(e){return isNil(e)?[]:isArray(e)?shuffle$1(e):isArrayLike(e)?shuffle$1(Array.from(e)):isObjectLike(e)?shuffle$1(values(e)):[]}function size(e){return isNil$1(e)?0:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length}function slice(e,t,n){if(!isArrayLike(e))return[];const r=e.length;if(void 0===n)n=r;else if("number"!=typeof n&&isIterateeCall(e,t,n)){t=0;n=r}t=toInteger(t);n=toInteger(n);t=t<0?Math.max(r+t,0):Math.min(t,r);n=n<0?Math.max(r+n,0):Math.min(n,r);const i=Math.max(n-t,0),o=new Array(i);for(let n=0;n1&&isIterateeCall(e,t[0],t[1])?t=[]:n>2&&isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]);return orderBy(e,flatten$1(t),["asc"])}function identity(e){return e}function isNaN(e){return Number.isNaN(e)}const E=4294967294;function sortedIndexBy(e,t,n=identity,r){if(isNil(e)||0===e.length)return 0;let i=0,o=e.length;const s=iteratee(n),u=s(t),a=isNaN(u),c=isNull$1(u),l=isSymbol$1(u),f=isUndefined$1(u);for(;i>>1,o=e[i];!isNull$1(o)&&!isSymbol(o)&&oe))}function sortedIndexOf(e,t){if(!e?.length)return-1;const n=sortedIndex(e,t);return nL)return sortedLastIndexBy(e,t,(e=>e));let r=0;for(;r>>1,o=e[i];!isNull$1(o)&&!isSymbol(o)&&o<=t?r=i+1:n=i}return n}function sortedLastIndexOf(e,t){if(!e?.length)return-1;const n=sortedLastIndex(e,t)-1;return n>=0&&isEqualsSameValueZero(e[n],t)?n:-1}function tail(e){return isArrayLike(e)?function tail$1(e){return e.slice(1)}(toArray$1(e)):[]}function take(e,t=1,n){return(t=n?1:toInteger(t))<1||!isArrayLike(e)?[]:function take$1(e,t,n){t=void 0===t?1:toInteger(t);return e.slice(0,t)}(toArray$1(e),t)}function takeRight(e,t=1,n){return(t=n?1:toInteger(t))<=0||!isArrayLike(e)?[]:function takeRight$1(e,t,n){return(t=void 0===t?1:toInteger(t))<=0||0===e.length?[]:e.slice(-t)}(toArray$1(e),t)}function takeRightWhile(e,t){if(!isArrayLikeObject(e))return[];const n=toArray$1(e),r=n.findLastIndex(function negate(e){return(...t)=>!e(...t)}(iteratee(t??identity$1)));return n.slice(r+1)}function takeWhile(e,t){if(!isArrayLikeObject(e))return[];const n=toArray$1(e),r=n.findIndex(negate$1(iteratee(t??identity)));return-1===r?n:n.slice(0,r)}function union(...e){return uniq$1(flatMapDepth(e.filter(isArrayLikeObject),(e=>Array.from(e)),1))}function uniqBy$1(e,t){const n=new Map;for(let r=0;r!t(e,i)))&&n.push(i)}return n}function unionWith(...e){const t=last$1(e),n=flattenArrayLike(e);return isArrayLikeObject(t)||null==t?uniq$1(n):uniqWith$1(n,t)}function uniqBy(e,t=identity$1){return isArrayLikeObject(e)?uniqBy$1(Array.from(e),ary$1(iteratee(t),1)):[]}function uniqWith(e,t){return isArrayLike(e)?"function"==typeof t?uniqWith$1(Array.from(e),t):uniq(Array.from(e)):[]}function unzip$1(e){let t=0;for(let n=0;nt&&(t=e[n].length);const n=new Array(t);for(let r=0;risArrayLikeObject(e)))):[]}function unzipWith(e,t){if(!isArrayLikeObject(e)||!e.length)return[];const n=isArray(e)?unzip$1(e):unzip$1(Array.from(e,(e=>Array.from(e))));if(!t)return n;const r=new Array(n.length);for(let e=0;eintersectionBy(e,t,n))),n),n)}function xorWith(...e){const t=last(e);let comparator=(e,t)=>e===t;if("function"==typeof t){comparator=t;e=e.slice(0,-1)}const n=e.filter(isArrayLikeObject);return differenceWith(unionWith(...n,comparator),unionWith(...windowed(n,2).map((([e,t])=>intersectionWith(e,t,comparator))),comparator),comparator)}function zip$1(...e){let t=0;for(let n=0;nt&&(t=e[n].length);const n=e.length,r=Array(t);for(let i=0;iisArrayLikeObject(e)))):[]}const assignValue=(e,t,n)=>{const r=e[t];Object.hasOwn(e,t)&&isEqualsSameValueZero(r,n)&&(void 0!==n||t in e)||(e[t]=n)};function zipObject(e=[],t=[]){const n={};for(let r=0;rn),(()=>{}))}function zipObjectDeep(e,t){const n={};if(!isArrayLike(e))return n;isArrayLike(t)||(t=[]);const r=zip$1(Array.from(e),Array.from(t));for(let e=0;et(...e)))}function after$1(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");e=toInteger(e);return function(...n){if(--e<1)return t.apply(this,n)}}function ary(e,t=e.length,n){n&&(t=e.length);(Number.isNaN(t)||t<0)&&(t=0);return ary$1(e,t)}function attempt(e,...t){try{return e(...t)}catch(e){return e instanceof Error?e:new Error(e)}}function before(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");let n;e=toInteger(e);return function(...r){--e>0&&(n=t.apply(this,r));e<=1&&t&&(t=void 0);return n}}function bind(e,t,...n){const bound=function(...r){const i=[];let o=0;for(let e=0;ee===curry.placeholder)),i=n.length-r.length;return ie===curry.placeholder)),o=r.length-i.length;r=function composeArgs$1(e,t){const n=[];let r=0;for(let i=0;ie===curryRight.placeholder)),i=n.length-r.length;return ie===curryRight.placeholder)),o=r.length-i.length;r=function composeArgs(e,t){const n=t.filter((e=>e===curryRight.placeholder)).length,r=Math.max(e.length-n,0),i=[];let o=0;for(let t=0;t{if(null!==o){e.apply(i,o);i=void 0;o=null}};let a=null;const schedule=()=>{null!=a&&clearTimeout(a);a=setTimeout((()=>{a=null;(()=>{u&&invoke();cancel()})()}),t)},cancel=()=>{(()=>{if(null!==a){clearTimeout(a);a=null}})();i=void 0;o=null},debounced=function(...e){if(n?.aborted)return;i=this;o=e;const t=null==a;schedule();s&&t&&invoke()};debounced.schedule=schedule;debounced.cancel=cancel;debounced.flush=()=>{invoke()};n?.addEventListener("abort",cancel,{once:!0});return debounced}function debounce(e,t=0,n={}){"object"!=typeof n&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:o}=n,s=Array(2);r&&(s[0]="leading");i&&(s[1]="trailing");let u,a=null;const c=debounce$1((function(...t){u=e.apply(this,t);a=null}),t,{edges:s}),debounced=function(...t){if(null!=o){null===a&&(a=Date.now());if(Date.now()-a>=o){u=e.apply(this,t);a=Date.now();c.cancel();c.schedule();return u}}c.apply(this,t);return u};debounced.cancel=c.cancel;debounced.flush=()=>{c.flush();return u};return debounced}function defer(e,...t){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout(e,1,...t)}function delay(e,t,...n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout(e,toNumber(t)||0,...n)}function flip(e){return function(...t){return e.apply(this,t.reverse())}}function flow$1(...e){return function(...t){let n=e.length?e[0].apply(this,t):t[0];for(let t=1;t"function"!=typeof e)))throw new TypeError("Expected a function");return flow$1(...t)}function flowRight(...e){const t=flatten$1(e,1);if(t.some((e=>"function"!=typeof e)))throw new TypeError("Expected a function");return function flowRight$1(...e){return flow$1(...e.reverse())}(...t)}function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");const memoized=function(...n){const r=t?t.apply(this,n):n[0],i=memoized.cache;if(i.has(r))return i.get(r);const o=e.apply(this,n);memoized.cache=i.set(r,o)||i;return o},n=memoize.Cache||Map;memoized.cache=new n;return memoized}memoize.Cache=Map;function nthArg(e=0){return function(...t){return t.at(toInteger(e))}}function once(e){return function once$1(e){let t,n=!1;return function(...r){if(!n){n=!0;t=e(...r)}return t}}(e)}function overArgs(e,...t){if("function"!=typeof e)throw new TypeError("Expected a function");const n=t.flat();return function(...t){const r=Math.min(t.length,n.length),i=[...t];for(let e=0;ee===t?r[i++]:e)),s=r.slice(i);return e.apply(this,o.concat(s))};e.prototype&&(partialed.prototype=Object.create(e.prototype));return partialed}(e,partial.placeholder,...t)}partial.placeholder=Symbol("compat.partial.placeholder");function partialRight(e,...t){return function partialRightImpl(e,t,...n){const partialedRight=function(...r){const i=n.filter((e=>e===t)).length,o=Math.max(r.length-i,0),s=r.slice(0,o);let u=o;const a=n.slice().map((e=>e===t?r[u++]:e));return e.apply(this,s.concat(a))};e.prototype&&(partialedRight.prototype=Object.create(e.prototype));return partialedRight}(e,partialRight.placeholder,...t)}partialRight.placeholder=Symbol("compat.partialRight.placeholder");function rearg(e,...t){const n=flatten(t);return function(...t){const r=n.map((e=>t[e])).slice(0,t.length);for(let e=r.length;en&&([t,n]=[n,t]);return t!==n&&function inRange$1(e,t,n){if(null==n){n=t;t=0}if(t>=n)throw new Error("The maximum value must be greater than the minimum value.");return t<=e&&et)&&(t=r)}return t}function maxBy(e,t){if(null!=e)return function maxBy$1(e,t){if(0===e.length)return;let n=e[0],r=t(n,0,e);for(let i=1;ir){r=s;n=o}}return n}(Array.from(e),iteratee(t??identity$1))}function sumBy$1(e,t){if(!e||!e.length)return 0;null!=t&&(t=iteratee(t));let n;for(let r=0;rt(e)))/e.length}(Array.from(e),iteratee(t??identity$1))}function min(e){if(!e||0===e.length)return;let t;for(let n=0;nn&&([t,n]=[n,t]);t=clamp(t,-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);n=clamp(n,-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return t===n?t:r?random$1(t,n+1):randomInt(t,n+1)}function range(e,t,n){n&&"number"!=typeof n&&isIterateeCall(e,t,n)&&(t=n=void 0);e=toFinite(e);if(void 0===t){t=e;e=0}else t=toFinite(t);n=void 0===n?e=0;t--){i[t]=e;e+=n}return i}function round(e,t=0){return decimalAdjust("round",e,t)}function subtract(e,t){if(void 0===e&&void 0===t)return 0;if(void 0===e||void 0===t)return e??t;if("string"==typeof e||"string"==typeof t){e=toString(e);t=toString(t)}else{e=toNumber(e);t=toNumber(t)}return e-t}function noop(...e){}function isPrototype(e){const t=e?.constructor;return e===("function"==typeof t?t.prototype:Object.prototype)}function isTypedArray(e){return isTypedArray$1(e)}function times(e,t){if((e=toInteger(e))<1||!Number.isSafeInteger(e))return[];const n=new Array(e);for(let r=0;r`${e}`)),n=new Set(t);if(isBuffer$1(e)){n.add("offset");n.add("parent")}if(isTypedArray(e)){n.add("buffer");n.add("byteLength");n.add("byteOffset")}const r=Object.keys(e).filter((e=>!n.has(e)));if(Array.isArray(e))return[...t,...r];return[...t.filter((t=>Object.hasOwn(e,t))),...r]}(e);const t=Object.keys(Object(e));return isPrototype(e)?t.filter((e=>"constructor"!==e)):t}function assign(e,...t){for(let n=0;n`${e}`)),n=new Set(t);if(isBuffer$1(e)){n.add("offset");n.add("parent")}if(isTypedArray(e)){n.add("buffer");n.add("byteLength");n.add("byteOffset")}const r=keysInImpl(e).filter((e=>!n.has(e)));if(Array.isArray(e))return[...t,...r];return[...t.filter((t=>Object.hasOwn(e,t))),...r]}(e):isPrototype(e)?function prototypeKeysIn(e){const t=keysInImpl(e);return t.filter((e=>"constructor"!==e))}(e):keysInImpl(e);default:return keysInImpl(Object(e))}}function keysInImpl(e){const t=[];for(const n in e)t.push(n);return t}function assignIn(e,...t){for(let n=0;n0&&"string"==typeof e[0]&&Object.hasOwn(e,"index")){t.index=e.index;t.input=e.input}return t}if(isTypedArray(e)){const t=e;return new(0,t.constructor)(t.buffer,t.byteOffset,t.length)}if(f===p)return new ArrayBuffer(e.byteLength);if(f===g){const t=e,n=t.buffer,r=t.byteOffset,i=t.byteLength,o=new ArrayBuffer(i),s=new Uint8Array(n,r,i);new Uint8Array(o).set(s);return new DataView(o)}if(f===i||f===r||f===n){const t=new(0,e.constructor)(e.valueOf());f===n?function cloneStringObjectProperties(e,t){const n=t.valueOf().length;for(const r in t)Object.hasOwn(t,r)&&(Number.isNaN(Number(r))||Number(r)>=n)&&(e[r]=t[r])}(t,e):copyOwnProperties(t,e);return t}if(f===u)return new Date(Number(e));if(f===t){const t=e,n=new RegExp(t.source,t.flags);n.lastIndex=t.lastIndex;return n}if(f===s)return Object(Symbol.prototype.valueOf.call(e));if(f===a){const t=e,n=new Map;t.forEach(((e,t)=>{n.set(t,e)}));return n}if(f===c){const t=e,n=new Set;t.forEach((e=>{n.add(e)}));return n}if(f===o){const t=e,n={};copyOwnProperties(n,t);n.length=t.length;n[Symbol.iterator]=t[Symbol.iterator];return n}const h={};!function copyPrototype(e,t){const n=Object.getPrototypeOf(t);if(null!==n){"function"==typeof t.constructor&&Object.setPrototypeOf(e,n)}}(h,e);copyOwnProperties(h,e);!function copySymbolProperties(e,t){const n=Object.getOwnPropertySymbols(t);for(let r=0;r2?t[2]:void 0;i&&isIterateeCall(t[0],t[1],i)&&(r=1);for(let i=0;it(e[n],n,e)))}(e,iteratee(t??identity))}function findLastKey(e,t){if(!isObject(e))return;const n=iteratee(t??identity);return Object.keys(e).findLast((t=>n(e[t],t,e)))}function forIn(e,t=identity$1){if(null==e)return e;for(const n in e){if(!1===t(e[n],n,e))break}return e}function forInRight(e,t=identity$1){if(null==e)return e;const n=[];for(const t in e)n.push(t);for(let r=n.length-1;r>=0;r--){const i=n[r];if(!1===t(e[i],i,e))break}return e}function forOwn(e,t=identity$1){if(null==e)return e;const n=Object(e),r=keys(e);for(let e=0;e=0;--e){const i=r[e];if(!1===t(n[i],i,n))break}return e}function fromPairs(e){if(!isArrayLike(e))return{};const t={};for(let n=0;n"function"==typeof e[t]))}function functionsIn(e){if(null==e)return[];const t=[];for(const n in e)isFunction$1(e[n])&&t.push(n);return t}function hasIn(e,t){if(null==e)return!1;let n;n=Array.isArray(t)?t:"string"==typeof t&&isDeepKey(t)&&null==e[t]?toPath(t):[t];if(0===n.length)return!1;let r=e;for(let e=0;eArray.isArray(e)||isDeepKey(e)));if(n)return function deepCloneInOmit(e){const t={},n=[...keysIn(e),...getSymbolsIn(e)];for(let r=0;r{if(!isPlainObject(e))return e}))}return t}(e);return function shallowCloneInOmit(e){const t={},n=[...keysIn(e),...getSymbolsIn(e)];for(let r=0;r{};return updateWith(e,t,(()=>n),i)}function toDefaulted(e,...t){return defaults(cloneDeep(e),...t)}function mapToEntries(e){const t=new Array(e.size),n=e.keys(),r=e.values();for(let e=0;et(n,e,r,i)));return n}function update(e,t,n){return updateWith(e,t,n,(()=>{}))}function valuesIn(e){const t=keysIn(e),n=new Array(t.length);for(let r=0;r=0}const D=Function.prototype.toString,z=RegExp(`^${D.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")}$`);function isNative(e){if("function"!=typeof e)return!1;if(null!=globalThis?.["__core-js_shared__"])throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return z.test(D.call(e))}function isNull(e){return null===e}function isUndefined(e){return isUndefined$1(e)}function conformsTo(e,t){if(null==t)return!0;if(null==e)return 0===Object.keys(t).length;const n=Object.keys(t);for(let r=0;r"constructor"!==e)).length:0===t.length}return!0}function after(e,t){if(!Number.isInteger(e)||e<0)throw new Error("n must be a non-negative integer.");let n=0;return(...r)=>{if(++n>=e)return t(...r)}}function isEqualWith(e,t,n){"function"!=typeof n&&(n=()=>{});return isEqualWith$1(e,t,((...r)=>{const i=n(...r);return void 0!==i?Boolean(i):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?isEqualWith(Array.from(e),Array.from(t),after(2,n)):void 0}))}function isError(e){return"[object Error]"===getTag(e)}function isFinite(e){return Number.isFinite(e)}function isInteger(e){return Number.isInteger(e)}function isRegExp(e){return function isRegExp$1(e){return e instanceof RegExp}(e)}function isSafeInteger(e){return Number.isSafeInteger(e)}function isSet(e){return function isSet$1(e){return e instanceof Set}(e)}function isWeakMap(e){return function isWeakMap$1(e){return e instanceof WeakMap}(e)}function isWeakSet(e){return function isWeakSet$1(e){return e instanceof WeakSet}(e)}function capitalize$1(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function capitalize(e){return capitalize$1(toString(e))}function bindAll(e,...t){if(null==e)return e;if(!isObject(e))return e;if(isArray(e)&&0===t.length)return e;const n=[];for(let e=0;e="̀"&&r<="ͯ"||r>="︠"&&r<="︣"||(t+=q.get(r)??r)}return t}(toString(e))}const T=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function words$1(e){return Array.from(e.match(T)??[])}function normalizeForCase(e){"string"!=typeof e&&(e=toString(e));return e.replace(/['\u2019]/g,"")}function camelCase(e){return function camelCase$1(e){const t=words$1(e);if(0===t.length)return"";const[n,...r]=t;return`${n.toLowerCase()}${r.map((e=>capitalize$1(e))).join("")}`}(normalizeForCase(deburr(e)))}function endsWith(e,t,n){if(null==e||null==t)return!1;null==n&&(n=e.length);return e.endsWith(t,n)}const C={"&":"&","<":"<",">":">",'"':""","'":"'"};function escape(e){return function escape$1(e){return e.replace(/[&<>"']/g,(e=>C[e]))}(toString(e))}function escapeRegExp(e){return function escapeRegExp$1(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}(toString(e))}function kebabCase(e){return function kebabCase$1(e){return words$1(e).map((e=>e.toLowerCase())).join("-")}(normalizeForCase(deburr(e)))}function lowerCase(e){return function lowerCase$1(e){return words$1(e).map((e=>e.toLowerCase())).join(" ")}(normalizeForCase(deburr(e)))}function lowerFirst(e){return function lowerFirst$1(e){return e.substring(0,1).toLowerCase()+e.substring(1)}(toString(e))}function pad(e,t,n){return function pad$1(e,t,n=" "){return e.padStart(Math.floor((t-e.length)/2)+e.length,n).padEnd(t,n)}(toString(e),t,n)}function padEnd(e,t=0,n=" "){return toString(e).padEnd(t,n)}function padStart(e,t=0,n=" "){return toString(e).padStart(t,n)}const F=Number.MAX_SAFE_INTEGER;function repeat(e,t,n){return(t=(n?isIterateeCall(e,t,n):void 0===t)?1:toInteger(t))<1||t>F?"":toString(e).repeat(t)}function replace(e,t,n){return arguments.length<3?toString(e):toString(e).replace(t,n)}function snakeCase(e){return function snakeCase$1(e){return words$1(e).map((e=>e.toLowerCase())).join("_")}(normalizeForCase(deburr(e)))}function split(e,t,n){return toString(e).split(t,n)}function startCase(e){const t=words$1(normalizeForCase(deburr(e)).trim());let n="";for(let e=0;e/g,X={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:Z,variable:"",imports:{_:{escape,template}}};function template(e,t,n){e=toString(e);n&&(t=X);t=defaults({...t},X);const r=new RegExp([t.escape?.source??U.source,t.interpolate?.source??U.source,t.interpolate===Z?_.source:U.source,t.evaluate?.source??U.source,"$"].join("|"),"g");let i=0,o=!1,s="__p += ''";for(const t of e.matchAll(r)){const[n,r,u,a,c]=t,{index:l}=t;s+=` + '${e.slice(i,l).replace(K,escapeString)}'`;r&&(s+=` + _.escape(${r})`);u?s+=` + ((${u}) == null ? '' : ${u})`:a&&(s+=` + ((${a}) == null ? '' : ${a})`);if(c){s+=`;\n${c};\n __p += ''`;o=!0}i=l+n.length}const u=defaults({...t.imports},X.imports),a=Object.keys(u),c=Object.values(u),l=`//# sourceURL=${t.sourceURL?String(t.sourceURL).replace(/[\r\n]/g," "):`es-toolkit.templateSource[${Date.now()}]`}\n`,f=`function(${t.variable||"obj"}) {\n let __p = '';\n ${t.variable?"":"if (obj == null) { obj = {}; }"}\n ${o?"function print() { __p += Array.prototype.join.call(arguments, ''); }":""}\n ${t.variable?s:`with(obj) {\n${s}\n}`}\n return __p;\n }`,p=attempt((()=>new Function(...a,`${l}return ${f}`)(...c)));p.source=f;if(p instanceof Error)throw p;return p}function toLower(e){return toString(e).toLowerCase()}function toUpper(e){return toString(e).toUpperCase()}function trimEnd$1(e,t){if(void 0===t)return e.trimEnd();let n=e.length;switch(typeof t){case"string":if(1!==t.length)throw new Error("The 'chars' parameter should be a single character string.");for(;n>0&&e[n-1]===t;)n--;break;case"object":for(;n>0&&t.includes(e[n-1]);)n--}return e.substring(0,n)}function trimStart$1(e,t){if(void 0===t)return e.trimStart();let n=0;switch(typeof t){case"string":for(;ne.toString().split("")))):trim$1(e,t.toString().split(""))}function trimEnd(e,t,n){return null==e?"":null!=n||null==t?e.toString().trimEnd():trimEnd$1(e,t.toString().split(""))}function trimStart(e,t,n){return null==e?"":null!=n||null==t?e.toString().trimStart():trimStart$1(e,t.toString().split(""))}const G=/[\u200d\ud800-\udfff\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff\ufe0e\ufe0f]/;function truncate(e,t){e=null!=e?`${e}`:"";let n=30,r="...";if(isObject(t)){n=function parseLength(e){if(null==e)return 30;if(e<=0)return 0;return e}(t.length);r="omission"in t?`${t.omission}`:"..."}let i=e.length;const o=Array.from(r).length,s=Math.max(n-o,0);let u;if(G.test(e)){u=Array.from(e);i=u.length}if(n>=i)return e;if(i<=o)return r;let a=void 0===u?e.slice(0,s):u?.slice(0,s).join("");const c=t?.separator;if(!c){a+=r;return a}const l=c instanceof RegExp?c.source:c,f="u"+(c instanceof RegExp?c.flags.replace("u",""):""),p=new RegExp(`(?.*(?:(?!${l}).))(?:${l})`,f).exec(a);return(p?.groups?p.groups.result:a)+r}const H={"&":"&","<":"<",">":">",""":'"',"'":"'"};function unescape(e){return function unescape$1(e){return e.replace(/&(?:amp|lt|gt|quot|#(0+)?39);/g,(e=>H[e]||"'"))}(toString(e))}function upperCase(e){return function upperCase$1(e){const t=words$1(e);let n="";for(let e=0;e""!==e))}function cond(e){const t=e.length,n=e.map((e=>{const t=e[0],n=e[1];if(!isFunction$1(n))throw new TypeError("Expected a function");return[iteratee(t),n]}));return function(...e){for(let r=0;re}function defaultTo(e,t){return null==e||Number.isNaN(e)?t:e}function gt(e,t){return"string"==typeof e&&"string"==typeof t?e>t:toNumber(e)>toNumber(t)}function gte(e,t){return"string"==typeof e&&"string"==typeof t?e>=t:toNumber(e)>=toNumber(t)}function invoke(e,t,...n){n=n.flat(1);if(null!=e)switch(typeof t){case"string":return"object"==typeof e&&Object.hasOwn(e,t)?invokeImpl(e,[t],n):invokeImpl(e,toPath(t),n);case"number":case"symbol":return invokeImpl(e,[t],n);default:return Array.isArray(t)?invokeImpl(e,t,n):invokeImpl(e,[t],n)}}function invokeImpl(e,t,n){const r=get(e,t.slice(0,-1),e);if(null==r)return;let i=last(t);const o=i?.valueOf();i="number"==typeof o?toKey(o):String(i);const s=get(r,i);return s?.apply(r,n)}function lt(e,t){return"string"==typeof e&&"string"==typeof t?eiteratee(e)));return function(...e){return t.map((t=>t.apply(this,e)))}}function overEvery(...e){return function(...t){for(let n=0;ne;Object.assign(toolkit,ue);toolkit.partial.placeholder=toolkit;toolkit.partialRight.placeholder=toolkit;e.add=add;e.after=after$1;e.ary=ary;e.assign=assign;e.assignIn=assignIn;e.assignInWith=assignInWith;e.assignWith=assignWith;e.at=at;e.attempt=attempt;e.before=before;e.bind=bind;e.bindAll=bindAll;e.bindKey=bindKey;e.camelCase=camelCase;e.capitalize=capitalize;e.castArray=castArray;e.ceil=ceil;e.chunk=chunk;e.clamp=clamp;e.clone=clone$1;e.cloneDeep=cloneDeep;e.cloneDeepWith=cloneDeepWith;e.cloneWith=cloneWith;e.compact=compact;e.concat=concat;e.cond=cond;e.conforms=conforms;e.conformsTo=conformsTo;e.constant=constant;e.countBy=countBy;e.create=create;e.curry=curry;e.curryRight=curryRight;e.debounce=debounce;e.deburr=deburr;e.default=toolkit;e.defaultTo=defaultTo;e.defaults=defaults;e.defaultsDeep=defaultsDeep;e.defer=defer;e.delay=delay;e.difference=difference;e.differenceBy=differenceBy;e.differenceWith=differenceWith;e.divide=divide;e.drop=drop;e.dropRight=dropRight;e.dropRightWhile=dropRightWhile;e.dropWhile=dropWhile;e.each=forEach;e.eachRight=forEachRight;e.endsWith=endsWith;e.eq=isEqualsSameValueZero;e.escape=escape;e.escapeRegExp=escapeRegExp;e.every=every;e.extend=assignIn;e.extendWith=assignInWith;e.fill=fill;e.filter=filter;e.find=find;e.findIndex=findIndex;e.findKey=findKey;e.findLast=findLast;e.findLastIndex=findLastIndex;e.findLastKey=findLastKey;e.first=head;e.flatMap=flatMap;e.flatMapDeep=flatMapDeep;e.flatMapDepth=flatMapDepth;e.flatten=flatten;e.flattenDeep=flattenDeep;e.flattenDepth=flattenDepth;e.flip=flip;e.floor=floor;e.flow=flow;e.flowRight=flowRight;e.forEach=forEach;e.forEachRight=forEachRight;e.forIn=forIn;e.forInRight=forInRight;e.forOwn=forOwn;e.forOwnRight=forOwnRight;e.fromPairs=fromPairs;e.functions=functions;e.functionsIn=functionsIn;e.get=get;e.groupBy=groupBy;e.gt=gt;e.gte=gte;e.has=has;e.hasIn=hasIn;e.head=head;e.identity=identity;e.inRange=inRange;e.includes=includes;e.indexOf=indexOf;e.initial=initial;e.intersection=intersection;e.intersectionBy=intersectionBy;e.intersectionWith=intersectionWith;e.invert=invert;e.invertBy=invertBy;e.invoke=invoke;e.invokeMap=invokeMap;e.isArguments=isArguments;e.isArray=isArray;e.isArrayBuffer=isArrayBuffer;e.isArrayLike=isArrayLike;e.isArrayLikeObject=isArrayLikeObject;e.isBoolean=isBoolean;e.isBuffer=isBuffer;e.isDate=isDate;e.isElement=isElement;e.isEmpty=isEmpty;e.isEqual=isEqual;e.isEqualWith=isEqualWith;e.isError=isError;e.isFinite=isFinite;e.isFunction=isFunction;e.isInteger=isInteger;e.isLength=isLength;e.isMap=isMap;e.isMatch=isMatch;e.isMatchWith=isMatchWith;e.isNaN=isNaN;e.isNative=isNative;e.isNil=isNil;e.isNull=isNull;e.isNumber=isNumber;e.isObject=isObject;e.isObjectLike=isObjectLike;e.isPlainObject=isPlainObject;e.isRegExp=isRegExp;e.isSafeInteger=isSafeInteger;e.isSet=isSet;e.isString=isString;e.isSymbol=isSymbol$1;e.isTypedArray=isTypedArray;e.isUndefined=isUndefined;e.isWeakMap=isWeakMap;e.isWeakSet=isWeakSet;e.iteratee=iteratee;e.join=join;e.kebabCase=kebabCase;e.keyBy=keyBy;e.keys=keys;e.keysIn=keysIn;e.last=last;e.lastIndexOf=lastIndexOf;e.lowerCase=lowerCase;e.lowerFirst=lowerFirst;e.lt=lt;e.lte=lte;e.map=map;e.mapKeys=mapKeys;e.mapValues=mapValues;e.matches=matches;e.matchesProperty=matchesProperty;e.max=max;e.maxBy=maxBy;e.mean=mean;e.meanBy=meanBy;e.memoize=memoize;e.merge=merge;e.mergeWith=mergeWith;e.method=method;e.methodOf=methodOf;e.min=min;e.minBy=minBy;e.multiply=multiply;e.negate=negate$1;e.noop=noop;e.now=now;e.nth=nth;e.nthArg=nthArg;e.omit=omit;e.omitBy=omitBy;e.once=once;e.orderBy=orderBy;e.over=over;e.overArgs=overArgs;e.overEvery=overEvery;e.overSome=overSome;e.pad=pad;e.padEnd=padEnd;e.padStart=padStart;e.parseInt=parseInt;e.partial=partial;e.partialRight=partialRight;e.partition=partition;e.pick=pick;e.pickBy=pickBy;e.property=property;e.propertyOf=propertyOf;e.pull=pull;e.pullAll=pullAll;e.pullAllBy=pullAllBy;e.pullAllWith=pullAllWith;e.pullAt=pullAt;e.random=random;e.range=range;e.rangeRight=rangeRight;e.rearg=rearg;e.reduce=reduce;e.reduceRight=reduceRight;e.reject=reject;e.remove=remove;e.repeat=repeat;e.replace=replace;e.rest=rest;e.result=result;e.reverse=reverse;e.round=round;e.sample=sample;e.sampleSize=sampleSize;e.set=set;e.setWith=setWith;e.shuffle=shuffle;e.size=size;e.slice=slice;e.snakeCase=snakeCase;e.some=some;e.sortBy=sortBy;e.sortedIndex=sortedIndex;e.sortedIndexBy=sortedIndexBy;e.sortedIndexOf=sortedIndexOf;e.sortedLastIndex=sortedLastIndex;e.sortedLastIndexBy=sortedLastIndexBy;e.sortedLastIndexOf=sortedLastIndexOf;e.split=split;e.spread=spread;e.startCase=startCase;e.startsWith=startsWith;e.stubArray=stubArray;e.stubFalse=stubFalse;e.stubObject=stubObject;e.stubString=stubString;e.stubTrue=stubTrue;e.subtract=subtract;e.sum=sum;e.sumBy=sumBy$1;e.tail=tail;e.take=take;e.takeRight=takeRight;e.takeRightWhile=takeRightWhile;e.takeWhile=takeWhile;e.template=template;e.templateSettings=X;e.throttle=throttle;e.times=times;e.toArray=toArray;e.toDefaulted=toDefaulted;e.toFinite=toFinite;e.toInteger=toInteger;e.toLength=toLength;e.toLower=toLower;e.toNumber=toNumber;e.toPairs=toPairs;e.toPairsIn=toPairsIn;e.toPath=toPath;e.toPlainObject=toPlainObject;e.toSafeInteger=toSafeInteger;e.toString=toString;e.toUpper=toUpper;e.transform=transform;e.trim=trim;e.trimEnd=trimEnd;e.trimStart=trimStart;e.truncate=truncate;e.unary=unary;e.unescape=unescape;e.union=union;e.unionBy=unionBy;e.unionWith=unionWith;e.uniq=uniq;e.uniqBy=uniqBy;e.uniqWith=uniqWith;e.uniqueId=uniqueId;e.unset=unset;e.unzip=unzip;e.unzipWith=unzipWith;e.update=update;e.updateWith=updateWith;e.upperCase=upperCase;e.upperFirst=upperFirst;e.values=values;e.valuesIn=valuesIn;e.without=without;e.words=words;e.wrap=wrap;e.xor=xor;e.xorBy=xorBy;e.xorWith=xorWith;e.zip=zip;e.zipObject=zipObject;e.zipObjectDeep=zipObjectDeep;e.zipWith=zipWith;Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); diff --git a/node_modules/es-toolkit/dist/compat/_internal/ArrayIterator.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ArrayIterator.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cef4fddda37c6f45e81d7c1391f38af88e089eba --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ArrayIterator.d.mts @@ -0,0 +1,3 @@ +type ArrayIterator = (value: T, index: number, collection: T[]) => R; + +export type { ArrayIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ArrayIterator.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ArrayIterator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cef4fddda37c6f45e81d7c1391f38af88e089eba --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ArrayIterator.d.ts @@ -0,0 +1,3 @@ +type ArrayIterator = (value: T, index: number, collection: T[]) => R; + +export type { ArrayIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bac85d8bc5ee3793faaa1287a86d2a71b99e6c61 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.mts @@ -0,0 +1,5 @@ +type ConformsPredicateObject = { + [P in keyof T]: T[P] extends (arg: infer A) => any ? A : any; +}; + +export type { ConformsPredicateObject }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bac85d8bc5ee3793faaa1287a86d2a71b99e6c61 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.ts @@ -0,0 +1,5 @@ +type ConformsPredicateObject = { + [P in keyof T]: T[P] extends (arg: infer A) => any ? A : any; +}; + +export type { ConformsPredicateObject }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.mts b/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9b370c0c029ed1a7e278f15acc78d1d4c9000b45 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.mts @@ -0,0 +1,6 @@ +type EmptyObject = { + [K in keyof T]?: never; +}; +type EmptyObjectOf = EmptyObject extends T ? EmptyObject : never; + +export type { EmptyObjectOf }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.ts b/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b370c0c029ed1a7e278f15acc78d1d4c9000b45 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.ts @@ -0,0 +1,6 @@ +type EmptyObject = { + [K in keyof T]?: never; +}; +type EmptyObjectOf = EmptyObject extends T ? EmptyObject : never; + +export type { EmptyObjectOf }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/Equals.d.d.mts b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..eccaa9681e3c4bd5853fedcdaee262d43325135d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.d.mts @@ -0,0 +1,3 @@ +type Equals = (() => X extends T ? 1 : 2) extends () => X extends U ? 1 : 2 ? true : false; + +export type { Equals }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/Equals.d.d.ts b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eccaa9681e3c4bd5853fedcdaee262d43325135d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.d.ts @@ -0,0 +1,3 @@ +type Equals = (() => X extends T ? 1 : 2) extends () => X extends U ? 1 : 2 ? true : false; + +export type { Equals }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.mts b/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4ccf8df1072614820eff55d45c9b9dfbee6a0042 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.mts @@ -0,0 +1,12 @@ +type GetFieldTypeOfArrayLikeByKey = K extends number ? T[K] : K extends `${infer N extends number}` ? T[N] : K extends keyof T ? T[K] : undefined; +type GetFieldTypeOfStringByKey = K extends number ? T[K] : K extends `${infer N extends number}` ? T[N] : K extends keyof T ? T[K] : undefined; +type GetFieldTypeOfNarrowedByKey = T extends unknown[] ? GetFieldTypeOfArrayLikeByKey : T extends string ? GetFieldTypeOfStringByKey : K extends keyof T ? T[K] : K extends number ? `${K}` extends keyof T ? T[`${K}`] : undefined : K extends `${infer N extends number}` ? N extends keyof T ? T[N] : undefined : undefined; +type GetFieldTypeOfNarrowedByDotPath = P extends `${infer L}.${infer R}` ? GetFieldType, R, 'DotPath'> : GetFieldTypeOfNarrowedByKey; +type GetFieldTypeOfNarrowedByLcKR = '' extends R ? GetFieldType, K, 'Key'> : R extends `.${infer Rc}` ? GetFieldType, K, 'Key'>, Rc> : GetFieldType, K, 'Key'>, R>; +type GetFieldTypeOfNarrowedByLKR = '' extends L ? '' extends R ? GetFieldTypeOfNarrowedByKey : R extends `.${infer Rc}` ? GetFieldType, Rc> : GetFieldType, R> : L extends `${infer Lc}.` ? GetFieldTypeOfNarrowedByLcKR : GetFieldTypeOfNarrowedByLcKR; +type GetFieldTypeOfNarrowed = XT extends 'Key' ? GetFieldTypeOfNarrowedByKey : XT extends 'DotPath' ? GetFieldTypeOfNarrowedByDotPath : X extends `${infer L}['${infer K}']${infer R}` ? GetFieldTypeOfNarrowedByLKR : X extends `${infer L}["${infer K}"]${infer R}` ? GetFieldTypeOfNarrowedByLKR : X extends `${infer L}[${infer K}]${infer R}` ? GetFieldTypeOfNarrowedByLKR : GetFieldTypeOfNarrowedByDotPath; +type GetFieldTypeOfObject = Extract extends never ? GetFieldTypeOfNarrowed : GetFieldTypeOfNarrowed, X, XT> | GetFieldTypeOfNarrowed, X, XT>; +type GetFieldTypeOfPrimitive = Extract extends never ? T extends never ? never : undefined : (Exclude extends never ? never : undefined) | GetFieldTypeOfNarrowed, X, XT>; +type GetFieldType = Extract extends never ? GetFieldTypeOfPrimitive : GetFieldTypeOfPrimitive, X, XT> | GetFieldTypeOfObject, X, XT>; + +export type { GetFieldType }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.ts b/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ccf8df1072614820eff55d45c9b9dfbee6a0042 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.ts @@ -0,0 +1,12 @@ +type GetFieldTypeOfArrayLikeByKey = K extends number ? T[K] : K extends `${infer N extends number}` ? T[N] : K extends keyof T ? T[K] : undefined; +type GetFieldTypeOfStringByKey = K extends number ? T[K] : K extends `${infer N extends number}` ? T[N] : K extends keyof T ? T[K] : undefined; +type GetFieldTypeOfNarrowedByKey = T extends unknown[] ? GetFieldTypeOfArrayLikeByKey : T extends string ? GetFieldTypeOfStringByKey : K extends keyof T ? T[K] : K extends number ? `${K}` extends keyof T ? T[`${K}`] : undefined : K extends `${infer N extends number}` ? N extends keyof T ? T[N] : undefined : undefined; +type GetFieldTypeOfNarrowedByDotPath = P extends `${infer L}.${infer R}` ? GetFieldType, R, 'DotPath'> : GetFieldTypeOfNarrowedByKey; +type GetFieldTypeOfNarrowedByLcKR = '' extends R ? GetFieldType, K, 'Key'> : R extends `.${infer Rc}` ? GetFieldType, K, 'Key'>, Rc> : GetFieldType, K, 'Key'>, R>; +type GetFieldTypeOfNarrowedByLKR = '' extends L ? '' extends R ? GetFieldTypeOfNarrowedByKey : R extends `.${infer Rc}` ? GetFieldType, Rc> : GetFieldType, R> : L extends `${infer Lc}.` ? GetFieldTypeOfNarrowedByLcKR : GetFieldTypeOfNarrowedByLcKR; +type GetFieldTypeOfNarrowed = XT extends 'Key' ? GetFieldTypeOfNarrowedByKey : XT extends 'DotPath' ? GetFieldTypeOfNarrowedByDotPath : X extends `${infer L}['${infer K}']${infer R}` ? GetFieldTypeOfNarrowedByLKR : X extends `${infer L}["${infer K}"]${infer R}` ? GetFieldTypeOfNarrowedByLKR : X extends `${infer L}[${infer K}]${infer R}` ? GetFieldTypeOfNarrowedByLKR : GetFieldTypeOfNarrowedByDotPath; +type GetFieldTypeOfObject = Extract extends never ? GetFieldTypeOfNarrowed : GetFieldTypeOfNarrowed, X, XT> | GetFieldTypeOfNarrowed, X, XT>; +type GetFieldTypeOfPrimitive = Extract extends never ? T extends never ? never : undefined : (Exclude extends never ? never : undefined) | GetFieldTypeOfNarrowed, X, XT>; +type GetFieldType = Extract extends never ? GetFieldTypeOfPrimitive : GetFieldTypeOfPrimitive, X, XT> | GetFieldTypeOfObject, X, XT>; + +export type { GetFieldType }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.mts b/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ab00e63495d59740c42dd74fcb45bdb66fa72acc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.mts @@ -0,0 +1,3 @@ +type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyKey | undefined, parent: any, otherParent: any, stack: any) => boolean | undefined; + +export type { IsEqualCustomizer }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.ts b/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab00e63495d59740c42dd74fcb45bdb66fa72acc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.ts @@ -0,0 +1,3 @@ +type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyKey | undefined, parent: any, otherParent: any, stack: any) => boolean | undefined; + +export type { IsEqualCustomizer }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.mts b/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..166966d094a118cceb6856862bd74dd5058f7198 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.mts @@ -0,0 +1,3 @@ +type IsMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyKey, object: object, source: object) => boolean | undefined; + +export type { IsMatchWithCustomizer }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.ts b/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..166966d094a118cceb6856862bd74dd5058f7198 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.ts @@ -0,0 +1,3 @@ +type IsMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyKey, object: object, source: object) => boolean | undefined; + +export type { IsMatchWithCustomizer }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.d.mts b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c9bfd8dfc3867f8d90a2f1f0a9ef6a62853aa9ff --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.d.mts @@ -0,0 +1,5 @@ +import { Equals } from './Equals.d.mjs'; + +type IsWritable = Equals<{ [K in keyof T]: T[K] }, { -readonly [K in keyof T]: T[K] }>; + +export type { IsWritable }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.d.ts b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b28324324c2afc3a9918fc7f929a6dae42187d67 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.d.ts @@ -0,0 +1,5 @@ +import { Equals } from './Equals.d.js'; + +type IsWritable = Equals<{ [K in keyof T]: T[K] }, { -readonly [K in keyof T]: T[K] }>; + +export type { IsWritable }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.mts b/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..767ed7d61bafc7a41c1d501aead563b9a0ec0276 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.mts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.mjs'; + +type IterateeShorthand = PropertyKey | [PropertyKey, any] | PartialShallow; + +export type { IterateeShorthand }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.ts b/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd0c192000a2f0ce653316bab518f99346fcef07 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.ts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.js'; + +type IterateeShorthand = PropertyKey | [PropertyKey, any] | PartialShallow; + +export type { IterateeShorthand }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5e7b3d8bd8664cf342dd02357d3236c712a9ee26 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.mts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.mjs'; + +type ListIteratee = ((value: T, index: number, collection: ArrayLike) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); + +export type { ListIteratee }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf58eecaa389121e2cab8df65ab6f27954f30d77 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.ts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.js'; + +type ListIteratee = ((value: T, index: number, collection: ArrayLike) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); + +export type { ListIteratee }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..85f5163327f020f4cfff5637bf2d9f582acb23a2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.mts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.mjs'; + +type ListIterateeCustom = ((value: T, index: number, collection: ArrayLike) => R) | (PropertyKey | [PropertyKey, any] | PartialShallow); + +export type { ListIterateeCustom }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ae6916ea737bf3a55b82707b96818f053b3e57c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.ts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.js'; + +type ListIterateeCustom = ((value: T, index: number, collection: ArrayLike) => R) | (PropertyKey | [PropertyKey, any] | PartialShallow); + +export type { ListIterateeCustom }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..56340dfc308a64e1dcb095b88ec07047d4b25e45 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.mts @@ -0,0 +1,3 @@ +type ListIterator = (value: T, index: number, collection: ArrayLike) => R; + +export type { ListIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..56340dfc308a64e1dcb095b88ec07047d4b25e45 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.ts @@ -0,0 +1,3 @@ +type ListIterator = (value: T, index: number, collection: ArrayLike) => R; + +export type { ListIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..78a872e34ddac6d36501f079c332e329a3b3fdfb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.mts @@ -0,0 +1,3 @@ +type ListIteratorTypeGuard = (value: T, index: number, collection: ArrayLike) => value is S; + +export type { ListIteratorTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..78a872e34ddac6d36501f079c332e329a3b3fdfb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.ts @@ -0,0 +1,3 @@ +type ListIteratorTypeGuard = (value: T, index: number, collection: ArrayLike) => value is S; + +export type { ListIteratorTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cd1e1d20faddd478b7a2110e1f54505549ace1a4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.mts @@ -0,0 +1,6 @@ +import { RecursiveArray } from './RecursiveArray.mjs'; + +interface ListOfRecursiveArraysOrValues extends ArrayLike> { +} + +export type { ListOfRecursiveArraysOrValues }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f23a76d8da522605f74c00ccdea742a3785d25d1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.ts @@ -0,0 +1,6 @@ +import { RecursiveArray } from './RecursiveArray.js'; + +interface ListOfRecursiveArraysOrValues extends ArrayLike> { +} + +export type { ListOfRecursiveArraysOrValues }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.js b/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.js new file mode 100644 index 0000000000000000000000000000000000000000..e135b1c91a8fb85f5f5131e6e094c1c6d1442b18 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.js @@ -0,0 +1,7 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const MAX_ARRAY_LENGTH = 4_294_967_295; + +exports.MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.mjs b/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6673a50910c1653a7a80b9a2c0ae9e9e346d87d8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.mjs @@ -0,0 +1,3 @@ +const MAX_ARRAY_LENGTH = 4_294_967_295; + +export { MAX_ARRAY_LENGTH }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.js b/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.js new file mode 100644 index 0000000000000000000000000000000000000000..f6c837caf5f34c6f2b2b59d82483f9310acae389 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.js @@ -0,0 +1,7 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER; + +exports.MAX_SAFE_INTEGER = MAX_SAFE_INTEGER; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.mjs b/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.mjs new file mode 100644 index 0000000000000000000000000000000000000000..63706aa4f58985136edde28fbb8e74b7429cd249 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.mjs @@ -0,0 +1,3 @@ +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER; + +export { MAX_SAFE_INTEGER }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/Many.d.mts b/node_modules/es-toolkit/dist/compat/_internal/Many.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5620f6af8aa0f3577fda4e2464c55b639e384742 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Many.d.mts @@ -0,0 +1,3 @@ +type Many = T | readonly T[]; + +export type { Many }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/Many.d.ts b/node_modules/es-toolkit/dist/compat/_internal/Many.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5620f6af8aa0f3577fda4e2464c55b639e384742 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Many.d.ts @@ -0,0 +1,3 @@ +type Many = T | readonly T[]; + +export type { Many }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.mts b/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cf4b27c4c0de028bafd9815d344ded5c904014d7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.mts @@ -0,0 +1,3 @@ +type MemoListIterator = (prev: R, curr: T, index: number, list: A) => R; + +export type { MemoListIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.ts b/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf4b27c4c0de028bafd9815d344ded5c904014d7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.ts @@ -0,0 +1,3 @@ +type MemoListIterator = (prev: R, curr: T, index: number, list: A) => R; + +export type { MemoListIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.mts b/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..64a21c57d93d8799434a56f21997f5e489e140be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.mts @@ -0,0 +1,3 @@ +type MemoObjectIterator = (prev: R, curr: T, key: string, list: A) => R; + +export type { MemoObjectIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.ts b/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..64a21c57d93d8799434a56f21997f5e489e140be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.ts @@ -0,0 +1,3 @@ +type MemoObjectIterator = (prev: R, curr: T, key: string, list: A) => R; + +export type { MemoObjectIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.d.mts b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7f41af7db7fbabeb0099739a6367b21778811360 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.d.mts @@ -0,0 +1,6 @@ +interface MutableList { + length: number; + [k: number]: T; +} + +export type { MutableList }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.d.ts b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7f41af7db7fbabeb0099739a6367b21778811360 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.d.ts @@ -0,0 +1,6 @@ +interface MutableList { + length: number; + [k: number]: T; +} + +export type { MutableList }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..18a1c9a5a09168df2901851eafb12bdbed0b2c6d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.mts @@ -0,0 +1,7 @@ +import { IterateeShorthand } from './IterateeShorthand.mjs'; +import { ObjectIterator } from './ObjectIterator.mjs'; + +type ObjectIteratee = ObjectIterator | IterateeShorthand; +type ObjectIterateeCustom = ObjectIterator | IterateeShorthand; + +export type { ObjectIteratee, ObjectIterateeCustom }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c949112440e5ad985244949e7df6f6eab30874b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.ts @@ -0,0 +1,7 @@ +import { IterateeShorthand } from './IterateeShorthand.js'; +import { ObjectIterator } from './ObjectIterator.js'; + +type ObjectIteratee = ObjectIterator | IterateeShorthand; +type ObjectIterateeCustom = ObjectIterator | IterateeShorthand; + +export type { ObjectIteratee, ObjectIterateeCustom }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e06da403476ff15852eb08c54898bb929c324dd4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.mts @@ -0,0 +1,4 @@ +type ObjectIterator = (value: T[keyof T], key: string, collection: T) => R; +type ObjectIteratorTypeGuard = (value: T[keyof T], key: string, collection: T) => value is U; + +export type { ObjectIterator, ObjectIteratorTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e06da403476ff15852eb08c54898bb929c324dd4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.ts @@ -0,0 +1,4 @@ +type ObjectIterator = (value: T[keyof T], key: string, collection: T) => R; +type ObjectIteratorTypeGuard = (value: T[keyof T], key: string, collection: T) => value is U; + +export type { ObjectIterator, ObjectIteratorTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.mts b/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a728158a184c1830dd7e1af5a531014cf48d3727 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.mts @@ -0,0 +1,5 @@ +type PartialShallow = { + [P in keyof T]?: T[P] extends object ? object : T[P]; +}; + +export type { PartialShallow }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.ts b/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a728158a184c1830dd7e1af5a531014cf48d3727 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.ts @@ -0,0 +1,5 @@ +type PartialShallow = { + [P in keyof T]?: T[P] extends object ? object : T[P]; +}; + +export type { PartialShallow }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.mts b/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a9f4a3825823c719afca09d1047f03c36920223e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.mts @@ -0,0 +1,5 @@ +import { Many } from './Many.mjs'; + +type PropertyPath = Many; + +export type { PropertyPath }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.ts b/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..944569639ccdbc6919e3371f9ccdcb0763ea7fa8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.ts @@ -0,0 +1,5 @@ +import { Many } from './Many.js'; + +type PropertyPath = Many; + +export type { PropertyPath }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.mts b/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8b299655909b07279ac9c53a6920a68ade1b0876 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.mts @@ -0,0 +1,4 @@ +interface RecursiveArray extends Array> { +} + +export type { RecursiveArray }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.ts b/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b299655909b07279ac9c53a6920a68ade1b0876 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.ts @@ -0,0 +1,4 @@ +interface RecursiveArray extends Array> { +} + +export type { RecursiveArray }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.d.mts b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6a7f9d04a22fd0db0a699586452f2a4c44e2a039 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.d.mts @@ -0,0 +1,6 @@ +import { IsWritable } from './IsWritable.d.mjs'; +import { MutableList } from './MutableList.d.mjs'; + +type RejectReadonly> = IsWritable extends true ? T : never; + +export type { RejectReadonly }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.d.ts b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf5326854f260886d2244db932e348297ab67422 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.d.ts @@ -0,0 +1,6 @@ +import { IsWritable } from './IsWritable.d.js'; +import { MutableList } from './MutableList.d.js'; + +type RejectReadonly> = IsWritable extends true ? T : never; + +export type { RejectReadonly }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.mts b/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9d5252895ee952fe37f69a4835f3703145b6d814 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.mts @@ -0,0 +1,3 @@ +type StringIterator = (char: string, index: number, string: string) => R; + +export type { StringIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.ts b/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d5252895ee952fe37f69a4835f3703145b6d814 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.ts @@ -0,0 +1,3 @@ +type StringIterator = (char: string, index: number, string: string) => R; + +export type { StringIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.mts b/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e558e56fb59d34a66d9043dd8f40b5d6921bfac3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.mts @@ -0,0 +1,3 @@ +type TupleIterator = (value: T[number], index: T extends `${infer N extends number}` ? N : never, collection: T) => TResult; + +export type { TupleIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.ts b/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e558e56fb59d34a66d9043dd8f40b5d6921bfac3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.ts @@ -0,0 +1,3 @@ +type TupleIterator = (value: T[number], index: T extends `${infer N extends number}` ? N : never, collection: T) => TResult; + +export type { TupleIterator }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f2050bce191dbe2982acf1ba4845495d037a7530 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.mts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.mjs'; + +type ValueIteratee = ((value: T) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); + +export type { ValueIteratee }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc3966f2bd4e8991453d78c1672a3e07abf5dc58 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.ts @@ -0,0 +1,5 @@ +import { PartialShallow } from './PartialShallow.js'; + +type ValueIteratee = ((value: T) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); + +export type { ValueIteratee }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ce625a06c7d67c75b93c3819ef67465654b7b0f3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.mts @@ -0,0 +1,5 @@ +import { IterateeShorthand } from './IterateeShorthand.mjs'; + +type ValueIterateeCustom = ((value: T) => TResult) | IterateeShorthand; + +export type { ValueIterateeCustom }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c2251aa64d5b3a91c5e4a75664954ba1ab676a7d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.ts @@ -0,0 +1,5 @@ +import { IterateeShorthand } from './IterateeShorthand.js'; + +type ValueIterateeCustom = ((value: T) => TResult) | IterateeShorthand; + +export type { ValueIterateeCustom }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..051e2163421514d3bc9f1bf1c977206487592718 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.mts @@ -0,0 +1,3 @@ +type ValueIteratorTypeGuard = (value: T) => value is S; + +export type { ValueIteratorTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..051e2163421514d3bc9f1bf1c977206487592718 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.ts @@ -0,0 +1,3 @@ +type ValueIteratorTypeGuard = (value: T) => value is S; + +export type { ValueIteratorTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c04a92e2625cf03ad7d58b4a7d71ab6626748911 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.mts @@ -0,0 +1,5 @@ +import { IterateeShorthand } from './IterateeShorthand.mjs'; + +type ValueKeyIteratee = ((value: T, key: string) => unknown) | IterateeShorthand; + +export type { ValueKeyIteratee }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..88b03a8d6ab3ceb223a979c8f09d2de8c1d7c853 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.ts @@ -0,0 +1,5 @@ +import { IterateeShorthand } from './IterateeShorthand.js'; + +type ValueKeyIteratee = ((value: T, key: string) => unknown) | IterateeShorthand; + +export type { ValueKeyIteratee }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.mts b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..943ce0e32d4248315d588221f25ce1a7fc7fc79a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.mts @@ -0,0 +1,3 @@ +type ValueKeyIterateeTypeGuard = (value: T, key: string) => value is S; + +export type { ValueKeyIterateeTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.ts b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..943ce0e32d4248315d588221f25ce1a7fc7fc79a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.ts @@ -0,0 +1,3 @@ +type ValueKeyIterateeTypeGuard = (value: T, key: string) => value is S; + +export type { ValueKeyIterateeTypeGuard }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/assignValue.js b/node_modules/es-toolkit/dist/compat/_internal/assignValue.js new file mode 100644 index 0000000000000000000000000000000000000000..1ee26817f0bbd966d08e62bd66cc72a3609f3ae5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/assignValue.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js'); + +const assignValue = (object, key, value) => { + const objValue = object[key]; + if (!(Object.hasOwn(object, key) && isEqualsSameValueZero.isEqualsSameValueZero(objValue, value)) || (value === undefined && !(key in object))) { + object[key] = value; + } +}; + +exports.assignValue = assignValue; diff --git a/node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs b/node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs new file mode 100644 index 0000000000000000000000000000000000000000..500545b4fab8bcd621344cccd48e04c7dfc01d6a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs @@ -0,0 +1,10 @@ +import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs'; + +const assignValue = (object, key, value) => { + const objValue = object[key]; + if (!(Object.hasOwn(object, key) && isEqualsSameValueZero(objValue, value)) || (value === undefined && !(key in object))) { + object[key] = value; + } +}; + +export { assignValue }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/compareValues.js b/node_modules/es-toolkit/dist/compat/_internal/compareValues.js new file mode 100644 index 0000000000000000000000000000000000000000..ebbad390e49accadc31ffd20460940f1944774be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/compareValues.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function getPriority(a) { + if (typeof a === 'symbol') { + return 1; + } + if (a === null) { + return 2; + } + if (a === undefined) { + return 3; + } + if (a !== a) { + return 4; + } + return 0; +} +const compareValues = (a, b, order) => { + if (a !== b) { + const aPriority = getPriority(a); + const bPriority = getPriority(b); + if (aPriority === bPriority && aPriority === 0) { + if (a < b) { + return order === 'desc' ? 1 : -1; + } + if (a > b) { + return order === 'desc' ? -1 : 1; + } + } + return order === 'desc' ? bPriority - aPriority : aPriority - bPriority; + } + return 0; +}; + +exports.compareValues = compareValues; diff --git a/node_modules/es-toolkit/dist/compat/_internal/compareValues.mjs b/node_modules/es-toolkit/dist/compat/_internal/compareValues.mjs new file mode 100644 index 0000000000000000000000000000000000000000..935b06f6bc2ec314312786ea2ff7c49de667b9f6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/compareValues.mjs @@ -0,0 +1,33 @@ +function getPriority(a) { + if (typeof a === 'symbol') { + return 1; + } + if (a === null) { + return 2; + } + if (a === undefined) { + return 3; + } + if (a !== a) { + return 4; + } + return 0; +} +const compareValues = (a, b, order) => { + if (a !== b) { + const aPriority = getPriority(a); + const bPriority = getPriority(b); + if (aPriority === bPriority && aPriority === 0) { + if (a < b) { + return order === 'desc' ? 1 : -1; + } + if (a > b) { + return order === 'desc' ? -1 : 1; + } + } + return order === 'desc' ? bPriority - aPriority : aPriority - bPriority; + } + return 0; +}; + +export { compareValues }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/copyArray.js b/node_modules/es-toolkit/dist/compat/_internal/copyArray.js new file mode 100644 index 0000000000000000000000000000000000000000..813c1594b8170bd1e36e9a25fe68497913ba3edd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/copyArray.js @@ -0,0 +1,14 @@ +'use strict'; + +function copyArray(source, array) { + const length = source.length; + if (array == null) { + array = Array(length); + } + for (let i = 0; i < length; i++) { + array[i] = source[i]; + } + return array; +} + +module.exports = copyArray; diff --git a/node_modules/es-toolkit/dist/compat/_internal/copyArray.mjs b/node_modules/es-toolkit/dist/compat/_internal/copyArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f6c1585df0ef8014f87345cdf58defca7e0aa3f6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/copyArray.mjs @@ -0,0 +1,12 @@ +function copyArray(source, array) { + const length = source.length; + if (array == null) { + array = Array(length); + } + for (let i = 0; i < length; i++) { + array[i] = source[i]; + } + return array; +} + +export { copyArray as default }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.js b/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.js new file mode 100644 index 0000000000000000000000000000000000000000..a3fe28cd2c82f0734982d828e5c8a204ebd1595b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function decimalAdjust(type, number, precision = 0) { + number = Number(number); + if (Object.is(number, -0)) { + number = '-0'; + } + precision = Math.min(Number.parseInt(precision, 10), 292); + if (precision) { + const [magnitude, exponent = 0] = number.toString().split('e'); + let adjustedValue = Math[type](Number(`${magnitude}e${Number(exponent) + precision}`)); + if (Object.is(adjustedValue, -0)) { + adjustedValue = '-0'; + } + const [newMagnitude, newExponent = 0] = adjustedValue.toString().split('e'); + return Number(`${newMagnitude}e${Number(newExponent) - precision}`); + } + return Math[type](Number(number)); +} + +exports.decimalAdjust = decimalAdjust; diff --git a/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.mjs b/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5a4409fcd566ec6b47ac87751d0cc779f8df01b0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.mjs @@ -0,0 +1,19 @@ +function decimalAdjust(type, number, precision = 0) { + number = Number(number); + if (Object.is(number, -0)) { + number = '-0'; + } + precision = Math.min(Number.parseInt(precision, 10), 292); + if (precision) { + const [magnitude, exponent = 0] = number.toString().split('e'); + let adjustedValue = Math[type](Number(`${magnitude}e${Number(exponent) + precision}`)); + if (Object.is(adjustedValue, -0)) { + adjustedValue = '-0'; + } + const [newMagnitude, newExponent = 0] = adjustedValue.toString().split('e'); + return Number(`${newMagnitude}e${Number(newExponent) - precision}`); + } + return Math[type](Number(number)); +} + +export { decimalAdjust }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.js b/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.js new file mode 100644 index 0000000000000000000000000000000000000000..b0d52a941490a4efc0a4aea4c7ad0b539eea4ce0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.js @@ -0,0 +1,21 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function flattenArrayLike(values) { + const result = []; + for (let i = 0; i < values.length; i++) { + const arrayLike = values[i]; + if (!isArrayLikeObject.isArrayLikeObject(arrayLike)) { + continue; + } + for (let j = 0; j < arrayLike.length; j++) { + result.push(arrayLike[j]); + } + } + return result; +} + +exports.flattenArrayLike = flattenArrayLike; diff --git a/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.mjs b/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.mjs new file mode 100644 index 0000000000000000000000000000000000000000..def529973e593b06e4953eefe681f2581266592e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.mjs @@ -0,0 +1,17 @@ +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function flattenArrayLike(values) { + const result = []; + for (let i = 0; i < values.length; i++) { + const arrayLike = values[i]; + if (!isArrayLikeObject(arrayLike)) { + continue; + } + for (let j = 0; j < arrayLike.length; j++) { + result.push(arrayLike[j]); + } + } + return result; +} + +export { flattenArrayLike }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js b/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js new file mode 100644 index 0000000000000000000000000000000000000000..cddadbd679bd056f134bc13bbc5bbe4fb2103f20 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function getSymbols(object) { + return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol)); +} + +exports.getSymbols = getSymbols; diff --git a/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs b/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d15be753143bda63a7d3e4610caee70548c208c7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs @@ -0,0 +1,5 @@ +function getSymbols(object) { + return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol)); +} + +export { getSymbols }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.js b/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.js new file mode 100644 index 0000000000000000000000000000000000000000..16ebc379f6c99a04384a54c2a7f2c22b62f51a08 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const getSymbols = require('./getSymbols.js'); + +function getSymbolsIn(object) { + const result = []; + while (object) { + result.push(...getSymbols.getSymbols(object)); + object = Object.getPrototypeOf(object); + } + return result; +} + +exports.getSymbolsIn = getSymbolsIn; diff --git a/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.mjs b/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7dc64ba40114b50f558247d4b00657affec182c4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.mjs @@ -0,0 +1,12 @@ +import { getSymbols } from './getSymbols.mjs'; + +function getSymbolsIn(object) { + const result = []; + while (object) { + result.push(...getSymbols(object)); + object = Object.getPrototypeOf(object); + } + return result; +} + +export { getSymbolsIn }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/getTag.js b/node_modules/es-toolkit/dist/compat/_internal/getTag.js new file mode 100644 index 0000000000000000000000000000000000000000..13ebb55aabdb1e3e97adaa1996a5ae3691a62a80 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getTag.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function getTag(value) { + if (value == null) { + return value === undefined ? '[object Undefined]' : '[object Null]'; + } + return Object.prototype.toString.call(value); +} + +exports.getTag = getTag; diff --git a/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs b/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5302f4fc21f97ae3c9fdbeb14997e9e606822193 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs @@ -0,0 +1,8 @@ +function getTag(value) { + if (value == null) { + return value === undefined ? '[object Undefined]' : '[object Null]'; + } + return Object.prototype.toString.call(value); +} + +export { getTag }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js b/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js new file mode 100644 index 0000000000000000000000000000000000000000..52052f79cc4938d8b7ff7d2d3a18f01764688daa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function isDeepKey(key) { + switch (typeof key) { + case 'number': + case 'symbol': { + return false; + } + case 'string': { + return key.includes('.') || key.includes('[') || key.includes(']'); + } + } +} + +exports.isDeepKey = isDeepKey; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs b/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e06007b586bd53394b7d6807277b0b0cb8fed468 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs @@ -0,0 +1,13 @@ +function isDeepKey(key) { + switch (typeof key) { + case 'number': + case 'symbol': { + return false; + } + case 'string': { + return key.includes('.') || key.includes('[') || key.includes(']'); + } + } +} + +export { isDeepKey }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isIndex.js b/node_modules/es-toolkit/dist/compat/_internal/isIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..831387a684530549c3d5904557c0fe0604e9ca78 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIndex.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/; +function isIndex(value, length = Number.MAX_SAFE_INTEGER) { + switch (typeof value) { + case 'number': { + return Number.isInteger(value) && value >= 0 && value < length; + } + case 'symbol': { + return false; + } + case 'string': { + return IS_UNSIGNED_INTEGER.test(value); + } + } +} + +exports.isIndex = isIndex; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs b/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..66c58714e3c59cc604b21bc6e2def64c8999f167 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs @@ -0,0 +1,16 @@ +const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/; +function isIndex(value, length = Number.MAX_SAFE_INTEGER) { + switch (typeof value) { + case 'number': { + return Number.isInteger(value) && value >= 0 && value < length; + } + case 'symbol': { + return false; + } + case 'string': { + return IS_UNSIGNED_INTEGER.test(value); + } + } +} + +export { isIndex }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.js b/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.js new file mode 100644 index 0000000000000000000000000000000000000000..e5e7519919eb0396f7c747311d176ae2ba3a8d39 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.js @@ -0,0 +1,21 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isIndex = require('./isIndex.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const isObject = require('../predicate/isObject.js'); +const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js'); + +function isIterateeCall(value, index, object) { + if (!isObject.isObject(object)) { + return false; + } + if ((typeof index === 'number' && isArrayLike.isArrayLike(object) && isIndex.isIndex(index) && index < object.length) || + (typeof index === 'string' && index in object)) { + return isEqualsSameValueZero.isEqualsSameValueZero(object[index], value); + } + return false; +} + +exports.isIterateeCall = isIterateeCall; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs b/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b291e7ab4988b7735e83446ac67c42b197dc5e52 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs @@ -0,0 +1,17 @@ +import { isIndex } from './isIndex.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { isObject } from '../predicate/isObject.mjs'; +import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs'; + +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + if ((typeof index === 'number' && isArrayLike(object) && isIndex(index) && index < object.length) || + (typeof index === 'string' && index in object)) { + return isEqualsSameValueZero(object[index], value); + } + return false; +} + +export { isIterateeCall }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isKey.js b/node_modules/es-toolkit/dist/compat/_internal/isKey.js new file mode 100644 index 0000000000000000000000000000000000000000..e6c1aa222c5401be34dec4807cc3e21882a396d1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isKey.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isSymbol = require('../predicate/isSymbol.js'); + +const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; +const regexIsPlainProp = /^\w*$/; +function isKey(value, object) { + if (Array.isArray(value)) { + return false; + } + if (typeof value === 'number' || typeof value === 'boolean' || value == null || isSymbol.isSymbol(value)) { + return true; + } + return ((typeof value === 'string' && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value))) || + (object != null && Object.hasOwn(object, value))); +} + +exports.isKey = isKey; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs b/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9b12177a133e054a6d5e758875e9581e82bda0e0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs @@ -0,0 +1,16 @@ +import { isSymbol } from '../predicate/isSymbol.mjs'; + +const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; +const regexIsPlainProp = /^\w*$/; +function isKey(value, object) { + if (Array.isArray(value)) { + return false; + } + if (typeof value === 'number' || typeof value === 'boolean' || value == null || isSymbol(value)) { + return true; + } + return ((typeof value === 'string' && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value))) || + (object != null && Object.hasOwn(object, value))); +} + +export { isKey }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js b/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js new file mode 100644 index 0000000000000000000000000000000000000000..17ca3e217fe7ce0373de45e583a2d81ee076a0e3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function isPrototype(value) { + const constructor = value?.constructor; + const prototype = typeof constructor === 'function' ? constructor.prototype : Object.prototype; + return value === prototype; +} + +exports.isPrototype = isPrototype; diff --git a/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs b/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7ef49c374e20f87034831547ef4ba05f9571655e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs @@ -0,0 +1,7 @@ +function isPrototype(value) { + const constructor = value?.constructor; + const prototype = typeof constructor === 'function' ? constructor.prototype : Object.prototype; + return value === prototype; +} + +export { isPrototype }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.js b/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.js new file mode 100644 index 0000000000000000000000000000000000000000..fedc9776446f94fb18a648b9fa759d06af013344 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function mapToEntries(map) { + const arr = new Array(map.size); + const keys = map.keys(); + const values = map.values(); + for (let i = 0; i < arr.length; i++) { + arr[i] = [keys.next().value, values.next().value]; + } + return arr; +} + +exports.mapToEntries = mapToEntries; diff --git a/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.mjs b/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c229ec08d1f1bfc6f70db5da1f33661ac3d83e66 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.mjs @@ -0,0 +1,11 @@ +function mapToEntries(map) { + const arr = new Array(map.size); + const keys = map.keys(); + const values = map.values(); + for (let i = 0; i < arr.length; i++) { + arr[i] = [keys.next().value, values.next().value]; + } + return arr; +} + +export { mapToEntries }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.js b/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.js new file mode 100644 index 0000000000000000000000000000000000000000..b2a0ddee3ed628b44972d86ed2f747912fb91f82 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const toString = require('../util/toString.js'); + +function normalizeForCase(str) { + if (typeof str !== 'string') { + str = toString.toString(str); + } + return str.replace(/['\u2019]/g, ''); +} + +exports.normalizeForCase = normalizeForCase; diff --git a/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.mjs b/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8cb14a9293bf94161a895aa54570837fab369db8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.mjs @@ -0,0 +1,10 @@ +import { toString } from '../util/toString.mjs'; + +function normalizeForCase(str) { + if (typeof str !== 'string') { + str = toString(str); + } + return str.replace(/['\u2019]/g, ''); +} + +export { normalizeForCase }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/setToEntries.js b/node_modules/es-toolkit/dist/compat/_internal/setToEntries.js new file mode 100644 index 0000000000000000000000000000000000000000..9d6563db7bb63548798d38d46f9975a92c389d46 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/setToEntries.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function setToEntries(set) { + const arr = new Array(set.size); + const values = set.values(); + for (let i = 0; i < arr.length; i++) { + const value = values.next().value; + arr[i] = [value, value]; + } + return arr; +} + +exports.setToEntries = setToEntries; diff --git a/node_modules/es-toolkit/dist/compat/_internal/setToEntries.mjs b/node_modules/es-toolkit/dist/compat/_internal/setToEntries.mjs new file mode 100644 index 0000000000000000000000000000000000000000..463002ffe304be3421986476bb903d2ea1448930 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/setToEntries.mjs @@ -0,0 +1,11 @@ +function setToEntries(set) { + const arr = new Array(set.size); + const values = set.values(); + for (let i = 0; i < arr.length; i++) { + const value = values.next().value; + arr[i] = [value, value]; + } + return arr; +} + +export { setToEntries }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/tags.js b/node_modules/es-toolkit/dist/compat/_internal/tags.js new file mode 100644 index 0000000000000000000000000000000000000000..5a281e3daf70e7f7597f230af97c550e88f6eb65 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/tags.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const regexpTag = '[object RegExp]'; +const stringTag = '[object String]'; +const numberTag = '[object Number]'; +const booleanTag = '[object Boolean]'; +const argumentsTag = '[object Arguments]'; +const symbolTag = '[object Symbol]'; +const dateTag = '[object Date]'; +const mapTag = '[object Map]'; +const setTag = '[object Set]'; +const arrayTag = '[object Array]'; +const functionTag = '[object Function]'; +const arrayBufferTag = '[object ArrayBuffer]'; +const objectTag = '[object Object]'; +const errorTag = '[object Error]'; +const dataViewTag = '[object DataView]'; +const uint8ArrayTag = '[object Uint8Array]'; +const uint8ClampedArrayTag = '[object Uint8ClampedArray]'; +const uint16ArrayTag = '[object Uint16Array]'; +const uint32ArrayTag = '[object Uint32Array]'; +const bigUint64ArrayTag = '[object BigUint64Array]'; +const int8ArrayTag = '[object Int8Array]'; +const int16ArrayTag = '[object Int16Array]'; +const int32ArrayTag = '[object Int32Array]'; +const bigInt64ArrayTag = '[object BigInt64Array]'; +const float32ArrayTag = '[object Float32Array]'; +const float64ArrayTag = '[object Float64Array]'; + +exports.argumentsTag = argumentsTag; +exports.arrayBufferTag = arrayBufferTag; +exports.arrayTag = arrayTag; +exports.bigInt64ArrayTag = bigInt64ArrayTag; +exports.bigUint64ArrayTag = bigUint64ArrayTag; +exports.booleanTag = booleanTag; +exports.dataViewTag = dataViewTag; +exports.dateTag = dateTag; +exports.errorTag = errorTag; +exports.float32ArrayTag = float32ArrayTag; +exports.float64ArrayTag = float64ArrayTag; +exports.functionTag = functionTag; +exports.int16ArrayTag = int16ArrayTag; +exports.int32ArrayTag = int32ArrayTag; +exports.int8ArrayTag = int8ArrayTag; +exports.mapTag = mapTag; +exports.numberTag = numberTag; +exports.objectTag = objectTag; +exports.regexpTag = regexpTag; +exports.setTag = setTag; +exports.stringTag = stringTag; +exports.symbolTag = symbolTag; +exports.uint16ArrayTag = uint16ArrayTag; +exports.uint32ArrayTag = uint32ArrayTag; +exports.uint8ArrayTag = uint8ArrayTag; +exports.uint8ClampedArrayTag = uint8ClampedArrayTag; diff --git a/node_modules/es-toolkit/dist/compat/_internal/tags.mjs b/node_modules/es-toolkit/dist/compat/_internal/tags.mjs new file mode 100644 index 0000000000000000000000000000000000000000..27c7c1f13bc0ed781449ecf473fbbcd51434d59f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/tags.mjs @@ -0,0 +1,28 @@ +const regexpTag = '[object RegExp]'; +const stringTag = '[object String]'; +const numberTag = '[object Number]'; +const booleanTag = '[object Boolean]'; +const argumentsTag = '[object Arguments]'; +const symbolTag = '[object Symbol]'; +const dateTag = '[object Date]'; +const mapTag = '[object Map]'; +const setTag = '[object Set]'; +const arrayTag = '[object Array]'; +const functionTag = '[object Function]'; +const arrayBufferTag = '[object ArrayBuffer]'; +const objectTag = '[object Object]'; +const errorTag = '[object Error]'; +const dataViewTag = '[object DataView]'; +const uint8ArrayTag = '[object Uint8Array]'; +const uint8ClampedArrayTag = '[object Uint8ClampedArray]'; +const uint16ArrayTag = '[object Uint16Array]'; +const uint32ArrayTag = '[object Uint32Array]'; +const bigUint64ArrayTag = '[object BigUint64Array]'; +const int8ArrayTag = '[object Int8Array]'; +const int16ArrayTag = '[object Int16Array]'; +const int32ArrayTag = '[object Int32Array]'; +const bigInt64ArrayTag = '[object BigInt64Array]'; +const float32ArrayTag = '[object Float32Array]'; +const float64ArrayTag = '[object Float64Array]'; + +export { argumentsTag, arrayBufferTag, arrayTag, bigInt64ArrayTag, bigUint64ArrayTag, booleanTag, dataViewTag, dateTag, errorTag, float32ArrayTag, float64ArrayTag, functionTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/toArray.js b/node_modules/es-toolkit/dist/compat/_internal/toArray.js new file mode 100644 index 0000000000000000000000000000000000000000..f61cfdc31408aa39f9c88518b63a1d331e588820 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toArray.js @@ -0,0 +1,9 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function toArray(value) { + return Array.isArray(value) ? value : Array.from(value); +} + +exports.toArray = toArray; diff --git a/node_modules/es-toolkit/dist/compat/_internal/toArray.mjs b/node_modules/es-toolkit/dist/compat/_internal/toArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cd80916f6aa88d240c6d468235c1e82f1c30ef53 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toArray.mjs @@ -0,0 +1,5 @@ +function toArray(value) { + return Array.isArray(value) ? value : Array.from(value); +} + +export { toArray }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/toKey.js b/node_modules/es-toolkit/dist/compat/_internal/toKey.js new file mode 100644 index 0000000000000000000000000000000000000000..97b66e3b8c1f65e8aebb769f305e589b63fa2c61 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toKey.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function toKey(value) { + if (typeof value === 'string' || typeof value === 'symbol') { + return value; + } + if (Object.is(value?.valueOf?.(), -0)) { + return '-0'; + } + return String(value); +} + +exports.toKey = toKey; diff --git a/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs b/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs new file mode 100644 index 0000000000000000000000000000000000000000..74a5699ea9e27909c39d1379bc332418e834efde --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs @@ -0,0 +1,11 @@ +function toKey(value) { + if (typeof value === 'string' || typeof value === 'symbol') { + return value; + } + if (Object.is(value?.valueOf?.(), -0)) { + return '-0'; + } + return String(value); +} + +export { toKey }; diff --git a/node_modules/es-toolkit/dist/compat/array/castArray.d.mts b/node_modules/es-toolkit/dist/compat/array/castArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1b6da5b26b30f4490cd1185f7e5bdff2eef974bf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.d.mts @@ -0,0 +1,29 @@ +/** + * Casts value as an array if it's not one. + * + * @template T The type of elements in the array. + * @param {T | T[]} value The value to be cast to an array. + * @returns {T[]} An array containing the input value if it wasn't an array, or the original array if it was. + * + * @example + * const arr1 = castArray(1); + * // Returns: [1] + * + * const arr2 = castArray([1]); + * // Returns: [1] + * + * const arr3 = castArray({'a': 1}); + * // Returns: [{'a': 1}] + * + * const arr4 = castArray(null); + * // Returns: [null] + * + * const arr5 = castArray(undefined); + * // Returns: [undefined] + * + * const arr6 = castArray(); + * // Returns: [] + */ +declare function castArray(value?: T | readonly T[]): T[]; + +export { castArray }; diff --git a/node_modules/es-toolkit/dist/compat/array/castArray.d.ts b/node_modules/es-toolkit/dist/compat/array/castArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b6da5b26b30f4490cd1185f7e5bdff2eef974bf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.d.ts @@ -0,0 +1,29 @@ +/** + * Casts value as an array if it's not one. + * + * @template T The type of elements in the array. + * @param {T | T[]} value The value to be cast to an array. + * @returns {T[]} An array containing the input value if it wasn't an array, or the original array if it was. + * + * @example + * const arr1 = castArray(1); + * // Returns: [1] + * + * const arr2 = castArray([1]); + * // Returns: [1] + * + * const arr3 = castArray({'a': 1}); + * // Returns: [{'a': 1}] + * + * const arr4 = castArray(null); + * // Returns: [null] + * + * const arr5 = castArray(undefined); + * // Returns: [undefined] + * + * const arr6 = castArray(); + * // Returns: [] + */ +declare function castArray(value?: T | readonly T[]): T[]; + +export { castArray }; diff --git a/node_modules/es-toolkit/dist/compat/array/castArray.js b/node_modules/es-toolkit/dist/compat/array/castArray.js new file mode 100644 index 0000000000000000000000000000000000000000..845d59f64ab582fb5cfcbd1aef59180f4ea96d95 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function castArray(value) { + if (arguments.length === 0) { + return []; + } + return Array.isArray(value) ? value : [value]; +} + +exports.castArray = castArray; diff --git a/node_modules/es-toolkit/dist/compat/array/castArray.mjs b/node_modules/es-toolkit/dist/compat/array/castArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..14873449d5561e3d51a3bbaba6afa90cdf4c77ab --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.mjs @@ -0,0 +1,8 @@ +function castArray(value) { + if (arguments.length === 0) { + return []; + } + return Array.isArray(value) ? value : [value]; +} + +export { castArray }; diff --git a/node_modules/es-toolkit/dist/compat/array/chunk.d.mts b/node_modules/es-toolkit/dist/compat/array/chunk.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..947deecc55942bb37d891ef0762999c967a9250f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.d.mts @@ -0,0 +1,25 @@ +/** + * Splits an array into smaller arrays of a specified length. + * + * This function takes an input array and divides it into multiple smaller arrays, + * each of a specified length. If the input array cannot be evenly divided, + * the final sub-array will contain the remaining elements. + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to be chunked into smaller arrays. + * @param {number} size - The size of each smaller array. Must be a positive integer. + * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`. + * + * @example + * // Splits an array of numbers into sub-arrays of length 2 + * chunk([1, 2, 3, 4, 5], 2); + * // Returns: [[1, 2], [3, 4], [5]] + * + * @example + * // Splits an array of strings into sub-arrays of length 3 + * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3); + * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']] + */ +declare function chunk(arr: ArrayLike | null | undefined, size?: number): T[][]; + +export { chunk }; diff --git a/node_modules/es-toolkit/dist/compat/array/chunk.d.ts b/node_modules/es-toolkit/dist/compat/array/chunk.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..947deecc55942bb37d891ef0762999c967a9250f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.d.ts @@ -0,0 +1,25 @@ +/** + * Splits an array into smaller arrays of a specified length. + * + * This function takes an input array and divides it into multiple smaller arrays, + * each of a specified length. If the input array cannot be evenly divided, + * the final sub-array will contain the remaining elements. + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to be chunked into smaller arrays. + * @param {number} size - The size of each smaller array. Must be a positive integer. + * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`. + * + * @example + * // Splits an array of numbers into sub-arrays of length 2 + * chunk([1, 2, 3, 4, 5], 2); + * // Returns: [[1, 2], [3, 4], [5]] + * + * @example + * // Splits an array of strings into sub-arrays of length 3 + * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3); + * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']] + */ +declare function chunk(arr: ArrayLike | null | undefined, size?: number): T[][]; + +export { chunk }; diff --git a/node_modules/es-toolkit/dist/compat/array/chunk.js b/node_modules/es-toolkit/dist/compat/array/chunk.js new file mode 100644 index 0000000000000000000000000000000000000000..d84b8a539e9b489dee51541b0709e638a7e4ee40 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const chunk$1 = require('../../array/chunk.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function chunk(arr, size = 1) { + size = Math.max(Math.floor(size), 0); + if (size === 0 || !isArrayLike.isArrayLike(arr)) { + return []; + } + return chunk$1.chunk(toArray.toArray(arr), size); +} + +exports.chunk = chunk; diff --git a/node_modules/es-toolkit/dist/compat/array/chunk.mjs b/node_modules/es-toolkit/dist/compat/array/chunk.mjs new file mode 100644 index 0000000000000000000000000000000000000000..edb6a0a6ef9b48c14e3d523722829103485b59df --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.mjs @@ -0,0 +1,13 @@ +import { chunk as chunk$1 } from '../../array/chunk.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function chunk(arr, size = 1) { + size = Math.max(Math.floor(size), 0); + if (size === 0 || !isArrayLike(arr)) { + return []; + } + return chunk$1(toArray(arr), size); +} + +export { chunk }; diff --git a/node_modules/es-toolkit/dist/compat/array/compact.d.mts b/node_modules/es-toolkit/dist/compat/array/compact.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..81dc8677370cbd8856941f4f8cbe44df001b0a3b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.d.mts @@ -0,0 +1,15 @@ +type Falsey = false | null | 0 | 0n | '' | undefined; +/** + * Removes falsey values (false, null, 0, 0n, '', undefined, NaN) from an array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The input array to remove falsey values. + * @returns {Array>} - A new array with all falsey values removed. + * + * @example + * compact([0, 0n, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]); + * Returns: [1, 2, 3, 4, 5] + */ +declare function compact(arr: ArrayLike | null | undefined): T[]; + +export { compact }; diff --git a/node_modules/es-toolkit/dist/compat/array/compact.d.ts b/node_modules/es-toolkit/dist/compat/array/compact.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..81dc8677370cbd8856941f4f8cbe44df001b0a3b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.d.ts @@ -0,0 +1,15 @@ +type Falsey = false | null | 0 | 0n | '' | undefined; +/** + * Removes falsey values (false, null, 0, 0n, '', undefined, NaN) from an array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The input array to remove falsey values. + * @returns {Array>} - A new array with all falsey values removed. + * + * @example + * compact([0, 0n, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]); + * Returns: [1, 2, 3, 4, 5] + */ +declare function compact(arr: ArrayLike | null | undefined): T[]; + +export { compact }; diff --git a/node_modules/es-toolkit/dist/compat/array/compact.js b/node_modules/es-toolkit/dist/compat/array/compact.js new file mode 100644 index 0000000000000000000000000000000000000000..b13de06b5920495766c9768bcc14823023f7a711 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const compact$1 = require('../../array/compact.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function compact(arr) { + if (!isArrayLike.isArrayLike(arr)) { + return []; + } + return compact$1.compact(Array.from(arr)); +} + +exports.compact = compact; diff --git a/node_modules/es-toolkit/dist/compat/array/compact.mjs b/node_modules/es-toolkit/dist/compat/array/compact.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a9a4cd500390e7c54636c16e963773caecf5773f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.mjs @@ -0,0 +1,11 @@ +import { compact as compact$1 } from '../../array/compact.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function compact(arr) { + if (!isArrayLike(arr)) { + return []; + } + return compact$1(Array.from(arr)); +} + +export { compact }; diff --git a/node_modules/es-toolkit/dist/compat/array/concat.d.mts b/node_modules/es-toolkit/dist/compat/array/concat.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..33784149cdcfbf48cad926b63a3f61209c44e4d8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.d.mts @@ -0,0 +1,30 @@ +/** + * Concatenates multiple arrays and values into a single array. + * + * @template T The type of elements in the array. + * @param {...(T | T[])} values - The values and/or arrays to concatenate. + * @returns {T[]} A new array containing all the input values. + * + * @example + * // Concatenate individual values + * concat(1, 2, 3); + * // returns [1, 2, 3] + * + * @example + * // Concatenate arrays of values + * concat([1, 2], [3, 4]); + * // returns [1, 2, 3, 4] + * + * @example + * // Concatenate a mix of individual values and arrays + * concat(1, [2, 3], 4); + * // returns [1, 2, 3, 4] + * + * @example + * // Concatenate nested arrays + * concat([1, [2, 3]], 4); + * // returns [1, [2, 3], 4] + */ +declare function concat(...values: Array): T[]; + +export { concat }; diff --git a/node_modules/es-toolkit/dist/compat/array/concat.d.ts b/node_modules/es-toolkit/dist/compat/array/concat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..33784149cdcfbf48cad926b63a3f61209c44e4d8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.d.ts @@ -0,0 +1,30 @@ +/** + * Concatenates multiple arrays and values into a single array. + * + * @template T The type of elements in the array. + * @param {...(T | T[])} values - The values and/or arrays to concatenate. + * @returns {T[]} A new array containing all the input values. + * + * @example + * // Concatenate individual values + * concat(1, 2, 3); + * // returns [1, 2, 3] + * + * @example + * // Concatenate arrays of values + * concat([1, 2], [3, 4]); + * // returns [1, 2, 3, 4] + * + * @example + * // Concatenate a mix of individual values and arrays + * concat(1, [2, 3], 4); + * // returns [1, 2, 3, 4] + * + * @example + * // Concatenate nested arrays + * concat([1, [2, 3]], 4); + * // returns [1, [2, 3], 4] + */ +declare function concat(...values: Array): T[]; + +export { concat }; diff --git a/node_modules/es-toolkit/dist/compat/array/concat.js b/node_modules/es-toolkit/dist/compat/array/concat.js new file mode 100644 index 0000000000000000000000000000000000000000..669b4bc32e468ed1f822f5a752c52af80fb62959 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('../../array/flatten.js'); + +function concat(...values) { + return flatten.flatten(values); +} + +exports.concat = concat; diff --git a/node_modules/es-toolkit/dist/compat/array/concat.mjs b/node_modules/es-toolkit/dist/compat/array/concat.mjs new file mode 100644 index 0000000000000000000000000000000000000000..79f7a6751265e2e0b4a6830ce1a434540fbd6b0d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.mjs @@ -0,0 +1,7 @@ +import { flatten } from '../../array/flatten.mjs'; + +function concat(...values) { + return flatten(values); +} + +export { concat }; diff --git a/node_modules/es-toolkit/dist/compat/array/countBy.d.mts b/node_modules/es-toolkit/dist/compat/array/countBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..93ae774b3cfa918d406bea9d08b1a2a969b93c82 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.d.mts @@ -0,0 +1,19 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is invoked with one argument: (value). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the composed aggregate object. + * + * @example + * countBy([6.1, 4.2, 6.3], Math.floor); // => { '4': 1, '6': 2 } + * countBy(['one', 'two', 'three'], 'length'); // => { '3': 2, '5': 1 } + */ +declare function countBy(collection: ArrayLike | null | undefined, iteratee?: ValueIteratee): Record; +declare function countBy(collection: T | null | undefined, iteratee?: ValueIteratee): Record; + +export { countBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/countBy.d.ts b/node_modules/es-toolkit/dist/compat/array/countBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ed87f657325648bfb6cc9b8940682cc402aa2a9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.d.ts @@ -0,0 +1,19 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is invoked with one argument: (value). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the composed aggregate object. + * + * @example + * countBy([6.1, 4.2, 6.3], Math.floor); // => { '4': 1, '6': 2 } + * countBy(['one', 'two', 'three'], 'length'); // => { '3': 2, '5': 1 } + */ +declare function countBy(collection: ArrayLike | null | undefined, iteratee?: ValueIteratee): Record; +declare function countBy(collection: T | null | undefined, iteratee?: ValueIteratee): Record; + +export { countBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/countBy.js b/node_modules/es-toolkit/dist/compat/array/countBy.js new file mode 100644 index 0000000000000000000000000000000000000000..63a6b1be72c91e17bf79078e9cffed24cf107287 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLike = require('../predicate/isArrayLike.js'); +const iteratee = require('../util/iteratee.js'); + +function countBy(collection, iteratee$1) { + if (collection == null) { + return {}; + } + const array = isArrayLike.isArrayLike(collection) ? Array.from(collection) : Object.values(collection); + const mapper = iteratee.iteratee(iteratee$1 ?? undefined); + const result = Object.create(null); + for (let i = 0; i < array.length; i++) { + const item = array[i]; + const key = mapper(item); + result[key] = (result[key] ?? 0) + 1; + } + return result; +} + +exports.countBy = countBy; diff --git a/node_modules/es-toolkit/dist/compat/array/countBy.mjs b/node_modules/es-toolkit/dist/compat/array/countBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a2b8a7ce33cea4980d37bb601f33dc9d2e894a93 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.mjs @@ -0,0 +1,19 @@ +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function countBy(collection, iteratee$1) { + if (collection == null) { + return {}; + } + const array = isArrayLike(collection) ? Array.from(collection) : Object.values(collection); + const mapper = iteratee(iteratee$1 ?? undefined); + const result = Object.create(null); + for (let i = 0; i < array.length; i++) { + const item = array[i]; + const key = mapper(item); + result[key] = (result[key] ?? 0) + 1; + } + return result; +} + +export { countBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/difference.d.mts b/node_modules/es-toolkit/dist/compat/array/difference.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fa930875c6273611fd6b715e14dfd44b28117697 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.d.mts @@ -0,0 +1,28 @@ +/** + * Computes the difference between an array and multiple arrays. + * + * @template T + * @param {ArrayLike | undefined | null} arr - The primary array from which to derive the difference. This is the main array + * from which elements will be compared and filtered. + * @param {Array>} values - Multiple arrays containing elements to be excluded from the primary array. + * These arrays will be flattened into a single array, and each element in this array will be checked against the primary array. + * If a match is found, that element will be excluded from the result. + * @returns {T[]} A new array containing the elements that are present in the primary array but not + * in the flattened array. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [2, 4]; + * const array3 = [5, 6]; + * const result = difference(array1, array2, array3); + * // result will be [1, 3] since 2, 4, and 5 are in the other arrays and are excluded from the result. + * + * @example + * const arrayLike1 = { 0: 1, 1: 2, 2: 3, length: 3 }; + * const arrayLike2 = { 0: 2, 1: 4, length: 2 }; + * const result = difference(arrayLike1, arrayLike2); + * // result will be [1, 3] since 2 is in both array-like objects and is excluded from the result. + */ +declare function difference(arr: ArrayLike | undefined | null, ...values: Array>): T[]; + +export { difference }; diff --git a/node_modules/es-toolkit/dist/compat/array/difference.d.ts b/node_modules/es-toolkit/dist/compat/array/difference.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fa930875c6273611fd6b715e14dfd44b28117697 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.d.ts @@ -0,0 +1,28 @@ +/** + * Computes the difference between an array and multiple arrays. + * + * @template T + * @param {ArrayLike | undefined | null} arr - The primary array from which to derive the difference. This is the main array + * from which elements will be compared and filtered. + * @param {Array>} values - Multiple arrays containing elements to be excluded from the primary array. + * These arrays will be flattened into a single array, and each element in this array will be checked against the primary array. + * If a match is found, that element will be excluded from the result. + * @returns {T[]} A new array containing the elements that are present in the primary array but not + * in the flattened array. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [2, 4]; + * const array3 = [5, 6]; + * const result = difference(array1, array2, array3); + * // result will be [1, 3] since 2, 4, and 5 are in the other arrays and are excluded from the result. + * + * @example + * const arrayLike1 = { 0: 1, 1: 2, 2: 3, length: 3 }; + * const arrayLike2 = { 0: 2, 1: 4, length: 2 }; + * const result = difference(arrayLike1, arrayLike2); + * // result will be [1, 3] since 2 is in both array-like objects and is excluded from the result. + */ +declare function difference(arr: ArrayLike | undefined | null, ...values: Array>): T[]; + +export { difference }; diff --git a/node_modules/es-toolkit/dist/compat/array/difference.js b/node_modules/es-toolkit/dist/compat/array/difference.js new file mode 100644 index 0000000000000000000000000000000000000000..daa965eac376314a6319f015a29881b05c0d24b1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const difference$1 = require('../../array/difference.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function difference(arr, ...values) { + if (!isArrayLikeObject.isArrayLikeObject(arr)) { + return []; + } + const arr1 = toArray.toArray(arr); + const arr2 = []; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (isArrayLikeObject.isArrayLikeObject(value)) { + arr2.push(...Array.from(value)); + } + } + return difference$1.difference(arr1, arr2); +} + +exports.difference = difference; diff --git a/node_modules/es-toolkit/dist/compat/array/difference.mjs b/node_modules/es-toolkit/dist/compat/array/difference.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ef43c249c753b0dfb1a3575f648ca2c689d0a77f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.mjs @@ -0,0 +1,20 @@ +import { difference as difference$1 } from '../../array/difference.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function difference(arr, ...values) { + if (!isArrayLikeObject(arr)) { + return []; + } + const arr1 = toArray(arr); + const arr2 = []; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (isArrayLikeObject(value)) { + arr2.push(...Array.from(value)); + } + } + return difference$1(arr1, arr2); +} + +export { difference }; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceBy.d.mts b/node_modules/es-toolkit/dist/compat/array/differenceBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c2a1a1ca3eaf929d0fe35b6ca357d37cd25bfc32 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.d.mts @@ -0,0 +1,108 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values The values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor) + * // => [1.2] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2], [2.3], [1.4], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5], [2.3], [1.4], [3.2], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4, T5 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ArrayLike} values4 The fourth array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5, 4.8], [2.3], [1.4], [3.2], [4.1], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, values4: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4, T5, T6 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ArrayLike} values4 The fourth array of values to exclude + * @param {ArrayLike} values5 The fifth array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5, 4.8, 5.3], [2.3], [1.4], [3.2], [4.1], [5.8], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, values4: ArrayLike, values5: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4, T5, T6, T7 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ArrayLike} values4 The fourth array of values to exclude + * @param {ArrayLike} values5 The fifth array of values to exclude + * @param {...(ArrayLike | ValueIteratee)[]} values Additional arrays of values to exclude and iteratee + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5, 4.8, 5.3, 6.7], [2.3], [1.4], [3.2], [4.1], [5.8], [6.2], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, values4: ArrayLike, values5: ArrayLike, ...values: Array | ValueIteratee>): T1[]; +/** + * Creates an array of array values not included in the other given arrays. + * + * @template T + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {...Array>} values The arrays of values to exclude + * @returns {T[]} Returns the new array of filtered values + * @example + * differenceBy([2, 1], [2, 3]) + * // => [1] + */ +declare function differenceBy(array: ArrayLike | null | undefined, ...values: Array>): T[]; + +export { differenceBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceBy.d.ts b/node_modules/es-toolkit/dist/compat/array/differenceBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..773fbf75f3de1cb1cc0472b56f81ee0182d2c2cc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.d.ts @@ -0,0 +1,108 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values The values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor) + * // => [1.2] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2], [2.3], [1.4], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5], [2.3], [1.4], [3.2], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4, T5 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ArrayLike} values4 The fourth array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5, 4.8], [2.3], [1.4], [3.2], [4.1], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, values4: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4, T5, T6 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ArrayLike} values4 The fourth array of values to exclude + * @param {ArrayLike} values5 The fifth array of values to exclude + * @param {ValueIteratee} iteratee The iteratee invoked per element + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5, 4.8, 5.3], [2.3], [1.4], [3.2], [4.1], [5.8], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, values4: ArrayLike, values5: ArrayLike, iteratee: ValueIteratee): T1[]; +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2, T3, T4, T5, T6, T7 + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {ArrayLike} values1 The first array of values to exclude + * @param {ArrayLike} values2 The second array of values to exclude + * @param {ArrayLike} values3 The third array of values to exclude + * @param {ArrayLike} values4 The fourth array of values to exclude + * @param {ArrayLike} values5 The fifth array of values to exclude + * @param {...(ArrayLike | ValueIteratee)[]} values Additional arrays of values to exclude and iteratee + * @returns {T1[]} Returns the new array of filtered values + * @example + * differenceBy([2.1, 1.2, 3.5, 4.8, 5.3, 6.7], [2.3], [1.4], [3.2], [4.1], [5.8], [6.2], Math.floor) + * // => [] + */ +declare function differenceBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, values3: ArrayLike, values4: ArrayLike, values5: ArrayLike, ...values: Array | ValueIteratee>): T1[]; +/** + * Creates an array of array values not included in the other given arrays. + * + * @template T + * @param {ArrayLike | null | undefined} array The array to inspect + * @param {...Array>} values The arrays of values to exclude + * @returns {T[]} Returns the new array of filtered values + * @example + * differenceBy([2, 1], [2, 3]) + * // => [1] + */ +declare function differenceBy(array: ArrayLike | null | undefined, ...values: Array>): T[]; + +export { differenceBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceBy.js b/node_modules/es-toolkit/dist/compat/array/differenceBy.js new file mode 100644 index 0000000000000000000000000000000000000000..8f9f57ef82ad081dffd3a1e514c196575021ab7d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const last = require('./last.js'); +const difference = require('../../array/difference.js'); +const differenceBy$1 = require('../../array/differenceBy.js'); +const flattenArrayLike = require('../_internal/flattenArrayLike.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const iteratee = require('../util/iteratee.js'); + +function differenceBy(arr, ..._values) { + if (!isArrayLikeObject.isArrayLikeObject(arr)) { + return []; + } + const iteratee$1 = last.last(_values); + const values = flattenArrayLike.flattenArrayLike(_values); + if (isArrayLikeObject.isArrayLikeObject(iteratee$1)) { + return difference.difference(Array.from(arr), values); + } + return differenceBy$1.differenceBy(Array.from(arr), values, iteratee.iteratee(iteratee$1)); +} + +exports.differenceBy = differenceBy; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceBy.mjs b/node_modules/es-toolkit/dist/compat/array/differenceBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e69b8a517f486640031a489c5d01376eb68b2d91 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.mjs @@ -0,0 +1,20 @@ +import { last } from './last.mjs'; +import { difference } from '../../array/difference.mjs'; +import { differenceBy as differenceBy$1 } from '../../array/differenceBy.mjs'; +import { flattenArrayLike } from '../_internal/flattenArrayLike.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function differenceBy(arr, ..._values) { + if (!isArrayLikeObject(arr)) { + return []; + } + const iteratee$1 = last(_values); + const values = flattenArrayLike(_values); + if (isArrayLikeObject(iteratee$1)) { + return difference(Array.from(arr), values); + } + return differenceBy$1(Array.from(arr), values, iteratee(iteratee$1)); +} + +export { differenceBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceWith.d.mts b/node_modules/es-toolkit/dist/compat/array/differenceWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..952d84f52bd3b67e110e474fbb422c0d89119912 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.d.mts @@ -0,0 +1,91 @@ +/** + * Computes the difference between the primary array and another array using a comparator function. + * + * @template T1, T2 + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {ArrayLike} values - The array containing elements to compare with the primary array. + * @param {(a: T1, b: T2) => boolean} comparator - A function to determine if two elements are considered equal. + * @returns {T1[]} A new array containing the elements from the primary array that do not match any elements in `values` based on the comparator. + * + * @example + * const array = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const values = [{ id: 2 }]; + * const comparator = (a, b) => a.id === b.id; + * + * const result = differenceWith(array, values, comparator); + * // result will be [{ id: 1 }, { id: 3 }] + */ +declare function differenceWith(array: ArrayLike | null | undefined, values: ArrayLike, comparator: (a: T1, b: T2) => boolean): T1[]; +/** + * Computes the difference between the primary array and two arrays using a comparator function. + * + * @template T1, T2, T3 + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {ArrayLike} values1 - The first array containing elements to compare with the primary array. + * @param {ArrayLike} values2 - The second array containing elements to compare with the primary array. + * @param {(a: T1, b: T2 | T3) => boolean} comparator - A function to determine if two elements are considered equal. + * @returns {T1[]} A new array containing the elements from the primary array that do not match any elements in `values1` or `values2` based on the comparator. + * + * @example + * const array = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const values1 = [{ id: 2 }]; + * const values2 = [{ id: 3 }]; + * const comparator = (a, b) => a.id === b.id; + * + * const result = differenceWith(array, values1, values2, comparator); + * // result will be [{ id: 1 }] + */ +declare function differenceWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, comparator: (a: T1, b: T2 | T3) => boolean): T1[]; +/** + * Computes the difference between the primary array and multiple arrays using a comparator function. + * + * @template T1, T2, T3, T4 + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {ArrayLike} values1 - The first array containing elements to compare with the primary array. + * @param {ArrayLike} values2 - The second array containing elements to compare with the primary array. + * @param {...Array | ((a: T1, b: T2 | T3 | T4) => boolean)>} values - Additional arrays and an optional comparator function to determine if two elements are considered equal. + * @returns {T1[]} A new array containing the elements from the primary array that do not match any elements + * in `values1`, `values2`, or subsequent arrays. If a comparator function is provided, it will be used to compare elements; + * otherwise, [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero) algorithm will be used. + * + * @example + * // Example with comparator function + * const array = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }]; + * const values1 = [{ id: 2 }]; + * const values2 = [{ id: 3 }]; + * const values3 = [{ id: 4 }]; + * const comparator = (a, b) => a.id === b.id; + * + * const result = differenceWith(array, values1, values2, values3, comparator); + * // result will be [{ id: 1 }] + * + * @example + * // Example without comparator function (behaves like `difference`) + * const array = [1, 2, 3, 4]; + * const values1 = [2]; + * const values2 = [3]; + * const values3 = [4]; + * + * const result = differenceWith(array, values1, values2, values3); + * // result will be [1] + */ +declare function differenceWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, ...values: Array | ((a: T1, b: T2 | T3 | T4) => boolean)>): T1[]; +/** + * Computes the difference between the primary array and one or more arrays without using a comparator function. + * + * @template T + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {...Array>} values - One or more arrays containing elements to compare with the primary array. + * @returns {T[]} A new array containing the elements from the primary array that do not match any elements in the provided arrays. + * + * @example + * const array = [1, 2, 3]; + * const values1 = [2]; + * const values2 = [3]; + * + * const result = differenceWith(array, values1, values2); + * // result will be [1] + */ +declare function differenceWith(array: ArrayLike | null | undefined, ...values: Array>): T[]; + +export { differenceWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceWith.d.ts b/node_modules/es-toolkit/dist/compat/array/differenceWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..952d84f52bd3b67e110e474fbb422c0d89119912 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.d.ts @@ -0,0 +1,91 @@ +/** + * Computes the difference between the primary array and another array using a comparator function. + * + * @template T1, T2 + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {ArrayLike} values - The array containing elements to compare with the primary array. + * @param {(a: T1, b: T2) => boolean} comparator - A function to determine if two elements are considered equal. + * @returns {T1[]} A new array containing the elements from the primary array that do not match any elements in `values` based on the comparator. + * + * @example + * const array = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const values = [{ id: 2 }]; + * const comparator = (a, b) => a.id === b.id; + * + * const result = differenceWith(array, values, comparator); + * // result will be [{ id: 1 }, { id: 3 }] + */ +declare function differenceWith(array: ArrayLike | null | undefined, values: ArrayLike, comparator: (a: T1, b: T2) => boolean): T1[]; +/** + * Computes the difference between the primary array and two arrays using a comparator function. + * + * @template T1, T2, T3 + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {ArrayLike} values1 - The first array containing elements to compare with the primary array. + * @param {ArrayLike} values2 - The second array containing elements to compare with the primary array. + * @param {(a: T1, b: T2 | T3) => boolean} comparator - A function to determine if two elements are considered equal. + * @returns {T1[]} A new array containing the elements from the primary array that do not match any elements in `values1` or `values2` based on the comparator. + * + * @example + * const array = [{ id: 1 }, { id: 2 }, { id: 3 }]; + * const values1 = [{ id: 2 }]; + * const values2 = [{ id: 3 }]; + * const comparator = (a, b) => a.id === b.id; + * + * const result = differenceWith(array, values1, values2, comparator); + * // result will be [{ id: 1 }] + */ +declare function differenceWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, comparator: (a: T1, b: T2 | T3) => boolean): T1[]; +/** + * Computes the difference between the primary array and multiple arrays using a comparator function. + * + * @template T1, T2, T3, T4 + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {ArrayLike} values1 - The first array containing elements to compare with the primary array. + * @param {ArrayLike} values2 - The second array containing elements to compare with the primary array. + * @param {...Array | ((a: T1, b: T2 | T3 | T4) => boolean)>} values - Additional arrays and an optional comparator function to determine if two elements are considered equal. + * @returns {T1[]} A new array containing the elements from the primary array that do not match any elements + * in `values1`, `values2`, or subsequent arrays. If a comparator function is provided, it will be used to compare elements; + * otherwise, [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero) algorithm will be used. + * + * @example + * // Example with comparator function + * const array = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }]; + * const values1 = [{ id: 2 }]; + * const values2 = [{ id: 3 }]; + * const values3 = [{ id: 4 }]; + * const comparator = (a, b) => a.id === b.id; + * + * const result = differenceWith(array, values1, values2, values3, comparator); + * // result will be [{ id: 1 }] + * + * @example + * // Example without comparator function (behaves like `difference`) + * const array = [1, 2, 3, 4]; + * const values1 = [2]; + * const values2 = [3]; + * const values3 = [4]; + * + * const result = differenceWith(array, values1, values2, values3); + * // result will be [1] + */ +declare function differenceWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, ...values: Array | ((a: T1, b: T2 | T3 | T4) => boolean)>): T1[]; +/** + * Computes the difference between the primary array and one or more arrays without using a comparator function. + * + * @template T + * @param {ArrayLike | null | undefined} array - The primary array to compare elements against. + * @param {...Array>} values - One or more arrays containing elements to compare with the primary array. + * @returns {T[]} A new array containing the elements from the primary array that do not match any elements in the provided arrays. + * + * @example + * const array = [1, 2, 3]; + * const values1 = [2]; + * const values2 = [3]; + * + * const result = differenceWith(array, values1, values2); + * // result will be [1] + */ +declare function differenceWith(array: ArrayLike | null | undefined, ...values: Array>): T[]; + +export { differenceWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceWith.js b/node_modules/es-toolkit/dist/compat/array/differenceWith.js new file mode 100644 index 0000000000000000000000000000000000000000..2ce5799dd53afa12b124205de332326f8b0dc39f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const last = require('./last.js'); +const difference = require('../../array/difference.js'); +const differenceWith$1 = require('../../array/differenceWith.js'); +const flattenArrayLike = require('../_internal/flattenArrayLike.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function differenceWith(array, ...values) { + if (!isArrayLikeObject.isArrayLikeObject(array)) { + return []; + } + const comparator = last.last(values); + const flattenedValues = flattenArrayLike.flattenArrayLike(values); + if (typeof comparator === 'function') { + return differenceWith$1.differenceWith(Array.from(array), flattenedValues, comparator); + } + return difference.difference(Array.from(array), flattenedValues); +} + +exports.differenceWith = differenceWith; diff --git a/node_modules/es-toolkit/dist/compat/array/differenceWith.mjs b/node_modules/es-toolkit/dist/compat/array/differenceWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c0ebece7a993ea1c277a70701f7c1bae164a00a2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.mjs @@ -0,0 +1,19 @@ +import { last } from './last.mjs'; +import { difference } from '../../array/difference.mjs'; +import { differenceWith as differenceWith$1 } from '../../array/differenceWith.mjs'; +import { flattenArrayLike } from '../_internal/flattenArrayLike.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function differenceWith(array, ...values) { + if (!isArrayLikeObject(array)) { + return []; + } + const comparator = last(values); + const flattenedValues = flattenArrayLike(values); + if (typeof comparator === 'function') { + return differenceWith$1(Array.from(array), flattenedValues, comparator); + } + return difference(Array.from(array), flattenedValues); +} + +export { differenceWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/drop.d.mts b/node_modules/es-toolkit/dist/compat/array/drop.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8c2ebc3ee757513b8446d673a1a3b31574cb4fa9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.d.mts @@ -0,0 +1,20 @@ +/** + * Removes a specified number of elements from the beginning of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the start. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} collection - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the beginning of the array. + * @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. + * @returns {T[]} A new array with the specified number of elements removed from the start. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = drop(array, 2); + * result will be [3, 4, 5] since the first two elements are dropped. + */ +declare function drop(array: ArrayLike | null | undefined, n?: number): T[]; + +export { drop }; diff --git a/node_modules/es-toolkit/dist/compat/array/drop.d.ts b/node_modules/es-toolkit/dist/compat/array/drop.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c2ebc3ee757513b8446d673a1a3b31574cb4fa9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.d.ts @@ -0,0 +1,20 @@ +/** + * Removes a specified number of elements from the beginning of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the start. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} collection - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the beginning of the array. + * @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. + * @returns {T[]} A new array with the specified number of elements removed from the start. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = drop(array, 2); + * result will be [3, 4, 5] since the first two elements are dropped. + */ +declare function drop(array: ArrayLike | null | undefined, n?: number): T[]; + +export { drop }; diff --git a/node_modules/es-toolkit/dist/compat/array/drop.js b/node_modules/es-toolkit/dist/compat/array/drop.js new file mode 100644 index 0000000000000000000000000000000000000000..a7fb13f06cf5171400939b594c055366c4838edc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const drop$1 = require('../../array/drop.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const toInteger = require('../util/toInteger.js'); + +function drop(collection, itemsCount = 1, guard) { + if (!isArrayLike.isArrayLike(collection)) { + return []; + } + itemsCount = guard ? 1 : toInteger.toInteger(itemsCount); + return drop$1.drop(toArray.toArray(collection), itemsCount); +} + +exports.drop = drop; diff --git a/node_modules/es-toolkit/dist/compat/array/drop.mjs b/node_modules/es-toolkit/dist/compat/array/drop.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6443ac7bbec1849a039c66af0a602c6472e5f944 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.mjs @@ -0,0 +1,14 @@ +import { drop as drop$1 } from '../../array/drop.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function drop(collection, itemsCount = 1, guard) { + if (!isArrayLike(collection)) { + return []; + } + itemsCount = guard ? 1 : toInteger(itemsCount); + return drop$1(toArray(collection), itemsCount); +} + +export { drop }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRight.d.mts b/node_modules/es-toolkit/dist/compat/array/dropRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7f2a126f13068aba6d999bc73d8803b166f92729 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.d.mts @@ -0,0 +1,20 @@ +/** + * Removes a specified number of elements from the end of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the end. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} collection - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the end of the array. + * @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. + * @returns {T[]} A new array with the specified number of elements removed from the end. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropRight(array, 2); + * // result will be [1, 2, 3] since the last two elements are dropped. + */ +declare function dropRight(array: ArrayLike | null | undefined, n?: number): T[]; + +export { dropRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRight.d.ts b/node_modules/es-toolkit/dist/compat/array/dropRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7f2a126f13068aba6d999bc73d8803b166f92729 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.d.ts @@ -0,0 +1,20 @@ +/** + * Removes a specified number of elements from the end of an array and returns the rest. + * + * This function takes an array and a number, and returns a new array with the specified number + * of elements removed from the end. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} collection - The array from which to drop elements. + * @param {number} itemsCount - The number of elements to drop from the end of the array. + * @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. + * @returns {T[]} A new array with the specified number of elements removed from the end. + * + * @example + * const array = [1, 2, 3, 4, 5]; + * const result = dropRight(array, 2); + * // result will be [1, 2, 3] since the last two elements are dropped. + */ +declare function dropRight(array: ArrayLike | null | undefined, n?: number): T[]; + +export { dropRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRight.js b/node_modules/es-toolkit/dist/compat/array/dropRight.js new file mode 100644 index 0000000000000000000000000000000000000000..bd3396e129021664fef6f564b6e869a7fc313be2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const dropRight$1 = require('../../array/dropRight.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const toInteger = require('../util/toInteger.js'); + +function dropRight(collection, itemsCount = 1, guard) { + if (!isArrayLike.isArrayLike(collection)) { + return []; + } + itemsCount = guard ? 1 : toInteger.toInteger(itemsCount); + return dropRight$1.dropRight(toArray.toArray(collection), itemsCount); +} + +exports.dropRight = dropRight; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRight.mjs b/node_modules/es-toolkit/dist/compat/array/dropRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dd93fd2e07bd2ae6126c4f3c376fa3b9ee7056c8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.mjs @@ -0,0 +1,14 @@ +import { dropRight as dropRight$1 } from '../../array/dropRight.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function dropRight(collection, itemsCount = 1, guard) { + if (!isArrayLike(collection)) { + return []; + } + itemsCount = guard ? 1 : toInteger(itemsCount); + return dropRight$1(toArray(collection), itemsCount); +} + +export { dropRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.mts b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..54046fdf21aa40e8f17674d7036a215da69313e3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.mts @@ -0,0 +1,37 @@ +import { ListIteratee } from '../_internal/ListIteratee.mjs'; + +/** + * Creates a slice of array excluding elements dropped from the end until predicate returns falsey. + * The predicate is invoked with three arguments: (value, index, array). + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * @example + * + * const users = [ + * { user: 'barney', active: true }, + * { user: 'fred', active: false }, + * { user: 'pebbles', active: false } + * ]; + * + * // Using function predicate + * dropRightWhile(users, user => !user.active); + * // => [{ user: 'barney', active: true }] + * + * // Using matches shorthand + * dropRightWhile(users, { user: 'pebbles', active: false }); + * // => [{ user: 'barney', active: true }, { user: 'fred', active: false }] + * + * // Using matchesProperty shorthand + * dropRightWhile(users, ['active', false]); + * // => [{ user: 'barney', active: true }] + * + * // Using property shorthand + * dropRightWhile(users, 'active'); + * // => [{ user: 'barney', active: true }] + */ +declare function dropRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { dropRightWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.ts b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee40728d435e256c5cb417f76dc7c514d206bb95 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.ts @@ -0,0 +1,37 @@ +import { ListIteratee } from '../_internal/ListIteratee.js'; + +/** + * Creates a slice of array excluding elements dropped from the end until predicate returns falsey. + * The predicate is invoked with three arguments: (value, index, array). + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * @example + * + * const users = [ + * { user: 'barney', active: true }, + * { user: 'fred', active: false }, + * { user: 'pebbles', active: false } + * ]; + * + * // Using function predicate + * dropRightWhile(users, user => !user.active); + * // => [{ user: 'barney', active: true }] + * + * // Using matches shorthand + * dropRightWhile(users, { user: 'pebbles', active: false }); + * // => [{ user: 'barney', active: true }, { user: 'fred', active: false }] + * + * // Using matchesProperty shorthand + * dropRightWhile(users, ['active', false]); + * // => [{ user: 'barney', active: true }] + * + * // Using property shorthand + * dropRightWhile(users, 'active'); + * // => [{ user: 'barney', active: true }] + */ +declare function dropRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { dropRightWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRightWhile.js b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..99f5b700d2e5e824a66765871703e38d387711c9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const dropRightWhile$1 = require('../../array/dropRightWhile.js'); +const identity = require('../../function/identity.js'); +const property = require('../object/property.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const matches = require('../predicate/matches.js'); +const matchesProperty = require('../predicate/matchesProperty.js'); + +function dropRightWhile(arr, predicate = identity.identity) { + if (!isArrayLike.isArrayLike(arr)) { + return []; + } + return dropRightWhileImpl(Array.from(arr), predicate); +} +function dropRightWhileImpl(arr, predicate) { + switch (typeof predicate) { + case 'function': { + return dropRightWhile$1.dropRightWhile(arr, (item, index, arr) => Boolean(predicate(item, index, arr))); + } + case 'object': { + if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + return dropRightWhile$1.dropRightWhile(arr, matchesProperty.matchesProperty(key, value)); + } + else { + return dropRightWhile$1.dropRightWhile(arr, matches.matches(predicate)); + } + } + case 'symbol': + case 'number': + case 'string': { + return dropRightWhile$1.dropRightWhile(arr, property.property(predicate)); + } + } +} + +exports.dropRightWhile = dropRightWhile; diff --git a/node_modules/es-toolkit/dist/compat/array/dropRightWhile.mjs b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2b3dd23b0f7cbc9df2063f1793825e4462a5f239 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.mjs @@ -0,0 +1,37 @@ +import { dropRightWhile as dropRightWhile$1 } from '../../array/dropRightWhile.mjs'; +import { identity } from '../../function/identity.mjs'; +import { property } from '../object/property.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { matches } from '../predicate/matches.mjs'; +import { matchesProperty } from '../predicate/matchesProperty.mjs'; + +function dropRightWhile(arr, predicate = identity) { + if (!isArrayLike(arr)) { + return []; + } + return dropRightWhileImpl(Array.from(arr), predicate); +} +function dropRightWhileImpl(arr, predicate) { + switch (typeof predicate) { + case 'function': { + return dropRightWhile$1(arr, (item, index, arr) => Boolean(predicate(item, index, arr))); + } + case 'object': { + if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + return dropRightWhile$1(arr, matchesProperty(key, value)); + } + else { + return dropRightWhile$1(arr, matches(predicate)); + } + } + case 'symbol': + case 'number': + case 'string': { + return dropRightWhile$1(arr, property(predicate)); + } + } +} + +export { dropRightWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropWhile.d.mts b/node_modules/es-toolkit/dist/compat/array/dropWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0e3c0a631fdbef53c7e76a471ad25c457389ffec --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.d.mts @@ -0,0 +1,28 @@ +import { ListIteratee } from '../_internal/ListIteratee.mjs'; + +/** + * Creates a slice of array excluding elements dropped from the beginning. + * Elements are dropped until predicate returns falsey. + * The predicate is invoked with three arguments: (value, index, array). + * + * @template T - The type of elements in the array + * @param {ArrayLike | null | undefined} arr - The array to query + * @param {ListIteratee} [predicate=identity] - The function invoked per iteration + * @returns {T[]} Returns the slice of array + * + * @example + * dropWhile([1, 2, 3], n => n < 3) + * // => [3] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], { a: 1 }) + * // => [{ a: 1, b: 3 }] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], ['a', 1]) + * // => [{ a: 1, b: 3 }] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], 'a') + * // => [] + */ +declare function dropWhile(arr: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { dropWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropWhile.d.ts b/node_modules/es-toolkit/dist/compat/array/dropWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ace427d3d4a1ecc85751584df663638b7964cae --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.d.ts @@ -0,0 +1,28 @@ +import { ListIteratee } from '../_internal/ListIteratee.js'; + +/** + * Creates a slice of array excluding elements dropped from the beginning. + * Elements are dropped until predicate returns falsey. + * The predicate is invoked with three arguments: (value, index, array). + * + * @template T - The type of elements in the array + * @param {ArrayLike | null | undefined} arr - The array to query + * @param {ListIteratee} [predicate=identity] - The function invoked per iteration + * @returns {T[]} Returns the slice of array + * + * @example + * dropWhile([1, 2, 3], n => n < 3) + * // => [3] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], { a: 1 }) + * // => [{ a: 1, b: 3 }] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], ['a', 1]) + * // => [{ a: 1, b: 3 }] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], 'a') + * // => [] + */ +declare function dropWhile(arr: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { dropWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/dropWhile.js b/node_modules/es-toolkit/dist/compat/array/dropWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..50462310c7ea47044b8d40f065e3d00b94801de2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const dropWhile$1 = require('../../array/dropWhile.js'); +const identity = require('../../function/identity.js'); +const toArray = require('../_internal/toArray.js'); +const property = require('../object/property.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const matches = require('../predicate/matches.js'); +const matchesProperty = require('../predicate/matchesProperty.js'); + +function dropWhile(arr, predicate = identity.identity) { + if (!isArrayLike.isArrayLike(arr)) { + return []; + } + return dropWhileImpl(toArray.toArray(arr), predicate); +} +function dropWhileImpl(arr, predicate) { + switch (typeof predicate) { + case 'function': { + return dropWhile$1.dropWhile(arr, (item, index, arr) => Boolean(predicate(item, index, arr))); + } + case 'object': { + if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + return dropWhile$1.dropWhile(arr, matchesProperty.matchesProperty(key, value)); + } + else { + return dropWhile$1.dropWhile(arr, matches.matches(predicate)); + } + } + case 'number': + case 'symbol': + case 'string': { + return dropWhile$1.dropWhile(arr, property.property(predicate)); + } + } +} + +exports.dropWhile = dropWhile; diff --git a/node_modules/es-toolkit/dist/compat/array/dropWhile.mjs b/node_modules/es-toolkit/dist/compat/array/dropWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e06f83cf48668a89799f9eac47f3168410706367 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.mjs @@ -0,0 +1,38 @@ +import { dropWhile as dropWhile$1 } from '../../array/dropWhile.mjs'; +import { identity } from '../../function/identity.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { property } from '../object/property.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { matches } from '../predicate/matches.mjs'; +import { matchesProperty } from '../predicate/matchesProperty.mjs'; + +function dropWhile(arr, predicate = identity) { + if (!isArrayLike(arr)) { + return []; + } + return dropWhileImpl(toArray(arr), predicate); +} +function dropWhileImpl(arr, predicate) { + switch (typeof predicate) { + case 'function': { + return dropWhile$1(arr, (item, index, arr) => Boolean(predicate(item, index, arr))); + } + case 'object': { + if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + return dropWhile$1(arr, matchesProperty(key, value)); + } + else { + return dropWhile$1(arr, matches(predicate)); + } + } + case 'number': + case 'symbol': + case 'string': { + return dropWhile$1(arr, property(predicate)); + } + } +} + +export { dropWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/every.d.mts b/node_modules/es-toolkit/dist/compat/array/every.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..039a7a03ef69a678009df2408c5655795e09dcaa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.d.mts @@ -0,0 +1,64 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.mjs'; + +/** + * Checks if all elements in a collection pass the predicate check. + * The predicate is invoked with three arguments: (value, index|key, collection). + * + * @template T - The type of elements in the collection + * @param {ArrayLike | null | undefined} collection - The collection to iterate over + * @param {ListIterateeCustom} [predicate=identity] - The function invoked per iteration + * @returns {boolean} Returns true if all elements pass the predicate check, else false + * + * @example + * // Using a function predicate + * every([true, 1, null, 'yes'], Boolean) + * // => false + * + * // Using property shorthand + * const users = [{ user: 'barney', age: 36 }, { user: 'fred', age: 40 }] + * every(users, 'age') + * // => true + * + * // Using matches shorthand + * every(users, { age: 36 }) + * // => false + * + * // Using matchesProperty shorthand + * every(users, ['age', 36]) + * // => false + */ +declare function every(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): boolean; +/** + * Checks if all elements in an object pass the predicate check. + * The predicate is invoked with three arguments: (value, key, object). + * + * @template T - The type of the object + * @param {T | null | undefined} collection - The object to iterate over + * @param {ObjectIterateeCustom} [predicate=identity] - The function invoked per iteration + * @returns {boolean} Returns true if all elements pass the predicate check, else false + * + * @example + * // Using a function predicate + * every({ a: true, b: 1, c: null }, Boolean) + * // => false + * + * // Using property shorthand + * const users = { + * barney: { active: true, age: 36 }, + * fred: { active: true, age: 40 } + * } + * every(users, 'active') + * // => true + * + * // Using matches shorthand + * every(users, { active: true }) + * // => true + * + * // Using matchesProperty shorthand + * every(users, ['age', 36]) + * // => false + */ +declare function every(collection: T | null | undefined, predicate?: ObjectIterateeCustom): boolean; + +export { every }; diff --git a/node_modules/es-toolkit/dist/compat/array/every.d.ts b/node_modules/es-toolkit/dist/compat/array/every.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..33e941c46c204f440524a9d8a6ce092d499aba80 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.d.ts @@ -0,0 +1,64 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.js'; + +/** + * Checks if all elements in a collection pass the predicate check. + * The predicate is invoked with three arguments: (value, index|key, collection). + * + * @template T - The type of elements in the collection + * @param {ArrayLike | null | undefined} collection - The collection to iterate over + * @param {ListIterateeCustom} [predicate=identity] - The function invoked per iteration + * @returns {boolean} Returns true if all elements pass the predicate check, else false + * + * @example + * // Using a function predicate + * every([true, 1, null, 'yes'], Boolean) + * // => false + * + * // Using property shorthand + * const users = [{ user: 'barney', age: 36 }, { user: 'fred', age: 40 }] + * every(users, 'age') + * // => true + * + * // Using matches shorthand + * every(users, { age: 36 }) + * // => false + * + * // Using matchesProperty shorthand + * every(users, ['age', 36]) + * // => false + */ +declare function every(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): boolean; +/** + * Checks if all elements in an object pass the predicate check. + * The predicate is invoked with three arguments: (value, key, object). + * + * @template T - The type of the object + * @param {T | null | undefined} collection - The object to iterate over + * @param {ObjectIterateeCustom} [predicate=identity] - The function invoked per iteration + * @returns {boolean} Returns true if all elements pass the predicate check, else false + * + * @example + * // Using a function predicate + * every({ a: true, b: 1, c: null }, Boolean) + * // => false + * + * // Using property shorthand + * const users = { + * barney: { active: true, age: 36 }, + * fred: { active: true, age: 40 } + * } + * every(users, 'active') + * // => true + * + * // Using matches shorthand + * every(users, { active: true }) + * // => true + * + * // Using matchesProperty shorthand + * every(users, ['age', 36]) + * // => false + */ +declare function every(collection: T | null | undefined, predicate?: ObjectIterateeCustom): boolean; + +export { every }; diff --git a/node_modules/es-toolkit/dist/compat/array/every.js b/node_modules/es-toolkit/dist/compat/array/every.js new file mode 100644 index 0000000000000000000000000000000000000000..13d99d79d5b08dfd3305fd1c9d45067b4b6acb5a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.js @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const isIterateeCall = require('../_internal/isIterateeCall.js'); +const property = require('../object/property.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const matches = require('../predicate/matches.js'); +const matchesProperty = require('../predicate/matchesProperty.js'); + +function every(source, doesMatch, guard) { + if (!source) { + return true; + } + if (guard && isIterateeCall.isIterateeCall(source, doesMatch, guard)) { + doesMatch = undefined; + } + if (!doesMatch) { + doesMatch = identity.identity; + } + let predicate; + switch (typeof doesMatch) { + case 'function': { + predicate = doesMatch; + break; + } + case 'object': { + if (Array.isArray(doesMatch) && doesMatch.length === 2) { + const key = doesMatch[0]; + const value = doesMatch[1]; + predicate = matchesProperty.matchesProperty(key, value); + } + else { + predicate = matches.matches(doesMatch); + } + break; + } + case 'symbol': + case 'number': + case 'string': { + predicate = property.property(doesMatch); + } + } + if (!isArrayLike.isArrayLike(source)) { + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (!predicate(value, key, source)) { + return false; + } + } + return true; + } + for (let i = 0; i < source.length; i++) { + if (!predicate(source[i], i, source)) { + return false; + } + } + return true; +} + +exports.every = every; diff --git a/node_modules/es-toolkit/dist/compat/array/every.mjs b/node_modules/es-toolkit/dist/compat/array/every.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2b9fd8e8f1280d3a833cbcb80015a17e02cd358d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.mjs @@ -0,0 +1,60 @@ +import { identity } from '../../function/identity.mjs'; +import { isIterateeCall } from '../_internal/isIterateeCall.mjs'; +import { property } from '../object/property.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { matches } from '../predicate/matches.mjs'; +import { matchesProperty } from '../predicate/matchesProperty.mjs'; + +function every(source, doesMatch, guard) { + if (!source) { + return true; + } + if (guard && isIterateeCall(source, doesMatch, guard)) { + doesMatch = undefined; + } + if (!doesMatch) { + doesMatch = identity; + } + let predicate; + switch (typeof doesMatch) { + case 'function': { + predicate = doesMatch; + break; + } + case 'object': { + if (Array.isArray(doesMatch) && doesMatch.length === 2) { + const key = doesMatch[0]; + const value = doesMatch[1]; + predicate = matchesProperty(key, value); + } + else { + predicate = matches(doesMatch); + } + break; + } + case 'symbol': + case 'number': + case 'string': { + predicate = property(doesMatch); + } + } + if (!isArrayLike(source)) { + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (!predicate(value, key, source)) { + return false; + } + } + return true; + } + for (let i = 0; i < source.length; i++) { + if (!predicate(source[i], i, source)) { + return false; + } + } + return true; +} + +export { every }; diff --git a/node_modules/es-toolkit/dist/compat/array/fill.d.mts b/node_modules/es-toolkit/dist/compat/array/fill.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c8e94ca09e0d800caa730ee06dfd8c6e3acd4b9e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.d.mts @@ -0,0 +1,53 @@ +import { MutableList } from '../_internal/MutableList.d.mjs'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.mjs'; + +/** + * Fills an array with a value. + * @template T + * @param {any[] | null | undefined} array - The array to fill + * @param {T} value - The value to fill array with + * @returns {T[]} Returns the filled array + * @example + * fill([1, 2, 3], 'a') + * // => ['a', 'a', 'a'] + */ +declare function fill(array: any[] | null | undefined, value: T): T[]; +/** + * Fills an array-like object with a value. + * @template T, AL + * @param {RejectReadonly | null | undefined} array - The array-like object to fill + * @param {T} value - The value to fill array with + * @returns {ArrayLike} Returns the filled array-like object + * @example + * fill({ length: 3 }, 2) + * // => { 0: 2, 1: 2, 2: 2, length: 3 } + */ +declare function fill>(array: RejectReadonly | null | undefined, value: T): ArrayLike; +/** + * Fills an array with a value from start up to end. + * @template T, U + * @param {U[] | null | undefined} array - The array to fill + * @param {T} value - The value to fill array with + * @param {number} [start=0] - The start position + * @param {number} [end=array.length] - The end position + * @returns {Array} Returns the filled array + * @example + * fill([1, 2, 3], 'a', 1, 2) + * // => [1, 'a', 3] + */ +declare function fill(array: U[] | null | undefined, value: T, start?: number, end?: number): Array; +/** + * Fills an array-like object with a value from start up to end. + * @template T, U + * @param {U extends readonly any[] ? never : U | null | undefined} array - The array-like object to fill + * @param {T} value - The value to fill array with + * @param {number} [start=0] - The start position + * @param {number} [end=array.length] - The end position + * @returns {ArrayLike} Returns the filled array-like object + * @example + * fill({ 0: 1, 1: 2, 2: 3, length: 3 }, 'a', 1, 2) + * // => { 0: 1, 1: 'a', 2: 3, length: 3 } + */ +declare function fill>(array: RejectReadonly | null | undefined, value: T, start?: number, end?: number): ArrayLike; + +export { fill }; diff --git a/node_modules/es-toolkit/dist/compat/array/fill.d.ts b/node_modules/es-toolkit/dist/compat/array/fill.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5835d486021ae28dc3a2d6de88f66dc915cf7603 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.d.ts @@ -0,0 +1,53 @@ +import { MutableList } from '../_internal/MutableList.d.js'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.js'; + +/** + * Fills an array with a value. + * @template T + * @param {any[] | null | undefined} array - The array to fill + * @param {T} value - The value to fill array with + * @returns {T[]} Returns the filled array + * @example + * fill([1, 2, 3], 'a') + * // => ['a', 'a', 'a'] + */ +declare function fill(array: any[] | null | undefined, value: T): T[]; +/** + * Fills an array-like object with a value. + * @template T, AL + * @param {RejectReadonly | null | undefined} array - The array-like object to fill + * @param {T} value - The value to fill array with + * @returns {ArrayLike} Returns the filled array-like object + * @example + * fill({ length: 3 }, 2) + * // => { 0: 2, 1: 2, 2: 2, length: 3 } + */ +declare function fill>(array: RejectReadonly | null | undefined, value: T): ArrayLike; +/** + * Fills an array with a value from start up to end. + * @template T, U + * @param {U[] | null | undefined} array - The array to fill + * @param {T} value - The value to fill array with + * @param {number} [start=0] - The start position + * @param {number} [end=array.length] - The end position + * @returns {Array} Returns the filled array + * @example + * fill([1, 2, 3], 'a', 1, 2) + * // => [1, 'a', 3] + */ +declare function fill(array: U[] | null | undefined, value: T, start?: number, end?: number): Array; +/** + * Fills an array-like object with a value from start up to end. + * @template T, U + * @param {U extends readonly any[] ? never : U | null | undefined} array - The array-like object to fill + * @param {T} value - The value to fill array with + * @param {number} [start=0] - The start position + * @param {number} [end=array.length] - The end position + * @returns {ArrayLike} Returns the filled array-like object + * @example + * fill({ 0: 1, 1: 2, 2: 3, length: 3 }, 'a', 1, 2) + * // => { 0: 1, 1: 'a', 2: 3, length: 3 } + */ +declare function fill>(array: RejectReadonly | null | undefined, value: T, start?: number, end?: number): ArrayLike; + +export { fill }; diff --git a/node_modules/es-toolkit/dist/compat/array/fill.js b/node_modules/es-toolkit/dist/compat/array/fill.js new file mode 100644 index 0000000000000000000000000000000000000000..95711da5e4d2467120583ad7749d5b90feab2bb5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const fill$1 = require('../../array/fill.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const isString = require('../predicate/isString.js'); + +function fill(array, value, start = 0, end = array ? array.length : 0) { + if (!isArrayLike.isArrayLike(array)) { + return []; + } + if (isString.isString(array)) { + return array; + } + start = Math.floor(start); + end = Math.floor(end); + if (!start) { + start = 0; + } + if (!end) { + end = 0; + } + return fill$1.fill(array, value, start, end); +} + +exports.fill = fill; diff --git a/node_modules/es-toolkit/dist/compat/array/fill.mjs b/node_modules/es-toolkit/dist/compat/array/fill.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a145e4e03c41dab7aa0397310f06c300a505f863 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.mjs @@ -0,0 +1,23 @@ +import { fill as fill$1 } from '../../array/fill.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { isString } from '../predicate/isString.mjs'; + +function fill(array, value, start = 0, end = array ? array.length : 0) { + if (!isArrayLike(array)) { + return []; + } + if (isString(array)) { + return array; + } + start = Math.floor(start); + end = Math.floor(end); + if (!start) { + start = 0; + } + if (!end) { + end = 0; + } + return fill$1(array, value, start, end); +} + +export { fill }; diff --git a/node_modules/es-toolkit/dist/compat/array/filter.d.mts b/node_modules/es-toolkit/dist/compat/array/filter.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5ea7530733a04f2a76b6cb49cae7c6ffed1f23d0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.d.mts @@ -0,0 +1,74 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; +import { ListIteratorTypeGuard } from '../_internal/ListIteratorTypeGuard.mjs'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.mjs'; +import { ObjectIteratorTypeGuard } from '../_internal/ObjectIterator.mjs'; +import { StringIterator } from '../_internal/StringIterator.mjs'; + +/** + * Filters characters in a string based on the predicate function. + * + * @param collection - The string to filter + * @param predicate - The function to test each character + * @returns An array of characters that pass the predicate test + * + * @example + * filter('123', char => char === '2') + * // => ['2'] + */ +declare function filter(collection: string | null | undefined, predicate?: StringIterator): string[]; +/** + * Filters elements in an array-like object using a type guard predicate. + * + * @param collection - The array-like object to filter + * @param predicate - The type guard function to test each element + * @returns An array of elements that are of type U + * + * @example + * filter([1, '2', 3], (x): x is number => typeof x === 'number') + * // => [1, 3] + */ +declare function filter(collection: ArrayLike | null | undefined, predicate: ListIteratorTypeGuard): U[]; +/** + * Filters elements in an array-like object based on the predicate. + * + * @param collection - The array-like object to filter + * @param predicate - The function or shorthand to test each element + * @returns An array of elements that pass the predicate test + * + * @example + * filter([1, 2, 3], x => x > 1) + * // => [2, 3] + * + * filter([{ a: 1 }, { a: 2 }], { a: 1 }) + * // => [{ a: 1 }] + */ +declare function filter(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): T[]; +/** + * Filters values in an object using a type guard predicate. + * + * @param collection - The object to filter + * @param predicate - The type guard function to test each value + * @returns An array of values that are of type U + * + * @example + * filter({ a: 1, b: '2', c: 3 }, (x): x is number => typeof x === 'number') + * // => [1, 3] + */ +declare function filter(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard): U[]; +/** + * Filters values in an object based on the predicate. + * + * @param collection - The object to filter + * @param predicate - The function or shorthand to test each value + * @returns An array of values that pass the predicate test + * + * @example + * filter({ a: 1, b: 2 }, x => x > 1) + * // => [2] + * + * filter({ a: { x: 1 }, b: { x: 2 } }, { x: 1 }) + * // => [{ x: 1 }] + */ +declare function filter(collection: T | null | undefined, predicate?: ObjectIterateeCustom): Array; + +export { filter }; diff --git a/node_modules/es-toolkit/dist/compat/array/filter.d.ts b/node_modules/es-toolkit/dist/compat/array/filter.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..79589aae465ccafe8cae8c35cc63959d373c5443 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.d.ts @@ -0,0 +1,74 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; +import { ListIteratorTypeGuard } from '../_internal/ListIteratorTypeGuard.js'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.js'; +import { ObjectIteratorTypeGuard } from '../_internal/ObjectIterator.js'; +import { StringIterator } from '../_internal/StringIterator.js'; + +/** + * Filters characters in a string based on the predicate function. + * + * @param collection - The string to filter + * @param predicate - The function to test each character + * @returns An array of characters that pass the predicate test + * + * @example + * filter('123', char => char === '2') + * // => ['2'] + */ +declare function filter(collection: string | null | undefined, predicate?: StringIterator): string[]; +/** + * Filters elements in an array-like object using a type guard predicate. + * + * @param collection - The array-like object to filter + * @param predicate - The type guard function to test each element + * @returns An array of elements that are of type U + * + * @example + * filter([1, '2', 3], (x): x is number => typeof x === 'number') + * // => [1, 3] + */ +declare function filter(collection: ArrayLike | null | undefined, predicate: ListIteratorTypeGuard): U[]; +/** + * Filters elements in an array-like object based on the predicate. + * + * @param collection - The array-like object to filter + * @param predicate - The function or shorthand to test each element + * @returns An array of elements that pass the predicate test + * + * @example + * filter([1, 2, 3], x => x > 1) + * // => [2, 3] + * + * filter([{ a: 1 }, { a: 2 }], { a: 1 }) + * // => [{ a: 1 }] + */ +declare function filter(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): T[]; +/** + * Filters values in an object using a type guard predicate. + * + * @param collection - The object to filter + * @param predicate - The type guard function to test each value + * @returns An array of values that are of type U + * + * @example + * filter({ a: 1, b: '2', c: 3 }, (x): x is number => typeof x === 'number') + * // => [1, 3] + */ +declare function filter(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard): U[]; +/** + * Filters values in an object based on the predicate. + * + * @param collection - The object to filter + * @param predicate - The function or shorthand to test each value + * @returns An array of values that pass the predicate test + * + * @example + * filter({ a: 1, b: 2 }, x => x > 1) + * // => [2] + * + * filter({ a: { x: 1 }, b: { x: 2 } }, { x: 1 }) + * // => [{ x: 1 }] + */ +declare function filter(collection: T | null | undefined, predicate?: ObjectIterateeCustom): Array; + +export { filter }; diff --git a/node_modules/es-toolkit/dist/compat/array/filter.js b/node_modules/es-toolkit/dist/compat/array/filter.js new file mode 100644 index 0000000000000000000000000000000000000000..5faf6594b9c8a141d236733ebe451c935b36e314 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const iteratee = require('../util/iteratee.js'); + +function filter(source, predicate = identity.identity) { + if (!source) { + return []; + } + predicate = iteratee.iteratee(predicate); + if (!Array.isArray(source)) { + const result = []; + const keys = Object.keys(source); + const length = isArrayLike.isArrayLike(source) ? source.length : keys.length; + for (let i = 0; i < length; i++) { + const key = keys[i]; + const value = source[key]; + if (predicate(value, key, source)) { + result.push(value); + } + } + return result; + } + const result = []; + const length = source.length; + for (let i = 0; i < length; i++) { + const value = source[i]; + if (predicate(value, i, source)) { + result.push(value); + } + } + return result; +} + +exports.filter = filter; diff --git a/node_modules/es-toolkit/dist/compat/array/filter.mjs b/node_modules/es-toolkit/dist/compat/array/filter.mjs new file mode 100644 index 0000000000000000000000000000000000000000..edd149d86c2508fe6db0bb0bca0d27e089be7e60 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.mjs @@ -0,0 +1,34 @@ +import { identity } from '../../function/identity.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function filter(source, predicate = identity) { + if (!source) { + return []; + } + predicate = iteratee(predicate); + if (!Array.isArray(source)) { + const result = []; + const keys = Object.keys(source); + const length = isArrayLike(source) ? source.length : keys.length; + for (let i = 0; i < length; i++) { + const key = keys[i]; + const value = source[key]; + if (predicate(value, key, source)) { + result.push(value); + } + } + return result; + } + const result = []; + const length = source.length; + for (let i = 0; i < length; i++) { + const value = source[i]; + if (predicate(value, i, source)) { + result.push(value); + } + } + return result; +} + +export { filter }; diff --git a/node_modules/es-toolkit/dist/compat/array/find.d.mts b/node_modules/es-toolkit/dist/compat/array/find.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a5f95a9fcba2ba5629ad868d9a1f595a00c41fbe --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.d.mts @@ -0,0 +1,65 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; +import { ListIteratorTypeGuard } from '../_internal/ListIteratorTypeGuard.mjs'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.mjs'; +import { ObjectIteratorTypeGuard } from '../_internal/ObjectIterator.mjs'; + +/** + * Finds the first element in an array-like object that matches a type guard predicate. + * + * @param collection - The array-like object to search + * @param predicate - The type guard function to test each element + * @param fromIndex - The index to start searching from + * @returns The first element that matches the type guard, or undefined if none found + * + * @example + * find([1, '2', 3], (x): x is number => typeof x === 'number') + * // => 1 + */ +declare function find(collection: ArrayLike | null | undefined, predicate: ListIteratorTypeGuard, fromIndex?: number): U | undefined; +/** + * Finds the first element in an array-like object that matches a predicate. + * + * @param collection - The array-like object to search + * @param predicate - The function or shorthand to test each element + * @param fromIndex - The index to start searching from + * @returns The first matching element, or undefined if none found + * + * @example + * find([1, 2, 3], x => x > 2) + * // => 3 + * + * find([{ a: 1 }, { a: 2 }], { a: 2 }) + * // => { a: 2 } + */ +declare function find(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom, fromIndex?: number): T | undefined; +/** + * Finds the first value in an object that matches a type guard predicate. + * + * @param collection - The object to search + * @param predicate - The type guard function to test each value + * @param fromIndex - The index to start searching from + * @returns The first value that matches the type guard, or undefined if none found + * + * @example + * find({ a: 1, b: '2', c: 3 }, (x): x is number => typeof x === 'number') + * // => 1 + */ +declare function find(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard, fromIndex?: number): U | undefined; +/** + * Finds the first value in an object that matches a predicate. + * + * @param collection - The object to search + * @param predicate - The function or shorthand to test each value + * @param fromIndex - The index to start searching from + * @returns The first matching value, or undefined if none found + * + * @example + * find({ a: 1, b: 2 }, x => x > 1) + * // => 2 + * + * find({ a: { x: 1 }, b: { x: 2 } }, { x: 2 }) + * // => { x: 2 } + */ +declare function find(collection: T | null | undefined, predicate?: ObjectIterateeCustom, fromIndex?: number): T[keyof T] | undefined; + +export { find }; diff --git a/node_modules/es-toolkit/dist/compat/array/find.d.ts b/node_modules/es-toolkit/dist/compat/array/find.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b2bd266ba4e597dddbba33c483103c97efb4d3fd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.d.ts @@ -0,0 +1,65 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; +import { ListIteratorTypeGuard } from '../_internal/ListIteratorTypeGuard.js'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.js'; +import { ObjectIteratorTypeGuard } from '../_internal/ObjectIterator.js'; + +/** + * Finds the first element in an array-like object that matches a type guard predicate. + * + * @param collection - The array-like object to search + * @param predicate - The type guard function to test each element + * @param fromIndex - The index to start searching from + * @returns The first element that matches the type guard, or undefined if none found + * + * @example + * find([1, '2', 3], (x): x is number => typeof x === 'number') + * // => 1 + */ +declare function find(collection: ArrayLike | null | undefined, predicate: ListIteratorTypeGuard, fromIndex?: number): U | undefined; +/** + * Finds the first element in an array-like object that matches a predicate. + * + * @param collection - The array-like object to search + * @param predicate - The function or shorthand to test each element + * @param fromIndex - The index to start searching from + * @returns The first matching element, or undefined if none found + * + * @example + * find([1, 2, 3], x => x > 2) + * // => 3 + * + * find([{ a: 1 }, { a: 2 }], { a: 2 }) + * // => { a: 2 } + */ +declare function find(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom, fromIndex?: number): T | undefined; +/** + * Finds the first value in an object that matches a type guard predicate. + * + * @param collection - The object to search + * @param predicate - The type guard function to test each value + * @param fromIndex - The index to start searching from + * @returns The first value that matches the type guard, or undefined if none found + * + * @example + * find({ a: 1, b: '2', c: 3 }, (x): x is number => typeof x === 'number') + * // => 1 + */ +declare function find(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard, fromIndex?: number): U | undefined; +/** + * Finds the first value in an object that matches a predicate. + * + * @param collection - The object to search + * @param predicate - The function or shorthand to test each value + * @param fromIndex - The index to start searching from + * @returns The first matching value, or undefined if none found + * + * @example + * find({ a: 1, b: 2 }, x => x > 1) + * // => 2 + * + * find({ a: { x: 1 }, b: { x: 2 } }, { x: 2 }) + * // => { x: 2 } + */ +declare function find(collection: T | null | undefined, predicate?: ObjectIterateeCustom, fromIndex?: number): T[keyof T] | undefined; + +export { find }; diff --git a/node_modules/es-toolkit/dist/compat/array/find.js b/node_modules/es-toolkit/dist/compat/array/find.js new file mode 100644 index 0000000000000000000000000000000000000000..f756fa7d877f06dd990b55273cb7c5ec7ac6b619 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.js @@ -0,0 +1,30 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const iteratee = require('../util/iteratee.js'); + +function find(source, _doesMatch = identity.identity, fromIndex = 0) { + if (!source) { + return undefined; + } + if (fromIndex < 0) { + fromIndex = Math.max(source.length + fromIndex, 0); + } + const doesMatch = iteratee.iteratee(_doesMatch); + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = fromIndex; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (doesMatch(value, key, source)) { + return value; + } + } + return undefined; + } + return source.slice(fromIndex).find(doesMatch); +} + +exports.find = find; diff --git a/node_modules/es-toolkit/dist/compat/array/find.mjs b/node_modules/es-toolkit/dist/compat/array/find.mjs new file mode 100644 index 0000000000000000000000000000000000000000..eb3314407fd3a813e6001f20a1610636a40d5731 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.mjs @@ -0,0 +1,26 @@ +import { identity } from '../../function/identity.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function find(source, _doesMatch = identity, fromIndex = 0) { + if (!source) { + return undefined; + } + if (fromIndex < 0) { + fromIndex = Math.max(source.length + fromIndex, 0); + } + const doesMatch = iteratee(_doesMatch); + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = fromIndex; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (doesMatch(value, key, source)) { + return value; + } + } + return undefined; + } + return source.slice(fromIndex).find(doesMatch); +} + +export { find }; diff --git a/node_modules/es-toolkit/dist/compat/array/findIndex.d.mts b/node_modules/es-toolkit/dist/compat/array/findIndex.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..69e3aaa26f2cd8b945a2cee53594ab51ab49a85e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.d.mts @@ -0,0 +1,21 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; + +/** + * Finds the index of the first item in an array that has a specific property, where the property name is provided as a PropertyKey. + * + * @template T + * @param {ArrayLike | null | undefined} arr - The array to search through. + * @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} doesMatch - The criteria to match against the items in the array. This can be a function, a partial object, a key-value pair, or a property name. + * @param {PropertyKey} propertyToCheck - The property name to check for in the items of the array. + * @param {number} [fromIndex=0] - The index to start the search from, defaults to 0. + * @returns {number} - The index of the first item that has the specified property, or `-1` if no match is found. + * + * @example + * // Using a property name + * const items = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]; + * const result = findIndex(items, 'name'); + * console.log(result); // 0 + */ +declare function findIndex(arr: ArrayLike | null | undefined, doesMatch?: ListIterateeCustom, fromIndex?: number): number; + +export { findIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/findIndex.d.ts b/node_modules/es-toolkit/dist/compat/array/findIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9615264a0226763d47bf9c2f3f196718ed209646 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.d.ts @@ -0,0 +1,21 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; + +/** + * Finds the index of the first item in an array that has a specific property, where the property name is provided as a PropertyKey. + * + * @template T + * @param {ArrayLike | null | undefined} arr - The array to search through. + * @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} doesMatch - The criteria to match against the items in the array. This can be a function, a partial object, a key-value pair, or a property name. + * @param {PropertyKey} propertyToCheck - The property name to check for in the items of the array. + * @param {number} [fromIndex=0] - The index to start the search from, defaults to 0. + * @returns {number} - The index of the first item that has the specified property, or `-1` if no match is found. + * + * @example + * // Using a property name + * const items = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]; + * const result = findIndex(items, 'name'); + * console.log(result); // 0 + */ +declare function findIndex(arr: ArrayLike | null | undefined, doesMatch?: ListIterateeCustom, fromIndex?: number): number; + +export { findIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/findIndex.js b/node_modules/es-toolkit/dist/compat/array/findIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..991da80ad648f2776644cf7ea07b7347290d34d9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const property = require('../object/property.js'); +const matches = require('../predicate/matches.js'); +const matchesProperty = require('../predicate/matchesProperty.js'); + +function findIndex(arr, doesMatch, fromIndex = 0) { + if (!arr) { + return -1; + } + if (fromIndex < 0) { + fromIndex = Math.max(arr.length + fromIndex, 0); + } + const subArray = Array.from(arr).slice(fromIndex); + let index = -1; + switch (typeof doesMatch) { + case 'function': { + index = subArray.findIndex(doesMatch); + break; + } + case 'object': { + if (Array.isArray(doesMatch) && doesMatch.length === 2) { + const key = doesMatch[0]; + const value = doesMatch[1]; + index = subArray.findIndex(matchesProperty.matchesProperty(key, value)); + } + else { + index = subArray.findIndex(matches.matches(doesMatch)); + } + break; + } + case 'number': + case 'symbol': + case 'string': { + index = subArray.findIndex(property.property(doesMatch)); + } + } + return index === -1 ? -1 : index + fromIndex; +} + +exports.findIndex = findIndex; diff --git a/node_modules/es-toolkit/dist/compat/array/findIndex.mjs b/node_modules/es-toolkit/dist/compat/array/findIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..340e65a559b39f803dcfdc0cda50ad3eef4c2d50 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.mjs @@ -0,0 +1,39 @@ +import { property } from '../object/property.mjs'; +import { matches } from '../predicate/matches.mjs'; +import { matchesProperty } from '../predicate/matchesProperty.mjs'; + +function findIndex(arr, doesMatch, fromIndex = 0) { + if (!arr) { + return -1; + } + if (fromIndex < 0) { + fromIndex = Math.max(arr.length + fromIndex, 0); + } + const subArray = Array.from(arr).slice(fromIndex); + let index = -1; + switch (typeof doesMatch) { + case 'function': { + index = subArray.findIndex(doesMatch); + break; + } + case 'object': { + if (Array.isArray(doesMatch) && doesMatch.length === 2) { + const key = doesMatch[0]; + const value = doesMatch[1]; + index = subArray.findIndex(matchesProperty(key, value)); + } + else { + index = subArray.findIndex(matches(doesMatch)); + } + break; + } + case 'number': + case 'symbol': + case 'string': { + index = subArray.findIndex(property(doesMatch)); + } + } + return index === -1 ? -1 : index + fromIndex; +} + +export { findIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/findLast.d.mts b/node_modules/es-toolkit/dist/compat/array/findLast.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..da4e811a3d0073a599ed710df437b4e4f8d81981 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.d.mts @@ -0,0 +1,82 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; +import { ListIteratorTypeGuard } from '../_internal/ListIteratorTypeGuard.mjs'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.mjs'; +import { ObjectIteratorTypeGuard } from '../_internal/ObjectIterator.mjs'; + +/** + * Finds the last element in a collection that satisfies the predicate. + * + * @template T, S + * @param {ArrayLike | null | undefined} collection - The collection to search. + * @param {ListIteratorTypeGuard} predicate - The predicate function with type guard. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {S | undefined} The last element that satisfies the predicate. + * + * @example + * const users = [{ user: 'barney', age: 36 }, { user: 'fred', age: 40 }, { user: 'pebbles', age: 18 }]; + * findLast(users, (o): o is { user: string; age: number } => o.age < 40); + * // => { user: 'pebbles', age: 18 } + */ +declare function findLast(collection: ArrayLike | null | undefined, predicate: ListIteratorTypeGuard, fromIndex?: number): S | undefined; +/** + * Finds the last element in a collection that satisfies the predicate. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to search. + * @param {ListIterateeCustom} [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {T | undefined} The last element that satisfies the predicate. + * + * @example + * const users = [{ user: 'barney', age: 36 }, { user: 'fred', age: 40 }, { user: 'pebbles', age: 18 }]; + * findLast(users, o => o.age < 40); + * // => { user: 'pebbles', age: 18 } + * + * findLast(users, { age: 36 }); + * // => { user: 'barney', age: 36 } + * + * findLast(users, ['age', 18]); + * // => { user: 'pebbles', age: 18 } + * + * findLast(users, 'age'); + * // => { user: 'fred', age: 40 } + */ +declare function findLast(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom, fromIndex?: number): T | undefined; +/** + * Finds the last element in an object that satisfies the predicate with type guard. + * + * @template T, S + * @param {T | null | undefined} collection - The object to search. + * @param {ObjectIteratorTypeGuard} predicate - The predicate function with type guard. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {S | undefined} The last element that satisfies the predicate. + * + * @example + * const obj = { a: 1, b: 'hello', c: 3 }; + * findLast(obj, (value): value is string => typeof value === 'string'); + * // => 'hello' + */ +declare function findLast(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard, fromIndex?: number): S | undefined; +/** + * Finds the last element in an object that satisfies the predicate. + * + * @template T + * @param {T | null | undefined} collection - The object to search. + * @param {ObjectIterateeCustom} [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {T[keyof T] | undefined} The last element that satisfies the predicate. + * + * @example + * const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2 }, c: { id: 3, name: 'Bob' } }; + * findLast(obj, o => o.id > 1); + * // => { id: 3, name: 'Bob' } + * + * findLast(obj, { name: 'Bob' }); + * // => { id: 3, name: 'Bob' } + * + * findLast(obj, 'name'); + * // => { id: 3, name: 'Bob' } + */ +declare function findLast(collection: T | null | undefined, predicate?: ObjectIterateeCustom, fromIndex?: number): T[keyof T] | undefined; + +export { findLast }; diff --git a/node_modules/es-toolkit/dist/compat/array/findLast.d.ts b/node_modules/es-toolkit/dist/compat/array/findLast.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..428bd8a648b1bc6cbdd087ce68e59cddf5653644 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.d.ts @@ -0,0 +1,82 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; +import { ListIteratorTypeGuard } from '../_internal/ListIteratorTypeGuard.js'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.js'; +import { ObjectIteratorTypeGuard } from '../_internal/ObjectIterator.js'; + +/** + * Finds the last element in a collection that satisfies the predicate. + * + * @template T, S + * @param {ArrayLike | null | undefined} collection - The collection to search. + * @param {ListIteratorTypeGuard} predicate - The predicate function with type guard. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {S | undefined} The last element that satisfies the predicate. + * + * @example + * const users = [{ user: 'barney', age: 36 }, { user: 'fred', age: 40 }, { user: 'pebbles', age: 18 }]; + * findLast(users, (o): o is { user: string; age: number } => o.age < 40); + * // => { user: 'pebbles', age: 18 } + */ +declare function findLast(collection: ArrayLike | null | undefined, predicate: ListIteratorTypeGuard, fromIndex?: number): S | undefined; +/** + * Finds the last element in a collection that satisfies the predicate. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to search. + * @param {ListIterateeCustom} [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {T | undefined} The last element that satisfies the predicate. + * + * @example + * const users = [{ user: 'barney', age: 36 }, { user: 'fred', age: 40 }, { user: 'pebbles', age: 18 }]; + * findLast(users, o => o.age < 40); + * // => { user: 'pebbles', age: 18 } + * + * findLast(users, { age: 36 }); + * // => { user: 'barney', age: 36 } + * + * findLast(users, ['age', 18]); + * // => { user: 'pebbles', age: 18 } + * + * findLast(users, 'age'); + * // => { user: 'fred', age: 40 } + */ +declare function findLast(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom, fromIndex?: number): T | undefined; +/** + * Finds the last element in an object that satisfies the predicate with type guard. + * + * @template T, S + * @param {T | null | undefined} collection - The object to search. + * @param {ObjectIteratorTypeGuard} predicate - The predicate function with type guard. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {S | undefined} The last element that satisfies the predicate. + * + * @example + * const obj = { a: 1, b: 'hello', c: 3 }; + * findLast(obj, (value): value is string => typeof value === 'string'); + * // => 'hello' + */ +declare function findLast(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard, fromIndex?: number): S | undefined; +/** + * Finds the last element in an object that satisfies the predicate. + * + * @template T + * @param {T | null | undefined} collection - The object to search. + * @param {ObjectIterateeCustom} [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {T[keyof T] | undefined} The last element that satisfies the predicate. + * + * @example + * const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2 }, c: { id: 3, name: 'Bob' } }; + * findLast(obj, o => o.id > 1); + * // => { id: 3, name: 'Bob' } + * + * findLast(obj, { name: 'Bob' }); + * // => { id: 3, name: 'Bob' } + * + * findLast(obj, 'name'); + * // => { id: 3, name: 'Bob' } + */ +declare function findLast(collection: T | null | undefined, predicate?: ObjectIterateeCustom, fromIndex?: number): T[keyof T] | undefined; + +export { findLast }; diff --git a/node_modules/es-toolkit/dist/compat/array/findLast.js b/node_modules/es-toolkit/dist/compat/array/findLast.js new file mode 100644 index 0000000000000000000000000000000000000000..bba9369cb916e15a6d962ccf5a8674743644f616 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.js @@ -0,0 +1,36 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const iteratee = require('../util/iteratee.js'); +const toInteger = require('../util/toInteger.js'); + +function findLast(source, _doesMatch = identity.identity, fromIndex) { + if (!source) { + return undefined; + } + const length = Array.isArray(source) ? source.length : Object.keys(source).length; + fromIndex = toInteger.toInteger(fromIndex ?? length - 1); + if (fromIndex < 0) { + fromIndex = Math.max(length + fromIndex, 0); + } + else { + fromIndex = Math.min(fromIndex, length - 1); + } + const doesMatch = iteratee.iteratee(_doesMatch); + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = fromIndex; i >= 0; i--) { + const key = keys[i]; + const value = source[key]; + if (doesMatch(value, key, source)) { + return value; + } + } + return undefined; + } + return source.slice(0, fromIndex + 1).findLast(doesMatch); +} + +exports.findLast = findLast; diff --git a/node_modules/es-toolkit/dist/compat/array/findLast.mjs b/node_modules/es-toolkit/dist/compat/array/findLast.mjs new file mode 100644 index 0000000000000000000000000000000000000000..df1ae76a95dadfc52826a30c54d79866fea4d0d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.mjs @@ -0,0 +1,32 @@ +import { identity } from '../../function/identity.mjs'; +import { iteratee } from '../util/iteratee.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function findLast(source, _doesMatch = identity, fromIndex) { + if (!source) { + return undefined; + } + const length = Array.isArray(source) ? source.length : Object.keys(source).length; + fromIndex = toInteger(fromIndex ?? length - 1); + if (fromIndex < 0) { + fromIndex = Math.max(length + fromIndex, 0); + } + else { + fromIndex = Math.min(fromIndex, length - 1); + } + const doesMatch = iteratee(_doesMatch); + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = fromIndex; i >= 0; i--) { + const key = keys[i]; + const value = source[key]; + if (doesMatch(value, key, source)) { + return value; + } + } + return undefined; + } + return source.slice(0, fromIndex + 1).findLast(doesMatch); +} + +export { findLast }; diff --git a/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.mts b/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cbabf7108bb944800d334f4042cf72015f287107 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.mts @@ -0,0 +1,33 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; + +/** + * Finds the index of the last element in the array that satisfies the predicate. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to search through. + * @param {ListIterateeCustom} [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {number} The index of the last matching element, or -1 if not found. + * + * @example + * const users = [ + * { user: 'barney', active: true }, + * { user: 'fred', active: false }, + * { user: 'pebbles', active: false } + * ]; + * + * findLastIndex(users, o => o.user === 'pebbles'); + * // => 2 + * + * findLastIndex(users, { user: 'barney', active: true }); + * // => 0 + * + * findLastIndex(users, ['active', false]); + * // => 2 + * + * findLastIndex(users, 'active'); + * // => 0 + */ +declare function findLastIndex(array: ArrayLike | null | undefined, predicate?: ListIterateeCustom, fromIndex?: number): number; + +export { findLastIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.ts b/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e88649818ecc8e2e6c19ebdb860c96d52ec00c3b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.ts @@ -0,0 +1,33 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; + +/** + * Finds the index of the last element in the array that satisfies the predicate. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to search through. + * @param {ListIterateeCustom} [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param {number} [fromIndex] - The index to start searching from. + * @returns {number} The index of the last matching element, or -1 if not found. + * + * @example + * const users = [ + * { user: 'barney', active: true }, + * { user: 'fred', active: false }, + * { user: 'pebbles', active: false } + * ]; + * + * findLastIndex(users, o => o.user === 'pebbles'); + * // => 2 + * + * findLastIndex(users, { user: 'barney', active: true }); + * // => 0 + * + * findLastIndex(users, ['active', false]); + * // => 2 + * + * findLastIndex(users, 'active'); + * // => 0 + */ +declare function findLastIndex(array: ArrayLike | null | undefined, predicate?: ListIterateeCustom, fromIndex?: number): number; + +export { findLastIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/findLastIndex.js b/node_modules/es-toolkit/dist/compat/array/findLastIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..f9949bf7e78821f7cdbfe98bf78fe797a7a1990b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLastIndex.js @@ -0,0 +1,44 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const toArray = require('../_internal/toArray.js'); +const property = require('../object/property.js'); +const matches = require('../predicate/matches.js'); +const matchesProperty = require('../predicate/matchesProperty.js'); + +function findLastIndex(arr, doesMatch = identity.identity, fromIndex = arr ? arr.length - 1 : 0) { + if (!arr) { + return -1; + } + if (fromIndex < 0) { + fromIndex = Math.max(arr.length + fromIndex, 0); + } + else { + fromIndex = Math.min(fromIndex, arr.length - 1); + } + const subArray = toArray.toArray(arr).slice(0, fromIndex + 1); + switch (typeof doesMatch) { + case 'function': { + return subArray.findLastIndex(doesMatch); + } + case 'object': { + if (Array.isArray(doesMatch) && doesMatch.length === 2) { + const key = doesMatch[0]; + const value = doesMatch[1]; + return subArray.findLastIndex(matchesProperty.matchesProperty(key, value)); + } + else { + return subArray.findLastIndex(matches.matches(doesMatch)); + } + } + case 'number': + case 'symbol': + case 'string': { + return subArray.findLastIndex(property.property(doesMatch)); + } + } +} + +exports.findLastIndex = findLastIndex; diff --git a/node_modules/es-toolkit/dist/compat/array/findLastIndex.mjs b/node_modules/es-toolkit/dist/compat/array/findLastIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5a4f7f613c1ba942a505b9d0137de2454ff333ac --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLastIndex.mjs @@ -0,0 +1,40 @@ +import { identity } from '../../function/identity.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { property } from '../object/property.mjs'; +import { matches } from '../predicate/matches.mjs'; +import { matchesProperty } from '../predicate/matchesProperty.mjs'; + +function findLastIndex(arr, doesMatch = identity, fromIndex = arr ? arr.length - 1 : 0) { + if (!arr) { + return -1; + } + if (fromIndex < 0) { + fromIndex = Math.max(arr.length + fromIndex, 0); + } + else { + fromIndex = Math.min(fromIndex, arr.length - 1); + } + const subArray = toArray(arr).slice(0, fromIndex + 1); + switch (typeof doesMatch) { + case 'function': { + return subArray.findLastIndex(doesMatch); + } + case 'object': { + if (Array.isArray(doesMatch) && doesMatch.length === 2) { + const key = doesMatch[0]; + const value = doesMatch[1]; + return subArray.findLastIndex(matchesProperty(key, value)); + } + else { + return subArray.findLastIndex(matches(doesMatch)); + } + } + case 'number': + case 'symbol': + case 'string': { + return subArray.findLastIndex(property(doesMatch)); + } + } +} + +export { findLastIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMap.d.mts b/node_modules/es-toolkit/dist/compat/array/flatMap.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..531f6b3d804be8932bb1f38ec4853ea9eca5033c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.d.mts @@ -0,0 +1,93 @@ +import { ListIterator } from '../_internal/ListIterator.mjs'; +import { Many } from '../_internal/Many.mjs'; +import { ObjectIterator } from '../_internal/ObjectIterator.mjs'; + +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T + * @param {Record> | Record> | null | undefined} collection - The collection to iterate over. + * @returns {T[]} Returns the new flattened array. + * + * @example + * const obj = { a: [1, 2], b: [3, 4] }; + * flatMap(obj); + * // => [1, 2, 3, 4] + */ +declare function flatMap(collection: Record> | Record> | null | undefined): T[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @returns {any[]} Returns the new flattened array. + * + * @example + * flatMap({ a: 1, b: 2 }); + * // => [1, 2] + */ +declare function flatMap(collection: object | null | undefined): any[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T, R + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterator>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new flattened array. + * + * @example + * function duplicate(n) { + * return [n, n]; + * } + * + * flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +declare function flatMap(collection: ArrayLike | null | undefined, iteratee: ListIterator>): R[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T, R + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new flattened array. + * + * @example + * const obj = { a: 1, b: 2 }; + * flatMap(obj, (value, key) => [key, value]); + * // => ['a', 1, 'b', 2] + */ +declare function flatMap(collection: T | null | undefined, iteratee: ObjectIterator>): R[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} iteratee - The property name to use as iteratee. + * @returns {any[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', hobbies: ['hiking', 'coding'] }, + * { user: 'fred', hobbies: ['reading'] } + * ]; + * flatMap(users, 'hobbies'); + * // => ['hiking', 'coding', 'reading'] + */ +declare function flatMap(collection: object | null | undefined, iteratee: string): any[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {object} iteratee - The object properties to match. + * @returns {boolean[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', age: 36, active: true }, + * { user: 'fred', age: 40, active: false } + * ]; + * flatMap(users, { active: false }); + * // => [false] + */ +declare function flatMap(collection: object | null | undefined, iteratee: object): boolean[]; + +export { flatMap }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMap.d.ts b/node_modules/es-toolkit/dist/compat/array/flatMap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c435c0f875a3a9e2024354bacef8e714c13a1f7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.d.ts @@ -0,0 +1,93 @@ +import { ListIterator } from '../_internal/ListIterator.js'; +import { Many } from '../_internal/Many.js'; +import { ObjectIterator } from '../_internal/ObjectIterator.js'; + +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T + * @param {Record> | Record> | null | undefined} collection - The collection to iterate over. + * @returns {T[]} Returns the new flattened array. + * + * @example + * const obj = { a: [1, 2], b: [3, 4] }; + * flatMap(obj); + * // => [1, 2, 3, 4] + */ +declare function flatMap(collection: Record> | Record> | null | undefined): T[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @returns {any[]} Returns the new flattened array. + * + * @example + * flatMap({ a: 1, b: 2 }); + * // => [1, 2] + */ +declare function flatMap(collection: object | null | undefined): any[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T, R + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterator>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new flattened array. + * + * @example + * function duplicate(n) { + * return [n, n]; + * } + * + * flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +declare function flatMap(collection: ArrayLike | null | undefined, iteratee: ListIterator>): R[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T, R + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new flattened array. + * + * @example + * const obj = { a: 1, b: 2 }; + * flatMap(obj, (value, key) => [key, value]); + * // => ['a', 1, 'b', 2] + */ +declare function flatMap(collection: T | null | undefined, iteratee: ObjectIterator>): R[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} iteratee - The property name to use as iteratee. + * @returns {any[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', hobbies: ['hiking', 'coding'] }, + * { user: 'fred', hobbies: ['reading'] } + * ]; + * flatMap(users, 'hobbies'); + * // => ['hiking', 'coding', 'reading'] + */ +declare function flatMap(collection: object | null | undefined, iteratee: string): any[]; +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {object} iteratee - The object properties to match. + * @returns {boolean[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', age: 36, active: true }, + * { user: 'fred', age: 40, active: false } + * ]; + * flatMap(users, { active: false }); + * // => [false] + */ +declare function flatMap(collection: object | null | undefined, iteratee: object): boolean[]; + +export { flatMap }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMap.js b/node_modules/es-toolkit/dist/compat/array/flatMap.js new file mode 100644 index 0000000000000000000000000000000000000000..42fb511e532558d7ab05e3a0413848f10db11abf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flattenDepth = require('./flattenDepth.js'); +const map = require('./map.js'); +const isNil = require('../../predicate/isNil.js'); + +function flatMap(collection, iteratee) { + if (isNil.isNil(collection)) { + return []; + } + const mapped = isNil.isNil(iteratee) ? map.map(collection) : map.map(collection, iteratee); + return flattenDepth.flattenDepth(mapped, 1); +} + +exports.flatMap = flatMap; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMap.mjs b/node_modules/es-toolkit/dist/compat/array/flatMap.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1275f0a211703b7541fc5a236860111998bf214a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.mjs @@ -0,0 +1,13 @@ +import { flattenDepth } from './flattenDepth.mjs'; +import { map } from './map.mjs'; +import { isNil } from '../../predicate/isNil.mjs'; + +function flatMap(collection, iteratee) { + if (isNil(collection)) { + return []; + } + const mapped = isNil(iteratee) ? map(collection) : map(collection, iteratee); + return flattenDepth(mapped, 1); +} + +export { flatMap }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.mts b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8ef3d56dadc8929d2b7a3bbe9728588c8b4a2e08 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.mts @@ -0,0 +1,82 @@ +import { ListIterator } from '../_internal/ListIterator.mjs'; +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.mjs'; +import { ObjectIterator } from '../_internal/ObjectIterator.mjs'; + +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T + * @param {Record | T> | Record | T> | null | undefined} collection - The collection to iterate over. + * @returns {T[]} Returns the new deeply flattened array. + * + * @example + * const obj = { a: [[1, 2]], b: [[[3]]] }; + * flatMapDeep(obj); + * // => [1, 2, 3] + */ +declare function flatMapDeep(collection: Record | T> | Record | T> | null | undefined): T[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T, R + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterator | R>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new deeply flattened array. + * + * @example + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +declare function flatMapDeep(collection: ArrayLike | null | undefined, iteratee: ListIterator | R>): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T, R + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator | R>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new deeply flattened array. + * + * @example + * const obj = { a: 1, b: 2 }; + * flatMapDeep(obj, (value, key) => [[[key, value]]]); + * // => ['a', 1, 'b', 2] + */ +declare function flatMapDeep(collection: T | null | undefined, iteratee: ObjectIterator | R>): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} iteratee - The property name to use as iteratee. + * @returns {any[]} Returns the new deeply flattened array. + * + * @example + * const users = [ + * { user: 'barney', hobbies: [['hiking', 'coding']] }, + * { user: 'fred', hobbies: [['reading']] } + * ]; + * flatMapDeep(users, 'hobbies'); + * // => ['hiking', 'coding', 'reading'] + */ +declare function flatMapDeep(collection: object | null | undefined, iteratee: string): any[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {object} iteratee - The object properties to match. + * @returns {boolean[]} Returns the new deeply flattened array. + * + * @example + * const users = [ + * { user: 'barney', active: [true, false] }, + * { user: 'fred', active: [false] } + * ]; + * flatMapDeep(users, { active: [false] }); + * // => [false] + */ +declare function flatMapDeep(collection: object | null | undefined, iteratee: object): boolean[]; + +export { flatMapDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.ts b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6dc6921a98025221205aa5a65852811cce2a243f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.ts @@ -0,0 +1,82 @@ +import { ListIterator } from '../_internal/ListIterator.js'; +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.js'; +import { ObjectIterator } from '../_internal/ObjectIterator.js'; + +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T + * @param {Record | T> | Record | T> | null | undefined} collection - The collection to iterate over. + * @returns {T[]} Returns the new deeply flattened array. + * + * @example + * const obj = { a: [[1, 2]], b: [[[3]]] }; + * flatMapDeep(obj); + * // => [1, 2, 3] + */ +declare function flatMapDeep(collection: Record | T> | Record | T> | null | undefined): T[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T, R + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterator | R>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new deeply flattened array. + * + * @example + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +declare function flatMapDeep(collection: ArrayLike | null | undefined, iteratee: ListIterator | R>): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T, R + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator | R>} iteratee - The function invoked per iteration. + * @returns {R[]} Returns the new deeply flattened array. + * + * @example + * const obj = { a: 1, b: 2 }; + * flatMapDeep(obj, (value, key) => [[[key, value]]]); + * // => ['a', 1, 'b', 2] + */ +declare function flatMapDeep(collection: T | null | undefined, iteratee: ObjectIterator | R>): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} iteratee - The property name to use as iteratee. + * @returns {any[]} Returns the new deeply flattened array. + * + * @example + * const users = [ + * { user: 'barney', hobbies: [['hiking', 'coding']] }, + * { user: 'fred', hobbies: [['reading']] } + * ]; + * flatMapDeep(users, 'hobbies'); + * // => ['hiking', 'coding', 'reading'] + */ +declare function flatMapDeep(collection: object | null | undefined, iteratee: string): any[]; +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {object} iteratee - The object properties to match. + * @returns {boolean[]} Returns the new deeply flattened array. + * + * @example + * const users = [ + * { user: 'barney', active: [true, false] }, + * { user: 'fred', active: [false] } + * ]; + * flatMapDeep(users, { active: [false] }); + * // => [false] + */ +declare function flatMapDeep(collection: object | null | undefined, iteratee: object): boolean[]; + +export { flatMapDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDeep.js b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..55ac2e76bb312899e2324ba8ac10b6578b71fd53 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatMapDepth = require('./flatMapDepth.js'); + +function flatMapDeep(collection, iteratee) { + return flatMapDepth.flatMapDepth(collection, iteratee, Infinity); +} + +exports.flatMapDeep = flatMapDeep; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDeep.mjs b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..55e88b9b1fcbf5c897bf08ac2a63cb624738c760 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.mjs @@ -0,0 +1,7 @@ +import { flatMapDepth } from './flatMapDepth.mjs'; + +function flatMapDeep(collection, iteratee) { + return flatMapDepth(collection, iteratee, Infinity); +} + +export { flatMapDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.mts b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ae73aa0f204f146806b30f4a4d571683927b1f71 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.mts @@ -0,0 +1,86 @@ +import { ListIterator } from '../_internal/ListIterator.mjs'; +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.mjs'; +import { ObjectIterator } from '../_internal/ObjectIterator.mjs'; + +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T + * @param {Record | T> | Record | T> | null | undefined} collection - The collection to iterate over. + * @returns {T[]} Returns the new flattened array. + * + * @example + * const obj = { a: [[1, 2]], b: [[[3]]] }; + * flatMapDepth(obj); + * // => [1, 2, [3]] + */ +declare function flatMapDepth(collection: Record | T> | Record | T> | null | undefined): T[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T, R + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterator | R>} iteratee - The function invoked per iteration. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {R[]} Returns the new flattened array. + * + * @example + * function duplicate(n) { + * return [[n, n]]; + * } + * + * flatMapDepth([1, 2], duplicate, 2); + * // => [1, 1, 2, 2] + */ +declare function flatMapDepth(collection: ArrayLike | null | undefined, iteratee: ListIterator | R>, depth?: number): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T, R + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator | R>} iteratee - The function invoked per iteration. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {R[]} Returns the new flattened array. + * + * @example + * const obj = { a: 1, b: 2 }; + * flatMapDepth(obj, (value, key) => [[key, value]], 2); + * // => ['a', 1, 'b', 2] + */ +declare function flatMapDepth(collection: T | null | undefined, iteratee: ObjectIterator | R>, depth?: number): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} iteratee - The property name to use as iteratee. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {any[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', hobbies: [['hiking'], ['coding']] }, + * { user: 'fred', hobbies: [['reading']] } + * ]; + * flatMapDepth(users, 'hobbies', 2); + * // => ['hiking', 'coding', 'reading'] + */ +declare function flatMapDepth(collection: object | null | undefined, iteratee: string, depth?: number): any[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {object} iteratee - The object properties to match. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {boolean[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', active: [[true], [false]] }, + * { user: 'fred', active: [[false]] } + * ]; + * flatMapDepth(users, { active: [[false]] }); + * // => [false] + */ +declare function flatMapDepth(collection: object | null | undefined, iteratee: object, depth?: number): boolean[]; + +export { flatMapDepth }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.ts b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f590567dd8cbd9e30359428ea0482b4cecae32dc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.ts @@ -0,0 +1,86 @@ +import { ListIterator } from '../_internal/ListIterator.js'; +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.js'; +import { ObjectIterator } from '../_internal/ObjectIterator.js'; + +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T + * @param {Record | T> | Record | T> | null | undefined} collection - The collection to iterate over. + * @returns {T[]} Returns the new flattened array. + * + * @example + * const obj = { a: [[1, 2]], b: [[[3]]] }; + * flatMapDepth(obj); + * // => [1, 2, [3]] + */ +declare function flatMapDepth(collection: Record | T> | Record | T> | null | undefined): T[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T, R + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterator | R>} iteratee - The function invoked per iteration. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {R[]} Returns the new flattened array. + * + * @example + * function duplicate(n) { + * return [[n, n]]; + * } + * + * flatMapDepth([1, 2], duplicate, 2); + * // => [1, 1, 2, 2] + */ +declare function flatMapDepth(collection: ArrayLike | null | undefined, iteratee: ListIterator | R>, depth?: number): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T, R + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator | R>} iteratee - The function invoked per iteration. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {R[]} Returns the new flattened array. + * + * @example + * const obj = { a: 1, b: 2 }; + * flatMapDepth(obj, (value, key) => [[key, value]], 2); + * // => ['a', 1, 'b', 2] + */ +declare function flatMapDepth(collection: T | null | undefined, iteratee: ObjectIterator | R>, depth?: number): R[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} iteratee - The property name to use as iteratee. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {any[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', hobbies: [['hiking'], ['coding']] }, + * { user: 'fred', hobbies: [['reading']] } + * ]; + * flatMapDepth(users, 'hobbies', 2); + * // => ['hiking', 'coding', 'reading'] + */ +declare function flatMapDepth(collection: object | null | undefined, iteratee: string, depth?: number): any[]; +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {object} iteratee - The object properties to match. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {boolean[]} Returns the new flattened array. + * + * @example + * const users = [ + * { user: 'barney', active: [[true], [false]] }, + * { user: 'fred', active: [[false]] } + * ]; + * flatMapDepth(users, { active: [[false]] }); + * // => [false] + */ +declare function flatMapDepth(collection: object | null | undefined, iteratee: object, depth?: number): boolean[]; + +export { flatMapDepth }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDepth.js b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.js new file mode 100644 index 0000000000000000000000000000000000000000..0e854eb9208def1554116ef368e456fc395a4e48 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('./flatten.js'); +const map = require('./map.js'); +const identity = require('../../function/identity.js'); +const iteratee = require('../util/iteratee.js'); + +function flatMapDepth(collection, iteratee$1 = identity.identity, depth = 1) { + if (collection == null) { + return []; + } + const iterateeFn = iteratee.iteratee(iteratee$1); + const mapped = map.map(collection, iterateeFn); + return flatten.flatten(mapped, depth); +} + +exports.flatMapDepth = flatMapDepth; diff --git a/node_modules/es-toolkit/dist/compat/array/flatMapDepth.mjs b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0244082a5e5c0a5e253d6be4f962231ef4665d4d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.mjs @@ -0,0 +1,15 @@ +import { flatten } from './flatten.mjs'; +import { map } from './map.mjs'; +import { identity } from '../../function/identity.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function flatMapDepth(collection, iteratee$1 = identity, depth = 1) { + if (collection == null) { + return []; + } + const iterateeFn = iteratee(iteratee$1); + const mapped = map(collection, iterateeFn); + return flatten(mapped, depth); +} + +export { flatMapDepth }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatten.d.mts b/node_modules/es-toolkit/dist/compat/array/flatten.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1ff4c124991eddb92fcdd1cc3ec4a7b9e2dcd0d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.d.mts @@ -0,0 +1,15 @@ +/** + * Flattens array up to depth times. + * + * @template T + * @param {ArrayLike | null | undefined} value - The array to flatten. + * @param {number} depth - The maximum recursion depth. + * @returns {any[]} Returns the new flattened array. + * + * @example + * flatten([1, [2, [3, [4]], 5]], 2); + * // => [1, 2, 3, [4], 5] + */ +declare function flatten(value: ArrayLike | null | undefined): T[]; + +export { flatten }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatten.d.ts b/node_modules/es-toolkit/dist/compat/array/flatten.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ff4c124991eddb92fcdd1cc3ec4a7b9e2dcd0d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.d.ts @@ -0,0 +1,15 @@ +/** + * Flattens array up to depth times. + * + * @template T + * @param {ArrayLike | null | undefined} value - The array to flatten. + * @param {number} depth - The maximum recursion depth. + * @returns {any[]} Returns the new flattened array. + * + * @example + * flatten([1, [2, [3, [4]], 5]], 2); + * // => [1, 2, 3, [4], 5] + */ +declare function flatten(value: ArrayLike | null | undefined): T[]; + +export { flatten }; diff --git a/node_modules/es-toolkit/dist/compat/array/flatten.js b/node_modules/es-toolkit/dist/compat/array/flatten.js new file mode 100644 index 0000000000000000000000000000000000000000..10668a90c8ac8a36fbf7430a2770516a8ca52477 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.js @@ -0,0 +1,36 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLike = require('../predicate/isArrayLike.js'); + +function flatten(value, depth = 1) { + const result = []; + const flooredDepth = Math.floor(depth); + if (!isArrayLike.isArrayLike(value)) { + return result; + } + const recursive = (arr, currentDepth) => { + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (currentDepth < flooredDepth && + (Array.isArray(item) || + Boolean(item?.[Symbol.isConcatSpreadable]) || + (item !== null && typeof item === 'object' && Object.prototype.toString.call(item) === '[object Arguments]'))) { + if (Array.isArray(item)) { + recursive(item, currentDepth + 1); + } + else { + recursive(Array.from(item), currentDepth + 1); + } + } + else { + result.push(item); + } + } + }; + recursive(Array.from(value), 0); + return result; +} + +exports.flatten = flatten; diff --git a/node_modules/es-toolkit/dist/compat/array/flatten.mjs b/node_modules/es-toolkit/dist/compat/array/flatten.mjs new file mode 100644 index 0000000000000000000000000000000000000000..243d21e95cadf2fe6d78f142322cea36e2eb42ec --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.mjs @@ -0,0 +1,32 @@ +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function flatten(value, depth = 1) { + const result = []; + const flooredDepth = Math.floor(depth); + if (!isArrayLike(value)) { + return result; + } + const recursive = (arr, currentDepth) => { + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (currentDepth < flooredDepth && + (Array.isArray(item) || + Boolean(item?.[Symbol.isConcatSpreadable]) || + (item !== null && typeof item === 'object' && Object.prototype.toString.call(item) === '[object Arguments]'))) { + if (Array.isArray(item)) { + recursive(item, currentDepth + 1); + } + else { + recursive(Array.from(item), currentDepth + 1); + } + } + else { + result.push(item); + } + } + }; + recursive(Array.from(value), 0); + return result; +} + +export { flatten }; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.mts b/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f50f8874ef18ebb4d736eac1e5a0c637a4550b77 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.mts @@ -0,0 +1,16 @@ +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.mjs'; + +/** + * Recursively flattens array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to flatten. + * @returns {Array>} Returns the new flattened array. + * + * @example + * flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ +declare function flattenDeep(value: ListOfRecursiveArraysOrValues | null | undefined): Array ? never : T>; + +export { flattenDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.ts b/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf1db0d86f707e8011a277bce3b2a63a54437ad6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.ts @@ -0,0 +1,16 @@ +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.js'; + +/** + * Recursively flattens array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to flatten. + * @returns {Array>} Returns the new flattened array. + * + * @example + * flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ +declare function flattenDeep(value: ListOfRecursiveArraysOrValues | null | undefined): Array ? never : T>; + +export { flattenDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDeep.js b/node_modules/es-toolkit/dist/compat/array/flattenDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..3727b211535924d272897d6392cfdbbc69e22cec --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flattenDepth = require('./flattenDepth.js'); + +function flattenDeep(value) { + return flattenDepth.flattenDepth(value, Infinity); +} + +exports.flattenDeep = flattenDeep; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDeep.mjs b/node_modules/es-toolkit/dist/compat/array/flattenDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5789b165df3926bd0b4602dfa86ad567c2e569b9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.mjs @@ -0,0 +1,7 @@ +import { flattenDepth } from './flattenDepth.mjs'; + +function flattenDeep(value) { + return flattenDepth(value, Infinity); +} + +export { flattenDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.mts b/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3301bb15e71291e13c59f4611d11c870d39557fa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.mts @@ -0,0 +1,22 @@ +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.mjs'; + +/** + * Recursively flattens array up to depth times. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to flatten. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {T[]} Returns the new flattened array. + * + * @example + * const array = [1, [2, [3, [4]], 5]]; + * + * flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ +declare function flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; + +export { flattenDepth }; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.ts b/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3285e639d6c7a9145994b06531c9372d13a9c67f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.ts @@ -0,0 +1,22 @@ +import { ListOfRecursiveArraysOrValues } from '../_internal/ListOfRecursiveArraysOrValues.js'; + +/** + * Recursively flattens array up to depth times. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to flatten. + * @param {number} [depth=1] - The maximum recursion depth. + * @returns {T[]} Returns the new flattened array. + * + * @example + * const array = [1, [2, [3, [4]], 5]]; + * + * flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ +declare function flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; + +export { flattenDepth }; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDepth.js b/node_modules/es-toolkit/dist/compat/array/flattenDepth.js new file mode 100644 index 0000000000000000000000000000000000000000..4848f719625e038b554da2880277c9ea5efd0752 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('./flatten.js'); + +function flattenDepth(array, depth = 1) { + return flatten.flatten(array, depth); +} + +exports.flattenDepth = flattenDepth; diff --git a/node_modules/es-toolkit/dist/compat/array/flattenDepth.mjs b/node_modules/es-toolkit/dist/compat/array/flattenDepth.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ea2c0971f85534a3da9de7679dfd47f48f338a5b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.mjs @@ -0,0 +1,7 @@ +import { flatten } from './flatten.mjs'; + +function flattenDepth(array, depth = 1) { + return flatten(array, depth); +} + +export { flattenDepth }; diff --git a/node_modules/es-toolkit/dist/compat/array/forEach.d.mts b/node_modules/es-toolkit/dist/compat/array/forEach.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e2ef3d911b3397ad9294cd680d016454a176716b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.d.mts @@ -0,0 +1,110 @@ +import { ArrayIterator } from '../_internal/ArrayIterator.mjs'; +import { ListIterator } from '../_internal/ListIterator.mjs'; +import { ObjectIterator } from '../_internal/ObjectIterator.mjs'; +import { StringIterator } from '../_internal/StringIterator.mjs'; + +/** + * Iterates over elements of array and invokes iteratee for each element. + * + * @template T + * @param {T[]} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {T[]} Returns array. + * + * @example + * forEach([1, 2], value => console.log(value)); + * // => Logs `1` then `2`. + */ +declare function forEach(collection: T[], iteratee?: ArrayIterator): T[]; +/** + * Iterates over characters of string and invokes iteratee for each character. + * + * @param {string} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {string} Returns string. + * + * @example + * forEach('abc', char => console.log(char)); + * // => Logs 'a', 'b', then 'c'. + */ +declare function forEach(collection: string, iteratee?: StringIterator): string; +/** + * Iterates over elements of collection and invokes iteratee for each element. + * + * @template T + * @param {ArrayLike} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {ArrayLike} Returns collection. + * + * @example + * forEach({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'a' then 'b'. + */ +declare function forEach(collection: ArrayLike, iteratee?: ListIterator): ArrayLike; +/** + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * + * @template T + * @param {T} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns object. + * + * @example + * forEach({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'a' then 'b'. + */ +declare function forEach(collection: T, iteratee?: ObjectIterator): T; +/** + * Iterates over elements of array and invokes iteratee for each element. + * + * @template T, U + * @param {U & (T[] | null | undefined)} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {U} Returns the array. + * + * @example + * forEach([1, 2], value => console.log(value)); + * // => Logs `1` then `2`. + */ +declare function forEach(collection: U & (T[] | null | undefined), iteratee?: ArrayIterator): U; +/** + * Iterates over characters of string and invokes iteratee for each character. + * + * @template T + * @param {T} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns the string. + * + * @example + * forEach('abc', char => console.log(char)); + * // => Logs 'a', 'b', then 'c'. + */ +declare function forEach(collection: T, iteratee?: StringIterator): T; +/** + * Iterates over elements of collection and invokes iteratee for each element. + * + * @template T, L + * @param {L & (ArrayLike | null | undefined)} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {L} Returns the collection. + * + * @example + * forEach({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'a' then 'b'. + */ +declare function forEach | null | undefined>(collection: L & (ArrayLike | null | undefined), iteratee?: ListIterator): L; +/** + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T | null | undefined} Returns the object. + * + * @example + * forEach({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'a' then 'b'. + */ +declare function forEach(collection: T | null | undefined, iteratee?: ObjectIterator): T | null | undefined; + +export { forEach }; diff --git a/node_modules/es-toolkit/dist/compat/array/forEach.d.ts b/node_modules/es-toolkit/dist/compat/array/forEach.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d8e3cae966dc832d0f97186ece0c3570aeac9e44 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.d.ts @@ -0,0 +1,110 @@ +import { ArrayIterator } from '../_internal/ArrayIterator.js'; +import { ListIterator } from '../_internal/ListIterator.js'; +import { ObjectIterator } from '../_internal/ObjectIterator.js'; +import { StringIterator } from '../_internal/StringIterator.js'; + +/** + * Iterates over elements of array and invokes iteratee for each element. + * + * @template T + * @param {T[]} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {T[]} Returns array. + * + * @example + * forEach([1, 2], value => console.log(value)); + * // => Logs `1` then `2`. + */ +declare function forEach(collection: T[], iteratee?: ArrayIterator): T[]; +/** + * Iterates over characters of string and invokes iteratee for each character. + * + * @param {string} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {string} Returns string. + * + * @example + * forEach('abc', char => console.log(char)); + * // => Logs 'a', 'b', then 'c'. + */ +declare function forEach(collection: string, iteratee?: StringIterator): string; +/** + * Iterates over elements of collection and invokes iteratee for each element. + * + * @template T + * @param {ArrayLike} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {ArrayLike} Returns collection. + * + * @example + * forEach({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'a' then 'b'. + */ +declare function forEach(collection: ArrayLike, iteratee?: ListIterator): ArrayLike; +/** + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * + * @template T + * @param {T} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns object. + * + * @example + * forEach({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'a' then 'b'. + */ +declare function forEach(collection: T, iteratee?: ObjectIterator): T; +/** + * Iterates over elements of array and invokes iteratee for each element. + * + * @template T, U + * @param {U & (T[] | null | undefined)} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {U} Returns the array. + * + * @example + * forEach([1, 2], value => console.log(value)); + * // => Logs `1` then `2`. + */ +declare function forEach(collection: U & (T[] | null | undefined), iteratee?: ArrayIterator): U; +/** + * Iterates over characters of string and invokes iteratee for each character. + * + * @template T + * @param {T} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns the string. + * + * @example + * forEach('abc', char => console.log(char)); + * // => Logs 'a', 'b', then 'c'. + */ +declare function forEach(collection: T, iteratee?: StringIterator): T; +/** + * Iterates over elements of collection and invokes iteratee for each element. + * + * @template T, L + * @param {L & (ArrayLike | null | undefined)} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {L} Returns the collection. + * + * @example + * forEach({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'a' then 'b'. + */ +declare function forEach | null | undefined>(collection: L & (ArrayLike | null | undefined), iteratee?: ListIterator): L; +/** + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T | null | undefined} Returns the object. + * + * @example + * forEach({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'a' then 'b'. + */ +declare function forEach(collection: T | null | undefined, iteratee?: ObjectIterator): T | null | undefined; + +export { forEach }; diff --git a/node_modules/es-toolkit/dist/compat/array/forEach.js b/node_modules/es-toolkit/dist/compat/array/forEach.js new file mode 100644 index 0000000000000000000000000000000000000000..ae954d128ef56f9cfb386a58174782bf536fa8c6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const range = require('../../math/range.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function forEach(collection, callback = identity.identity) { + if (!collection) { + return collection; + } + const keys = isArrayLike.isArrayLike(collection) || Array.isArray(collection) ? range.range(0, collection.length) : Object.keys(collection); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + const result = callback(value, key, collection); + if (result === false) { + break; + } + } + return collection; +} + +exports.forEach = forEach; diff --git a/node_modules/es-toolkit/dist/compat/array/forEach.mjs b/node_modules/es-toolkit/dist/compat/array/forEach.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e2713cd6213a66859de77d8cb9bc4fa1bc0123e9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.mjs @@ -0,0 +1,21 @@ +import { identity } from '../../function/identity.mjs'; +import { range } from '../../math/range.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function forEach(collection, callback = identity) { + if (!collection) { + return collection; + } + const keys = isArrayLike(collection) || Array.isArray(collection) ? range(0, collection.length) : Object.keys(collection); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + const result = callback(value, key, collection); + if (result === false) { + break; + } + } + return collection; +} + +export { forEach }; diff --git a/node_modules/es-toolkit/dist/compat/array/forEachRight.d.mts b/node_modules/es-toolkit/dist/compat/array/forEachRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6be227e9212dd075cdfaaba50140142fcb6f1b01 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.d.mts @@ -0,0 +1,110 @@ +import { ArrayIterator } from '../_internal/ArrayIterator.mjs'; +import { ListIterator } from '../_internal/ListIterator.mjs'; +import { ObjectIterator } from '../_internal/ObjectIterator.mjs'; +import { StringIterator } from '../_internal/StringIterator.mjs'; + +/** + * Iterates over elements of array from right to left and invokes iteratee for each element. + * + * @template T + * @param {T[]} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {T[]} Returns array. + * + * @example + * forEachRight([1, 2], value => console.log(value)); + * // => Logs `2` then `1`. + */ +declare function forEachRight(collection: T[], iteratee?: ArrayIterator): T[]; +/** + * Iterates over characters of string from right to left and invokes iteratee for each character. + * + * @param {string} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {string} Returns string. + * + * @example + * forEachRight('abc', char => console.log(char)); + * // => Logs 'c', 'b', then 'a'. + */ +declare function forEachRight(collection: string, iteratee?: StringIterator): string; +/** + * Iterates over elements of collection from right to left and invokes iteratee for each element. + * + * @template T + * @param {ArrayLike} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {ArrayLike} Returns collection. + * + * @example + * forEachRight({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight(collection: ArrayLike, iteratee?: ListIterator): ArrayLike; +/** + * Iterates over own enumerable string keyed properties of an object from right to left and invokes iteratee for each property. + * + * @template T + * @param {T} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns object. + * + * @example + * forEachRight({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight(collection: T, iteratee?: ObjectIterator): T; +/** + * Iterates over elements of array from right to left and invokes iteratee for each element. + * + * @template T, U + * @param {U & (T[] | null | undefined)} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {U} Returns the array. + * + * @example + * forEachRight([1, 2], value => console.log(value)); + * // => Logs `2` then `1`. + */ +declare function forEachRight(collection: U & (T[] | null | undefined), iteratee?: ArrayIterator): U; +/** + * Iterates over characters of string from right to left and invokes iteratee for each character. + * + * @template T + * @param {T} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns the string. + * + * @example + * forEachRight('abc', char => console.log(char)); + * // => Logs 'c', 'b', then 'a'. + */ +declare function forEachRight(collection: T, iteratee?: StringIterator): T; +/** + * Iterates over elements of collection from right to left and invokes iteratee for each element. + * + * @template T, L + * @param {L & (ArrayLike | null | undefined)} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {L} Returns the collection. + * + * @example + * forEachRight({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight | null | undefined>(collection: L & (ArrayLike | null | undefined), iteratee?: ListIterator): L; +/** + * Iterates over own enumerable string keyed properties of an object from right to left and invokes iteratee for each property. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T | null | undefined} Returns the object. + * + * @example + * forEachRight({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight(collection: T | null | undefined, iteratee?: ObjectIterator): T | null | undefined; + +export { forEachRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/forEachRight.d.ts b/node_modules/es-toolkit/dist/compat/array/forEachRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a4d452d78a11385db6eece17fd8051af4b1010d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.d.ts @@ -0,0 +1,110 @@ +import { ArrayIterator } from '../_internal/ArrayIterator.js'; +import { ListIterator } from '../_internal/ListIterator.js'; +import { ObjectIterator } from '../_internal/ObjectIterator.js'; +import { StringIterator } from '../_internal/StringIterator.js'; + +/** + * Iterates over elements of array from right to left and invokes iteratee for each element. + * + * @template T + * @param {T[]} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {T[]} Returns array. + * + * @example + * forEachRight([1, 2], value => console.log(value)); + * // => Logs `2` then `1`. + */ +declare function forEachRight(collection: T[], iteratee?: ArrayIterator): T[]; +/** + * Iterates over characters of string from right to left and invokes iteratee for each character. + * + * @param {string} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {string} Returns string. + * + * @example + * forEachRight('abc', char => console.log(char)); + * // => Logs 'c', 'b', then 'a'. + */ +declare function forEachRight(collection: string, iteratee?: StringIterator): string; +/** + * Iterates over elements of collection from right to left and invokes iteratee for each element. + * + * @template T + * @param {ArrayLike} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {ArrayLike} Returns collection. + * + * @example + * forEachRight({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight(collection: ArrayLike, iteratee?: ListIterator): ArrayLike; +/** + * Iterates over own enumerable string keyed properties of an object from right to left and invokes iteratee for each property. + * + * @template T + * @param {T} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns object. + * + * @example + * forEachRight({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight(collection: T, iteratee?: ObjectIterator): T; +/** + * Iterates over elements of array from right to left and invokes iteratee for each element. + * + * @template T, U + * @param {U & (T[] | null | undefined)} collection - The array to iterate over. + * @param {ArrayIterator} [iteratee] - The function invoked per iteration. + * @returns {U} Returns the array. + * + * @example + * forEachRight([1, 2], value => console.log(value)); + * // => Logs `2` then `1`. + */ +declare function forEachRight(collection: U & (T[] | null | undefined), iteratee?: ArrayIterator): U; +/** + * Iterates over characters of string from right to left and invokes iteratee for each character. + * + * @template T + * @param {T} collection - The string to iterate over. + * @param {StringIterator} [iteratee] - The function invoked per iteration. + * @returns {T} Returns the string. + * + * @example + * forEachRight('abc', char => console.log(char)); + * // => Logs 'c', 'b', then 'a'. + */ +declare function forEachRight(collection: T, iteratee?: StringIterator): T; +/** + * Iterates over elements of collection from right to left and invokes iteratee for each element. + * + * @template T, L + * @param {L & (ArrayLike | null | undefined)} collection - The collection to iterate over. + * @param {ListIterator} [iteratee] - The function invoked per iteration. + * @returns {L} Returns the collection. + * + * @example + * forEachRight({ 0: 'a', 1: 'b', length: 2 }, value => console.log(value)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight | null | undefined>(collection: L & (ArrayLike | null | undefined), iteratee?: ListIterator): L; +/** + * Iterates over own enumerable string keyed properties of an object from right to left and invokes iteratee for each property. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterator} [iteratee] - The function invoked per iteration. + * @returns {T | null | undefined} Returns the object. + * + * @example + * forEachRight({ a: 1, b: 2 }, (value, key) => console.log(key)); + * // => Logs 'b' then 'a'. + */ +declare function forEachRight(collection: T | null | undefined, iteratee?: ObjectIterator): T | null | undefined; + +export { forEachRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/forEachRight.js b/node_modules/es-toolkit/dist/compat/array/forEachRight.js new file mode 100644 index 0000000000000000000000000000000000000000..8cf57bad968307297397cd5c99e7b5b1219dc297 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const range = require('../../math/range.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function forEachRight(collection, callback = identity.identity) { + if (!collection) { + return collection; + } + const keys = isArrayLike.isArrayLike(collection) ? range.range(0, collection.length) : Object.keys(collection); + for (let i = keys.length - 1; i >= 0; i--) { + const key = keys[i]; + const value = collection[key]; + const result = callback(value, key, collection); + if (result === false) { + break; + } + } + return collection; +} + +exports.forEachRight = forEachRight; diff --git a/node_modules/es-toolkit/dist/compat/array/forEachRight.mjs b/node_modules/es-toolkit/dist/compat/array/forEachRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..33752e0e5e526556a9f8f6d6bd56468ad6631cab --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.mjs @@ -0,0 +1,21 @@ +import { identity } from '../../function/identity.mjs'; +import { range } from '../../math/range.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function forEachRight(collection, callback = identity) { + if (!collection) { + return collection; + } + const keys = isArrayLike(collection) ? range(0, collection.length) : Object.keys(collection); + for (let i = keys.length - 1; i >= 0; i--) { + const key = keys[i]; + const value = collection[key]; + const result = callback(value, key, collection); + if (result === false) { + break; + } + } + return collection; +} + +export { forEachRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/groupBy.d.mts b/node_modules/es-toolkit/dist/compat/array/groupBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2d3403b27e5466400fc74e6cb66169601f4578ca --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.d.mts @@ -0,0 +1,35 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * Creates an object composed of keys generated from the results of running each element of collection through iteratee. + * The order of grouped values is determined by the order they occur in collection. + * + * @template T - The type of elements in the array-like collection + * @param {ArrayLike | null | undefined} collection - The collection to iterate over + * @param {ValueIteratee} [iteratee=identity] - The iteratee to transform keys + * @returns {Record} Returns the composed aggregate object + * + * @example + * groupBy([6.1, 4.2, 6.3], Math.floor) + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * groupBy(['one', 'two', 'three'], 'length') + * // => { '3': ['one', 'two'], '5': ['three'] } + */ +declare function groupBy(collection: ArrayLike | null | undefined, iteratee?: ValueIteratee): Record; +/** + * Creates an object composed of keys generated from the results of running each element of collection through iteratee. + * The order of grouped values is determined by the order they occur in collection. + * + * @template T - The type of the object + * @param {T | null | undefined} collection - The object to iterate over + * @param {ValueIteratee} [iteratee=identity] - The iteratee to transform keys + * @returns {Record>} Returns the composed aggregate object + * + * @example + * groupBy({ a: 6.1, b: 4.2, c: 6.3 }, Math.floor) + * // => { '4': [4.2], '6': [6.1, 6.3] } + */ +declare function groupBy(collection: T | null | undefined, iteratee?: ValueIteratee): Record>; + +export { groupBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/groupBy.d.ts b/node_modules/es-toolkit/dist/compat/array/groupBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5272fd7c6a35eb54a91cdf4dc1a14dda835698c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.d.ts @@ -0,0 +1,35 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * Creates an object composed of keys generated from the results of running each element of collection through iteratee. + * The order of grouped values is determined by the order they occur in collection. + * + * @template T - The type of elements in the array-like collection + * @param {ArrayLike | null | undefined} collection - The collection to iterate over + * @param {ValueIteratee} [iteratee=identity] - The iteratee to transform keys + * @returns {Record} Returns the composed aggregate object + * + * @example + * groupBy([6.1, 4.2, 6.3], Math.floor) + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * groupBy(['one', 'two', 'three'], 'length') + * // => { '3': ['one', 'two'], '5': ['three'] } + */ +declare function groupBy(collection: ArrayLike | null | undefined, iteratee?: ValueIteratee): Record; +/** + * Creates an object composed of keys generated from the results of running each element of collection through iteratee. + * The order of grouped values is determined by the order they occur in collection. + * + * @template T - The type of the object + * @param {T | null | undefined} collection - The object to iterate over + * @param {ValueIteratee} [iteratee=identity] - The iteratee to transform keys + * @returns {Record>} Returns the composed aggregate object + * + * @example + * groupBy({ a: 6.1, b: 4.2, c: 6.3 }, Math.floor) + * // => { '4': [4.2], '6': [6.1, 6.3] } + */ +declare function groupBy(collection: T | null | undefined, iteratee?: ValueIteratee): Record>; + +export { groupBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/groupBy.js b/node_modules/es-toolkit/dist/compat/array/groupBy.js new file mode 100644 index 0000000000000000000000000000000000000000..5dbecbde50adca7a22bc178f74e5c691e1f9c07e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const groupBy$1 = require('../../array/groupBy.js'); +const identity = require('../../function/identity.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const iteratee = require('../util/iteratee.js'); + +function groupBy(source, _getKeyFromItem) { + if (source == null) { + return {}; + } + const items = isArrayLike.isArrayLike(source) ? Array.from(source) : Object.values(source); + const getKeyFromItem = iteratee.iteratee(_getKeyFromItem ?? identity.identity); + return groupBy$1.groupBy(items, getKeyFromItem); +} + +exports.groupBy = groupBy; diff --git a/node_modules/es-toolkit/dist/compat/array/groupBy.mjs b/node_modules/es-toolkit/dist/compat/array/groupBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9945a91c951b23d2f26cccc207dd1698e05a4111 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.mjs @@ -0,0 +1,15 @@ +import { groupBy as groupBy$1 } from '../../array/groupBy.mjs'; +import { identity } from '../../function/identity.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function groupBy(source, _getKeyFromItem) { + if (source == null) { + return {}; + } + const items = isArrayLike(source) ? Array.from(source) : Object.values(source); + const getKeyFromItem = iteratee(_getKeyFromItem ?? identity); + return groupBy$1(items, getKeyFromItem); +} + +export { groupBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/head.d.mts b/node_modules/es-toolkit/dist/compat/array/head.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0b59f8aa8b4fbb786028900a0f2a216de1630001 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.d.mts @@ -0,0 +1,32 @@ +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * @template T - The type of elements in the array. + * @param {readonly [T, ...unknown[]]} array - A non-empty tuple with at least one element. + * @returns {T} The first element of the array. + * + * @example + * const arr = [1, 2, 3] as const; + * const first = head(arr); + * // first will be 1 + */ +declare function head(array: readonly [T, ...unknown[]]): T; +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array from which to get the first element. + * @returns {T | undefined} The first element of the array, or `undefined` if the array is empty/null/undefined. + * + * @example + * const arr = [1, 2, 3]; + * const first = head(arr); + * // first will be 1 + * + * const emptyArr: number[] = []; + * const noElement = head(emptyArr); + * // noElement will be undefined + */ +declare function head(array: ArrayLike | null | undefined): T | undefined; + +export { head }; diff --git a/node_modules/es-toolkit/dist/compat/array/head.d.ts b/node_modules/es-toolkit/dist/compat/array/head.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b59f8aa8b4fbb786028900a0f2a216de1630001 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.d.ts @@ -0,0 +1,32 @@ +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * @template T - The type of elements in the array. + * @param {readonly [T, ...unknown[]]} array - A non-empty tuple with at least one element. + * @returns {T} The first element of the array. + * + * @example + * const arr = [1, 2, 3] as const; + * const first = head(arr); + * // first will be 1 + */ +declare function head(array: readonly [T, ...unknown[]]): T; +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array from which to get the first element. + * @returns {T | undefined} The first element of the array, or `undefined` if the array is empty/null/undefined. + * + * @example + * const arr = [1, 2, 3]; + * const first = head(arr); + * // first will be 1 + * + * const emptyArr: number[] = []; + * const noElement = head(emptyArr); + * // noElement will be undefined + */ +declare function head(array: ArrayLike | null | undefined): T | undefined; + +export { head }; diff --git a/node_modules/es-toolkit/dist/compat/array/head.js b/node_modules/es-toolkit/dist/compat/array/head.js new file mode 100644 index 0000000000000000000000000000000000000000..5e333ead08e0bb5f1c59e2a240a008aefcb2e1b6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const head$1 = require('../../array/head.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function head(arr) { + if (!isArrayLike.isArrayLike(arr)) { + return undefined; + } + return head$1.head(toArray.toArray(arr)); +} + +exports.head = head; diff --git a/node_modules/es-toolkit/dist/compat/array/head.mjs b/node_modules/es-toolkit/dist/compat/array/head.mjs new file mode 100644 index 0000000000000000000000000000000000000000..53069969fad604c4904b991cd1ebde415e811fa5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.mjs @@ -0,0 +1,12 @@ +import { head as head$1 } from '../../array/head.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function head(arr) { + if (!isArrayLike(arr)) { + return undefined; + } + return head$1(toArray(arr)); +} + +export { head }; diff --git a/node_modules/es-toolkit/dist/compat/array/includes.d.mts b/node_modules/es-toolkit/dist/compat/array/includes.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2f733487c4f974f2c7cbd464be98c3efb6868d1b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.d.mts @@ -0,0 +1,22 @@ +/** + * Checks if a specified value exists within a given array-like collection. + * + * The comparison uses SameValueZero to check for inclusion. + * + * @template T The type of elements in the collection + * @param collection The array-like collection to search in + * @param target The value to search for in the collection + * @param [fromIndex=0] The index to start searching from. If negative, it is treated as an offset from the end + * @returns `true` if the value is found in the collection, `false` otherwise + * + * @example + * includes([1, 2, 3], 2); // true + * includes([1, 2, 3], 4); // false + * includes('hello', 'e'); // true + * includes(null, 1); // false + * includes([1, 2, 3], 2, 2); // false + * includes([1, 2, 3], 2, -2); // true + */ +declare function includes(collection: Record | Record | null | undefined, target: T, fromIndex?: number): boolean; + +export { includes }; diff --git a/node_modules/es-toolkit/dist/compat/array/includes.d.ts b/node_modules/es-toolkit/dist/compat/array/includes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f733487c4f974f2c7cbd464be98c3efb6868d1b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.d.ts @@ -0,0 +1,22 @@ +/** + * Checks if a specified value exists within a given array-like collection. + * + * The comparison uses SameValueZero to check for inclusion. + * + * @template T The type of elements in the collection + * @param collection The array-like collection to search in + * @param target The value to search for in the collection + * @param [fromIndex=0] The index to start searching from. If negative, it is treated as an offset from the end + * @returns `true` if the value is found in the collection, `false` otherwise + * + * @example + * includes([1, 2, 3], 2); // true + * includes([1, 2, 3], 4); // false + * includes('hello', 'e'); // true + * includes(null, 1); // false + * includes([1, 2, 3], 2, 2); // false + * includes([1, 2, 3], 2, -2); // true + */ +declare function includes(collection: Record | Record | null | undefined, target: T, fromIndex?: number): boolean; + +export { includes }; diff --git a/node_modules/es-toolkit/dist/compat/array/includes.js b/node_modules/es-toolkit/dist/compat/array/includes.js new file mode 100644 index 0000000000000000000000000000000000000000..2f602bc5dc70496183f44b1ccfdd1392be8785d9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.js @@ -0,0 +1,44 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isString = require('../predicate/isString.js'); +const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js'); +const toInteger = require('../util/toInteger.js'); + +function includes(source, target, fromIndex, guard) { + if (source == null) { + return false; + } + if (guard || !fromIndex) { + fromIndex = 0; + } + else { + fromIndex = toInteger.toInteger(fromIndex); + } + if (isString.isString(source)) { + if (fromIndex > source.length || target instanceof RegExp) { + return false; + } + if (fromIndex < 0) { + fromIndex = Math.max(0, source.length + fromIndex); + } + return source.includes(target, fromIndex); + } + if (Array.isArray(source)) { + return source.includes(target, fromIndex); + } + const keys = Object.keys(source); + if (fromIndex < 0) { + fromIndex = Math.max(0, keys.length + fromIndex); + } + for (let i = fromIndex; i < keys.length; i++) { + const value = Reflect.get(source, keys[i]); + if (isEqualsSameValueZero.isEqualsSameValueZero(value, target)) { + return true; + } + } + return false; +} + +exports.includes = includes; diff --git a/node_modules/es-toolkit/dist/compat/array/includes.mjs b/node_modules/es-toolkit/dist/compat/array/includes.mjs new file mode 100644 index 0000000000000000000000000000000000000000..859fd8c64d30fb89552ee90856107e461d536420 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.mjs @@ -0,0 +1,40 @@ +import { isString } from '../predicate/isString.mjs'; +import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function includes(source, target, fromIndex, guard) { + if (source == null) { + return false; + } + if (guard || !fromIndex) { + fromIndex = 0; + } + else { + fromIndex = toInteger(fromIndex); + } + if (isString(source)) { + if (fromIndex > source.length || target instanceof RegExp) { + return false; + } + if (fromIndex < 0) { + fromIndex = Math.max(0, source.length + fromIndex); + } + return source.includes(target, fromIndex); + } + if (Array.isArray(source)) { + return source.includes(target, fromIndex); + } + const keys = Object.keys(source); + if (fromIndex < 0) { + fromIndex = Math.max(0, keys.length + fromIndex); + } + for (let i = fromIndex; i < keys.length; i++) { + const value = Reflect.get(source, keys[i]); + if (isEqualsSameValueZero(value, target)) { + return true; + } + } + return false; +} + +export { includes }; diff --git a/node_modules/es-toolkit/dist/compat/array/indexOf.d.mts b/node_modules/es-toolkit/dist/compat/array/indexOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b6617487ac34ba2f5199711b2ba94ccc7adeef26 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.d.mts @@ -0,0 +1,20 @@ +/** + * Finds the index of the first occurrence of a value in an array. + * + * This method is similar to `Array.prototype.indexOf`, but it also finds `NaN` values. + * It uses strict equality (`===`) to compare elements. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to search. + * @param {T} searchElement - The value to search for. + * @param {number} [fromIndex] - The index to start the search at. + * @returns {number} The index (zero-based) of the first occurrence of the value in the array, or `-1` if the value is not found. + * + * @example + * const array = [1, 2, 3, NaN]; + * indexOf(array, 3); // => 2 + * indexOf(array, NaN); // => 3 + */ +declare function indexOf(array: ArrayLike | null | undefined, searchElement: T, fromIndex?: number): number; + +export { indexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/indexOf.d.ts b/node_modules/es-toolkit/dist/compat/array/indexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6617487ac34ba2f5199711b2ba94ccc7adeef26 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.d.ts @@ -0,0 +1,20 @@ +/** + * Finds the index of the first occurrence of a value in an array. + * + * This method is similar to `Array.prototype.indexOf`, but it also finds `NaN` values. + * It uses strict equality (`===`) to compare elements. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to search. + * @param {T} searchElement - The value to search for. + * @param {number} [fromIndex] - The index to start the search at. + * @returns {number} The index (zero-based) of the first occurrence of the value in the array, or `-1` if the value is not found. + * + * @example + * const array = [1, 2, 3, NaN]; + * indexOf(array, 3); // => 2 + * indexOf(array, NaN); // => 3 + */ +declare function indexOf(array: ArrayLike | null | undefined, searchElement: T, fromIndex?: number): number; + +export { indexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/indexOf.js b/node_modules/es-toolkit/dist/compat/array/indexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..beb85f2ada80071188452ac8dcf430fed5516101 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLike = require('../predicate/isArrayLike.js'); + +function indexOf(array, searchElement, fromIndex) { + if (!isArrayLike.isArrayLike(array)) { + return -1; + } + if (Number.isNaN(searchElement)) { + fromIndex = fromIndex ?? 0; + if (fromIndex < 0) { + fromIndex = Math.max(0, array.length + fromIndex); + } + for (let i = fromIndex; i < array.length; i++) { + if (Number.isNaN(array[i])) { + return i; + } + } + return -1; + } + return Array.from(array).indexOf(searchElement, fromIndex); +} + +exports.indexOf = indexOf; diff --git a/node_modules/es-toolkit/dist/compat/array/indexOf.mjs b/node_modules/es-toolkit/dist/compat/array/indexOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4c3a4ca7975999c74dc27b82b7ed1f292026fb5e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.mjs @@ -0,0 +1,22 @@ +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function indexOf(array, searchElement, fromIndex) { + if (!isArrayLike(array)) { + return -1; + } + if (Number.isNaN(searchElement)) { + fromIndex = fromIndex ?? 0; + if (fromIndex < 0) { + fromIndex = Math.max(0, array.length + fromIndex); + } + for (let i = fromIndex; i < array.length; i++) { + if (Number.isNaN(array[i])) { + return i; + } + } + return -1; + } + return Array.from(array).indexOf(searchElement, fromIndex); +} + +export { indexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/initial.d.mts b/node_modules/es-toolkit/dist/compat/array/initial.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..115b5bd62fa5df17cd33473ba7c6fb4f299cb9f8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.d.mts @@ -0,0 +1,16 @@ +/** + * Returns a new array containing all elements except the last one from the input array. + * If the input array is empty or has only one element, the function returns an empty array. + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The input array. + * @returns {T[]} A new array containing all but the last element of the input array. + * + * @example + * const arr = [1, 2, 3, 4]; + * const result = initial(arr); + * // result will be [1, 2, 3] + */ +declare function initial(arr: ArrayLike | null | undefined): T[]; + +export { initial }; diff --git a/node_modules/es-toolkit/dist/compat/array/initial.d.ts b/node_modules/es-toolkit/dist/compat/array/initial.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..115b5bd62fa5df17cd33473ba7c6fb4f299cb9f8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.d.ts @@ -0,0 +1,16 @@ +/** + * Returns a new array containing all elements except the last one from the input array. + * If the input array is empty or has only one element, the function returns an empty array. + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The input array. + * @returns {T[]} A new array containing all but the last element of the input array. + * + * @example + * const arr = [1, 2, 3, 4]; + * const result = initial(arr); + * // result will be [1, 2, 3] + */ +declare function initial(arr: ArrayLike | null | undefined): T[]; + +export { initial }; diff --git a/node_modules/es-toolkit/dist/compat/array/initial.js b/node_modules/es-toolkit/dist/compat/array/initial.js new file mode 100644 index 0000000000000000000000000000000000000000..9e5bf9a2810b9e18d37160d4aac4ef6a1ea87f1d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const initial$1 = require('../../array/initial.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function initial(arr) { + if (!isArrayLike.isArrayLike(arr)) { + return []; + } + return initial$1.initial(Array.from(arr)); +} + +exports.initial = initial; diff --git a/node_modules/es-toolkit/dist/compat/array/initial.mjs b/node_modules/es-toolkit/dist/compat/array/initial.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7725ca9cfd0058b927c064a4d3122e17abebdab1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.mjs @@ -0,0 +1,11 @@ +import { initial as initial$1 } from '../../array/initial.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function initial(arr) { + if (!isArrayLike(arr)) { + return []; + } + return initial$1(Array.from(arr)); +} + +export { initial }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersection.d.mts b/node_modules/es-toolkit/dist/compat/array/intersection.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..98121840d8de67344fb55ce767453a6890e26044 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.d.mts @@ -0,0 +1,20 @@ +/** + * Returns the intersection of multiple arrays. + * + * This function takes multiple arrays and returns a new array containing the elements that are + * present in all provided arrays. It effectively filters out any elements that are not found + * in every array. + * + * @template T - The type of elements in the arrays. + * @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. + * @returns {T[]} A new array containing the elements that are present in all arrays. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [3, 4, 5, 6, 7]; + * const result = intersection(array1, array2); + * // result will be [3, 4, 5] since these elements are in both arrays. + */ +declare function intersection(...arrays: Array | null | undefined>): T[]; + +export { intersection }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersection.d.ts b/node_modules/es-toolkit/dist/compat/array/intersection.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..98121840d8de67344fb55ce767453a6890e26044 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.d.ts @@ -0,0 +1,20 @@ +/** + * Returns the intersection of multiple arrays. + * + * This function takes multiple arrays and returns a new array containing the elements that are + * present in all provided arrays. It effectively filters out any elements that are not found + * in every array. + * + * @template T - The type of elements in the arrays. + * @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. + * @returns {T[]} A new array containing the elements that are present in all arrays. + * + * @example + * const array1 = [1, 2, 3, 4, 5]; + * const array2 = [3, 4, 5, 6, 7]; + * const result = intersection(array1, array2); + * // result will be [3, 4, 5] since these elements are in both arrays. + */ +declare function intersection(...arrays: Array | null | undefined>): T[]; + +export { intersection }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersection.js b/node_modules/es-toolkit/dist/compat/array/intersection.js new file mode 100644 index 0000000000000000000000000000000000000000..598f4e2ae408cdc2ffc08d364e462762ae100427 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const intersection$1 = require('../../array/intersection.js'); +const uniq = require('../../array/uniq.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function intersection(...arrays) { + if (arrays.length === 0) { + return []; + } + if (!isArrayLikeObject.isArrayLikeObject(arrays[0])) { + return []; + } + let result = uniq.uniq(Array.from(arrays[0])); + for (let i = 1; i < arrays.length; i++) { + const array = arrays[i]; + if (!isArrayLikeObject.isArrayLikeObject(array)) { + return []; + } + result = intersection$1.intersection(result, Array.from(array)); + } + return result; +} + +exports.intersection = intersection; diff --git a/node_modules/es-toolkit/dist/compat/array/intersection.mjs b/node_modules/es-toolkit/dist/compat/array/intersection.mjs new file mode 100644 index 0000000000000000000000000000000000000000..feae1f014c15bee4ed3bb844590267dcfa256726 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.mjs @@ -0,0 +1,23 @@ +import { intersection as intersection$1 } from '../../array/intersection.mjs'; +import { uniq } from '../../array/uniq.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function intersection(...arrays) { + if (arrays.length === 0) { + return []; + } + if (!isArrayLikeObject(arrays[0])) { + return []; + } + let result = uniq(Array.from(arrays[0])); + for (let i = 1; i < arrays.length; i++) { + const array = arrays[i]; + if (!isArrayLikeObject(array)) { + return []; + } + result = intersection$1(result, Array.from(array)); + } + return result; +} + +export { intersection }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.mts b/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4473a87e9560cc310bf1803ce6dc0fbf2c2aa6aa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.mts @@ -0,0 +1,73 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U + * @param {ArrayLike | null} array - The array to inspect. + * @param {ArrayLike} values - The values to compare. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(array: ArrayLike | null, values: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U, V + * @param {ArrayLike | null} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], [2.5], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(array: ArrayLike | null, values1: ArrayLike, values2: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U, V, W + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {...Array | ValueIteratee>} values - The other arrays to compare, and the iteratee to use. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], [2.5], [2.6, 1.7], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, ...values: Array | ValueIteratee>): T[]; +/** + * Creates an array of unique values that are included in all given arrays. + * + * @template T + * @param {ArrayLike | null} [array] - The array to inspect. + * @param {...Array>} values - The values to compare. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2, 1], [2, 3]); + * // => [2] + */ +declare function intersectionBy(array?: ArrayLike | null, ...values: Array>): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T + * @param {...Array | ValueIteratee>} values - The arrays to compare and the iteratee to use. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(...values: Array | ValueIteratee>): T[]; + +export { intersectionBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.ts b/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..79057e60c3f2a8a900f6b91dab50a2b0274bb730 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.ts @@ -0,0 +1,73 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U + * @param {ArrayLike | null} array - The array to inspect. + * @param {ArrayLike} values - The values to compare. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(array: ArrayLike | null, values: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U, V + * @param {ArrayLike | null} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], [2.5], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(array: ArrayLike | null, values1: ArrayLike, values2: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U, V, W + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {...Array | ValueIteratee>} values - The other arrays to compare, and the iteratee to use. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], [2.5], [2.6, 1.7], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, ...values: Array | ValueIteratee>): T[]; +/** + * Creates an array of unique values that are included in all given arrays. + * + * @template T + * @param {ArrayLike | null} [array] - The array to inspect. + * @param {...Array>} values - The values to compare. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2, 1], [2, 3]); + * // => [2] + */ +declare function intersectionBy(array?: ArrayLike | null, ...values: Array>): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T + * @param {...Array | ValueIteratee>} values - The arrays to compare and the iteratee to use. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + */ +declare function intersectionBy(...values: Array | ValueIteratee>): T[]; + +export { intersectionBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionBy.js b/node_modules/es-toolkit/dist/compat/array/intersectionBy.js new file mode 100644 index 0000000000000000000000000000000000000000..9edba43a178d31492c63ef5d4f4bcf30a47fcffe --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const intersectionBy$1 = require('../../array/intersectionBy.js'); +const last = require('../../array/last.js'); +const uniq = require('../../array/uniq.js'); +const identity = require('../../function/identity.js'); +const property = require('../object/property.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function intersectionBy(array, ...values) { + if (!isArrayLikeObject.isArrayLikeObject(array)) { + return []; + } + const lastValue = last.last(values); + if (lastValue === undefined) { + return Array.from(array); + } + let result = uniq.uniq(Array.from(array)); + const count = isArrayLikeObject.isArrayLikeObject(lastValue) ? values.length : values.length - 1; + for (let i = 0; i < count; ++i) { + const value = values[i]; + if (!isArrayLikeObject.isArrayLikeObject(value)) { + return []; + } + if (isArrayLikeObject.isArrayLikeObject(lastValue)) { + result = intersectionBy$1.intersectionBy(result, Array.from(value), identity.identity); + } + else if (typeof lastValue === 'function') { + result = intersectionBy$1.intersectionBy(result, Array.from(value), value => lastValue(value)); + } + else if (typeof lastValue === 'string') { + result = intersectionBy$1.intersectionBy(result, Array.from(value), property.property(lastValue)); + } + } + return result; +} + +exports.intersectionBy = intersectionBy; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionBy.mjs b/node_modules/es-toolkit/dist/compat/array/intersectionBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d02762b86c4fb9d2502b5630245cb2d1eb69fe94 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.mjs @@ -0,0 +1,36 @@ +import { intersectionBy as intersectionBy$1 } from '../../array/intersectionBy.mjs'; +import { last } from '../../array/last.mjs'; +import { uniq } from '../../array/uniq.mjs'; +import { identity } from '../../function/identity.mjs'; +import { property } from '../object/property.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function intersectionBy(array, ...values) { + if (!isArrayLikeObject(array)) { + return []; + } + const lastValue = last(values); + if (lastValue === undefined) { + return Array.from(array); + } + let result = uniq(Array.from(array)); + const count = isArrayLikeObject(lastValue) ? values.length : values.length - 1; + for (let i = 0; i < count; ++i) { + const value = values[i]; + if (!isArrayLikeObject(value)) { + return []; + } + if (isArrayLikeObject(lastValue)) { + result = intersectionBy$1(result, Array.from(value), identity); + } + else if (typeof lastValue === 'function') { + result = intersectionBy$1(result, Array.from(value), value => lastValue(value)); + } + else if (typeof lastValue === 'string') { + result = intersectionBy$1(result, Array.from(value), property(lastValue)); + } + } + return result; +} + +export { intersectionBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.mts b/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f50211a800bf7b916159eeff7e7b48a2c709a323 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.mts @@ -0,0 +1,68 @@ +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values - The values to compare. + * @param {(a: T, b: T | U) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * intersectionWith(objects, others, (a, b) => a.x === b.x && a.y === b.y); + * // => [{ 'x': 1, 'y': 2 }] + */ +declare function intersectionWith(array: ArrayLike | null | undefined, values: ArrayLike, comparator: (a: T, b: T | U) => boolean): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U, V + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {(a: T, b: T | U | V) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others1 = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * const others2 = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }]; + * intersectionWith(objects, others1, others2, (a, b) => a.x === b.x && a.y === b.y); + * // => [{ 'x': 1, 'y': 2 }] + */ +declare function intersectionWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, comparator: (a: T, b: T | U | V) => boolean): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U, V, W + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {...Array | (a: T, b: T | U | V | W) => boolean>} values - The other arrays to compare, and the comparator to use. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others1 = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * const others2 = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }]; + * const others3 = [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]; + * intersectionWith(objects, others1, others2, others3, (a, b) => a.x === b.x && a.y === b.y); + * // => [{ 'x': 1, 'y': 2 }] + */ +declare function intersectionWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, ...values: Array | ((a: T, b: T | U | V | W) => boolean)>): T[]; +/** + * Creates an array of unique values that are included in all given arrays. + * + * @template T + * @param {ArrayLike | null} [array] - The array to inspect. + * @param {...Array | (a: T, b: never) => boolean>} values - The values to compare. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionWith([2, 1], [2, 3]); + * // => [2] + */ +declare function intersectionWith(array?: ArrayLike | null, ...values: Array | ((a: T, b: never) => boolean)>): T[]; + +export { intersectionWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.ts b/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f50211a800bf7b916159eeff7e7b48a2c709a323 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.ts @@ -0,0 +1,68 @@ +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values - The values to compare. + * @param {(a: T, b: T | U) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * intersectionWith(objects, others, (a, b) => a.x === b.x && a.y === b.y); + * // => [{ 'x': 1, 'y': 2 }] + */ +declare function intersectionWith(array: ArrayLike | null | undefined, values: ArrayLike, comparator: (a: T, b: T | U) => boolean): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U, V + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {(a: T, b: T | U | V) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others1 = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * const others2 = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }]; + * intersectionWith(objects, others1, others2, (a, b) => a.x === b.x && a.y === b.y); + * // => [{ 'x': 1, 'y': 2 }] + */ +declare function intersectionWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, comparator: (a: T, b: T | U | V) => boolean): T[]; +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U, V, W + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ArrayLike} values1 - The first values to compare. + * @param {ArrayLike} values2 - The second values to compare. + * @param {...Array | (a: T, b: T | U | V | W) => boolean>} values - The other arrays to compare, and the comparator to use. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others1 = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * const others2 = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }]; + * const others3 = [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]; + * intersectionWith(objects, others1, others2, others3, (a, b) => a.x === b.x && a.y === b.y); + * // => [{ 'x': 1, 'y': 2 }] + */ +declare function intersectionWith(array: ArrayLike | null | undefined, values1: ArrayLike, values2: ArrayLike, ...values: Array | ((a: T, b: T | U | V | W) => boolean)>): T[]; +/** + * Creates an array of unique values that are included in all given arrays. + * + * @template T + * @param {ArrayLike | null} [array] - The array to inspect. + * @param {...Array | (a: T, b: never) => boolean>} values - The values to compare. + * @returns {T[]} Returns the new array of intersecting values. + * + * @example + * intersectionWith([2, 1], [2, 3]); + * // => [2] + */ +declare function intersectionWith(array?: ArrayLike | null, ...values: Array | ((a: T, b: never) => boolean)>): T[]; + +export { intersectionWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionWith.js b/node_modules/es-toolkit/dist/compat/array/intersectionWith.js new file mode 100644 index 0000000000000000000000000000000000000000..369590fa116c13228170faafca69ff5d427cd38c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const last = require('./last.js'); +const intersectionWith$1 = require('../../array/intersectionWith.js'); +const uniq = require('./uniq.js'); +const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js'); + +function intersectionWith(firstArr, ...otherArrs) { + if (firstArr == null) { + return []; + } + const _comparator = last.last(otherArrs); + let comparator = isEqualsSameValueZero.isEqualsSameValueZero; + let uniq$1 = uniq.uniq; + if (typeof _comparator === 'function') { + comparator = _comparator; + uniq$1 = uniqPreserve0; + otherArrs.pop(); + } + let result = uniq$1(Array.from(firstArr)); + for (let i = 0; i < otherArrs.length; ++i) { + const otherArr = otherArrs[i]; + if (otherArr == null) { + return []; + } + result = intersectionWith$1.intersectionWith(result, Array.from(otherArr), comparator); + } + return result; +} +function uniqPreserve0(arr) { + const result = []; + const added = new Set(); + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (added.has(item)) { + continue; + } + result.push(item); + added.add(item); + } + return result; +} + +exports.intersectionWith = intersectionWith; diff --git a/node_modules/es-toolkit/dist/compat/array/intersectionWith.mjs b/node_modules/es-toolkit/dist/compat/array/intersectionWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c2ed16ace6adb16ec77969b9bfd3cc5b8c8f75a5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.mjs @@ -0,0 +1,42 @@ +import { last } from './last.mjs'; +import { intersectionWith as intersectionWith$1 } from '../../array/intersectionWith.mjs'; +import { uniq } from './uniq.mjs'; +import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs'; + +function intersectionWith(firstArr, ...otherArrs) { + if (firstArr == null) { + return []; + } + const _comparator = last(otherArrs); + let comparator = isEqualsSameValueZero; + let uniq$1 = uniq; + if (typeof _comparator === 'function') { + comparator = _comparator; + uniq$1 = uniqPreserve0; + otherArrs.pop(); + } + let result = uniq$1(Array.from(firstArr)); + for (let i = 0; i < otherArrs.length; ++i) { + const otherArr = otherArrs[i]; + if (otherArr == null) { + return []; + } + result = intersectionWith$1(result, Array.from(otherArr), comparator); + } + return result; +} +function uniqPreserve0(arr) { + const result = []; + const added = new Set(); + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (added.has(item)) { + continue; + } + result.push(item); + added.add(item); + } + return result; +} + +export { intersectionWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/invokeMap.d.mts b/node_modules/es-toolkit/dist/compat/array/invokeMap.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fa3234e51703a9e146653449f861f1e5aca50b5e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.d.mts @@ -0,0 +1,32 @@ +/** + * Invokes the method at path of each element in collection. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} methodName - The name of the method to invoke. + * @param {...any[]} args - The arguments to invoke each method with. + * @returns {any[]} Returns the array of results. + * + * @example + * invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * invokeMap([123, 456], 'toString', 2); + * // => ['1111011', '111001000'] + */ +declare function invokeMap(collection: object | null | undefined, methodName: string, ...args: any[]): any[]; +/** + * Invokes the method at path of each element in collection. + * + * @template R + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {(...args: any[]) => R} method - The method to invoke. + * @param {...any[]} args - The arguments to invoke each method with. + * @returns {R[]} Returns the array of results. + * + * @example + * invokeMap([5, 1, 7], Array.prototype.slice, 1); + * // => [[], [], []] + */ +declare function invokeMap(collection: object | null | undefined, method: (...args: any[]) => R, ...args: any[]): R[]; + +export { invokeMap }; diff --git a/node_modules/es-toolkit/dist/compat/array/invokeMap.d.ts b/node_modules/es-toolkit/dist/compat/array/invokeMap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fa3234e51703a9e146653449f861f1e5aca50b5e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.d.ts @@ -0,0 +1,32 @@ +/** + * Invokes the method at path of each element in collection. + * + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {string} methodName - The name of the method to invoke. + * @param {...any[]} args - The arguments to invoke each method with. + * @returns {any[]} Returns the array of results. + * + * @example + * invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * invokeMap([123, 456], 'toString', 2); + * // => ['1111011', '111001000'] + */ +declare function invokeMap(collection: object | null | undefined, methodName: string, ...args: any[]): any[]; +/** + * Invokes the method at path of each element in collection. + * + * @template R + * @param {object | null | undefined} collection - The collection to iterate over. + * @param {(...args: any[]) => R} method - The method to invoke. + * @param {...any[]} args - The arguments to invoke each method with. + * @returns {R[]} Returns the array of results. + * + * @example + * invokeMap([5, 1, 7], Array.prototype.slice, 1); + * // => [[], [], []] + */ +declare function invokeMap(collection: object | null | undefined, method: (...args: any[]) => R, ...args: any[]): R[]; + +export { invokeMap }; diff --git a/node_modules/es-toolkit/dist/compat/array/invokeMap.js b/node_modules/es-toolkit/dist/compat/array/invokeMap.js new file mode 100644 index 0000000000000000000000000000000000000000..14762e6f7eff6b59b1f23d39b4e70480a2862fec --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isFunction = require('../../predicate/isFunction.js'); +const isNil = require('../../predicate/isNil.js'); +const get = require('../object/get.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function invokeMap(collection, path, ...args) { + if (isNil.isNil(collection)) { + return []; + } + const values = isArrayLike.isArrayLike(collection) ? Array.from(collection) : Object.values(collection); + const result = []; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (isFunction.isFunction(path)) { + result.push(path.apply(value, args)); + continue; + } + const method = get.get(value, path); + let thisContext = value; + if (Array.isArray(path)) { + const pathExceptLast = path.slice(0, -1); + if (pathExceptLast.length > 0) { + thisContext = get.get(value, pathExceptLast); + } + } + else if (typeof path === 'string' && path.includes('.')) { + const parts = path.split('.'); + const pathExceptLast = parts.slice(0, -1).join('.'); + thisContext = get.get(value, pathExceptLast); + } + result.push(method == null ? undefined : method.apply(thisContext, args)); + } + return result; +} + +exports.invokeMap = invokeMap; diff --git a/node_modules/es-toolkit/dist/compat/array/invokeMap.mjs b/node_modules/es-toolkit/dist/compat/array/invokeMap.mjs new file mode 100644 index 0000000000000000000000000000000000000000..41b2897e622ec3b9598fc4ebff48c05800068b34 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.mjs @@ -0,0 +1,36 @@ +import { isFunction } from '../../predicate/isFunction.mjs'; +import { isNil } from '../../predicate/isNil.mjs'; +import { get } from '../object/get.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function invokeMap(collection, path, ...args) { + if (isNil(collection)) { + return []; + } + const values = isArrayLike(collection) ? Array.from(collection) : Object.values(collection); + const result = []; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (isFunction(path)) { + result.push(path.apply(value, args)); + continue; + } + const method = get(value, path); + let thisContext = value; + if (Array.isArray(path)) { + const pathExceptLast = path.slice(0, -1); + if (pathExceptLast.length > 0) { + thisContext = get(value, pathExceptLast); + } + } + else if (typeof path === 'string' && path.includes('.')) { + const parts = path.split('.'); + const pathExceptLast = parts.slice(0, -1).join('.'); + thisContext = get(value, pathExceptLast); + } + result.push(method == null ? undefined : method.apply(thisContext, args)); + } + return result; +} + +export { invokeMap }; diff --git a/node_modules/es-toolkit/dist/compat/array/join.d.mts b/node_modules/es-toolkit/dist/compat/array/join.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..45dd93c92e11ba238ca3353b256c19e82231d998 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.d.mts @@ -0,0 +1,15 @@ +/** + * Joins elements of an array into a string. + * + * @param {ArrayLike | null | undefined} array - The array to join. + * @param {string} [separator=','] - The separator used to join the elements, default is common separator `,`. + * @returns {string} - Returns a string containing all elements of the array joined by the specified separator. + * + * @example + * const arr = ["a", "b", "c"]; + * const result = join(arr, "~"); + * console.log(result); // Output: "a~b~c" + */ +declare function join(array: ArrayLike | null | undefined, separator?: string): string; + +export { join }; diff --git a/node_modules/es-toolkit/dist/compat/array/join.d.ts b/node_modules/es-toolkit/dist/compat/array/join.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..45dd93c92e11ba238ca3353b256c19e82231d998 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.d.ts @@ -0,0 +1,15 @@ +/** + * Joins elements of an array into a string. + * + * @param {ArrayLike | null | undefined} array - The array to join. + * @param {string} [separator=','] - The separator used to join the elements, default is common separator `,`. + * @returns {string} - Returns a string containing all elements of the array joined by the specified separator. + * + * @example + * const arr = ["a", "b", "c"]; + * const result = join(arr, "~"); + * console.log(result); // Output: "a~b~c" + */ +declare function join(array: ArrayLike | null | undefined, separator?: string): string; + +export { join }; diff --git a/node_modules/es-toolkit/dist/compat/array/join.js b/node_modules/es-toolkit/dist/compat/array/join.js new file mode 100644 index 0000000000000000000000000000000000000000..2daf7fbb50bc6287b45cbdee459f7e8e7ec529c3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLike = require('../predicate/isArrayLike.js'); + +function join(array, separator) { + if (!isArrayLike.isArrayLike(array)) { + return ''; + } + return Array.from(array).join(separator); +} + +exports.join = join; diff --git a/node_modules/es-toolkit/dist/compat/array/join.mjs b/node_modules/es-toolkit/dist/compat/array/join.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ba9634090f8dbe92f07e26ecefc20cee06d47bc4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.mjs @@ -0,0 +1,10 @@ +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function join(array, separator) { + if (!isArrayLike(array)) { + return ''; + } + return Array.from(array).join(separator); +} + +export { join }; diff --git a/node_modules/es-toolkit/dist/compat/array/keyBy.d.mts b/node_modules/es-toolkit/dist/compat/array/keyBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..03917993cdffaa73cb918c40ead67020eaec6cba --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.d.mts @@ -0,0 +1,39 @@ +import { ValueIterateeCustom } from '../_internal/ValueIterateeCustom.mjs'; + +/** + * Creates an object composed of keys generated from the results of running each element of collection thru iteratee. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ValueIterateeCustom} [iteratee] - The iteratee to transform keys. + * @returns {Record} Returns the composed aggregate object. + * + * @example + * const array = [ + * { dir: 'left', code: 97 }, + * { dir: 'right', code: 100 } + * ]; + * + * keyBy(array, o => String.fromCharCode(o.code)); + * // => { a: { dir: 'left', code: 97 }, d: { dir: 'right', code: 100 } } + * + * keyBy(array, 'dir'); + * // => { left: { dir: 'left', code: 97 }, right: { dir: 'right', code: 100 } } + */ +declare function keyBy(collection: ArrayLike | null | undefined, iteratee?: ValueIterateeCustom): Record; +/** + * Creates an object composed of keys generated from the results of running each element of collection thru iteratee. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ValueIterateeCustom} [iteratee] - The iteratee to transform keys. + * @returns {Record} Returns the composed aggregate object. + * + * @example + * const obj = { a: { dir: 'left', code: 97 }, b: { dir: 'right', code: 100 } }; + * keyBy(obj, o => String.fromCharCode(o.code)); + * // => { a: { dir: 'left', code: 97 }, d: { dir: 'right', code: 100 } } + */ +declare function keyBy(collection: T | null | undefined, iteratee?: ValueIterateeCustom): Record; + +export { keyBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/keyBy.d.ts b/node_modules/es-toolkit/dist/compat/array/keyBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b3896799a8ccb0bb3cc835b7d5eee91878ec59d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.d.ts @@ -0,0 +1,39 @@ +import { ValueIterateeCustom } from '../_internal/ValueIterateeCustom.js'; + +/** + * Creates an object composed of keys generated from the results of running each element of collection thru iteratee. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ValueIterateeCustom} [iteratee] - The iteratee to transform keys. + * @returns {Record} Returns the composed aggregate object. + * + * @example + * const array = [ + * { dir: 'left', code: 97 }, + * { dir: 'right', code: 100 } + * ]; + * + * keyBy(array, o => String.fromCharCode(o.code)); + * // => { a: { dir: 'left', code: 97 }, d: { dir: 'right', code: 100 } } + * + * keyBy(array, 'dir'); + * // => { left: { dir: 'left', code: 97 }, right: { dir: 'right', code: 100 } } + */ +declare function keyBy(collection: ArrayLike | null | undefined, iteratee?: ValueIterateeCustom): Record; +/** + * Creates an object composed of keys generated from the results of running each element of collection thru iteratee. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ValueIterateeCustom} [iteratee] - The iteratee to transform keys. + * @returns {Record} Returns the composed aggregate object. + * + * @example + * const obj = { a: { dir: 'left', code: 97 }, b: { dir: 'right', code: 100 } }; + * keyBy(obj, o => String.fromCharCode(o.code)); + * // => { a: { dir: 'left', code: 97 }, d: { dir: 'right', code: 100 } } + */ +declare function keyBy(collection: T | null | undefined, iteratee?: ValueIterateeCustom): Record; + +export { keyBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/keyBy.js b/node_modules/es-toolkit/dist/compat/array/keyBy.js new file mode 100644 index 0000000000000000000000000000000000000000..e935e142610276986079dd2e38791c9f883f0781 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const reduce = require('./reduce.js'); +const identity = require('../../function/identity.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const isObjectLike = require('../predicate/isObjectLike.js'); +const iteratee = require('../util/iteratee.js'); + +function keyBy(collection, iteratee$1) { + if (!isArrayLike.isArrayLike(collection) && !isObjectLike.isObjectLike(collection)) { + return {}; + } + const keyFn = iteratee.iteratee(iteratee$1 ?? identity.identity); + return reduce.reduce(collection, (result, value) => { + const key = keyFn(value); + result[key] = value; + return result; + }, {}); +} + +exports.keyBy = keyBy; diff --git a/node_modules/es-toolkit/dist/compat/array/keyBy.mjs b/node_modules/es-toolkit/dist/compat/array/keyBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..410ff2a2063c9082d92c36b798176a9eeab002dc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.mjs @@ -0,0 +1,19 @@ +import { reduce } from './reduce.mjs'; +import { identity } from '../../function/identity.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { isObjectLike } from '../predicate/isObjectLike.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function keyBy(collection, iteratee$1) { + if (!isArrayLike(collection) && !isObjectLike(collection)) { + return {}; + } + const keyFn = iteratee(iteratee$1 ?? identity); + return reduce(collection, (result, value) => { + const key = keyFn(value); + result[key] = value; + return result; + }, {}); +} + +export { keyBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/last.d.mts b/node_modules/es-toolkit/dist/compat/array/last.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4270a8028ec072b58e6f8b00bc84a04fd5a5a6ad --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.d.mts @@ -0,0 +1,25 @@ +/** + * Returns the last element of an array. + * + * This function takes an array and returns the last element of the array. + * If the array is empty, the function returns `undefined`. + * + * Unlike some implementations, this function is optimized for performance + * by directly accessing the last index of the array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array from which to get the last element. + * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty. + * + * @example + * const arr = [1, 2, 3]; + * const lastElement = last(arr); + * // lastElement will be 3 + * + * const emptyArr: number[] = []; + * const noElement = last(emptyArr); + * // noElement will be undefined + */ +declare function last(array: ArrayLike | null | undefined): T | undefined; + +export { last }; diff --git a/node_modules/es-toolkit/dist/compat/array/last.d.ts b/node_modules/es-toolkit/dist/compat/array/last.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4270a8028ec072b58e6f8b00bc84a04fd5a5a6ad --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.d.ts @@ -0,0 +1,25 @@ +/** + * Returns the last element of an array. + * + * This function takes an array and returns the last element of the array. + * If the array is empty, the function returns `undefined`. + * + * Unlike some implementations, this function is optimized for performance + * by directly accessing the last index of the array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array from which to get the last element. + * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty. + * + * @example + * const arr = [1, 2, 3]; + * const lastElement = last(arr); + * // lastElement will be 3 + * + * const emptyArr: number[] = []; + * const noElement = last(emptyArr); + * // noElement will be undefined + */ +declare function last(array: ArrayLike | null | undefined): T | undefined; + +export { last }; diff --git a/node_modules/es-toolkit/dist/compat/array/last.js b/node_modules/es-toolkit/dist/compat/array/last.js new file mode 100644 index 0000000000000000000000000000000000000000..85a596f206a04ca98fd2c1fc60c0204a11eb0dbd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const last$1 = require('../../array/last.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function last(array) { + if (!isArrayLike.isArrayLike(array)) { + return undefined; + } + return last$1.last(toArray.toArray(array)); +} + +exports.last = last; diff --git a/node_modules/es-toolkit/dist/compat/array/last.mjs b/node_modules/es-toolkit/dist/compat/array/last.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e7aa26f9897746e0bd4129946b876111f51c0cbf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.mjs @@ -0,0 +1,12 @@ +import { last as last$1 } from '../../array/last.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function last(array) { + if (!isArrayLike(array)) { + return undefined; + } + return last$1(toArray(array)); +} + +export { last }; diff --git a/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.mts b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bcb4d37779ac4480079573eb508b710cae732ad9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.mts @@ -0,0 +1,22 @@ +/** + * Gets the index at which the last occurrence of value is found in array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {T} value - The value to search for. + * @param {true | number} [fromIndex] - The index to search from or true to search from the end. + * @returns {number} Returns the index of the matched value, else -1. + * + * @example + * lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + * + * lastIndexOf([1, 2, 1, 2], 2, true); + * // => 3 + */ +declare function lastIndexOf(array: ArrayLike | null | undefined, searchElement: T, fromIndex?: true | number): number; + +export { lastIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.ts b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bcb4d37779ac4480079573eb508b710cae732ad9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.ts @@ -0,0 +1,22 @@ +/** + * Gets the index at which the last occurrence of value is found in array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {T} value - The value to search for. + * @param {true | number} [fromIndex] - The index to search from or true to search from the end. + * @returns {number} Returns the index of the matched value, else -1. + * + * @example + * lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + * + * lastIndexOf([1, 2, 1, 2], 2, true); + * // => 3 + */ +declare function lastIndexOf(array: ArrayLike | null | undefined, searchElement: T, fromIndex?: true | number): number; + +export { lastIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/lastIndexOf.js b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..186815739ccda7ec589809df9baea0f2fbdeb610 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLike = require('../predicate/isArrayLike.js'); + +function lastIndexOf(array, searchElement, fromIndex) { + if (!isArrayLike.isArrayLike(array) || array.length === 0) { + return -1; + } + const length = array.length; + let index = fromIndex ?? length - 1; + if (fromIndex != null) { + index = index < 0 ? Math.max(length + index, 0) : Math.min(index, length - 1); + } + if (Number.isNaN(searchElement)) { + for (let i = index; i >= 0; i--) { + if (Number.isNaN(array[i])) { + return i; + } + } + } + return Array.from(array).lastIndexOf(searchElement, index); +} + +exports.lastIndexOf = lastIndexOf; diff --git a/node_modules/es-toolkit/dist/compat/array/lastIndexOf.mjs b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..887ea4093b08c88e09043e20c36f3bf4b95d7f26 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.mjs @@ -0,0 +1,22 @@ +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function lastIndexOf(array, searchElement, fromIndex) { + if (!isArrayLike(array) || array.length === 0) { + return -1; + } + const length = array.length; + let index = fromIndex ?? length - 1; + if (fromIndex != null) { + index = index < 0 ? Math.max(length + index, 0) : Math.min(index, length - 1); + } + if (Number.isNaN(searchElement)) { + for (let i = index; i >= 0; i--) { + if (Number.isNaN(array[i])) { + return i; + } + } + } + return Array.from(array).lastIndexOf(searchElement, index); +} + +export { lastIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/map.d.mts b/node_modules/es-toolkit/dist/compat/array/map.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bf3fb72481c75bccb73bb78fff1e88e8da204132 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.d.mts @@ -0,0 +1,112 @@ +import { ArrayIterator } from '../_internal/ArrayIterator.mjs'; +import { ListIterator } from '../_internal/ListIterator.mjs'; +import { ObjectIterator } from '../_internal/ObjectIterator.mjs'; +import { TupleIterator } from '../_internal/TupleIterator.mjs'; + +/** + * Maps each element in a tuple to a new tuple of values using an iteratee. + * + * @param {T} collection - The tuple to iterate over + * @param {TupleIterator} iteratee - The function invoked per iteration + * @returns {{ [K in keyof T]: U }} - Returns the new mapped tuple + * + * @example + * // Using a transformation function on a tuple + * const tuple = [1, 'hello', true] as const; + * map(tuple, value => String(value)); // => ['1', 'hello', 'true'] + */ +declare function map(collection: T, iteratee: TupleIterator): { + [K in keyof T]: U; +}; +/** + * Maps each element in an array to a new array using an iteratee. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {ArrayIterator} iteratee - The function invoked per iteration + * @returns {U[]} - Returns the new mapped array + * + * @example + * // Using a transformation function on an array + * const array = [1, 2, 3]; + * map(array, x => x * 2); // => [2, 4, 6] + */ +declare function map(collection: T[] | null | undefined, iteratee: ArrayIterator): U[]; +/** + * Maps each element in an array-like object to a new array using an iteratee. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {ListIterator} iteratee - The function invoked per iteration + * @returns {U[]} - Returns the new mapped array + * + * @example + * // Using a transformation function on an array-like object + * const arrayLike = { length: 2, 0: 'a', 1: 'b' }; + * map(arrayLike, x => x.toUpperCase()); // => ['A', 'B'] + */ +declare function map(collection: ArrayLike | null | undefined, iteratee: ListIterator): U[]; +/** + * Maps each value in an object to a new array. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @returns {T[]} - Returns an array of the object's values + * + * @example + * // Converting an object's values to an array + * const obj = { a: 1, b: 2, c: 3 }; + * map(obj); // => [1, 2, 3] + */ +declare function map(collection: Record | Record | null | undefined): T[]; +/** + * Maps each element in an object to a new array using an iteratee. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {ObjectIterator} iteratee - The function invoked per iteration + * @returns {U[]} - Returns the new mapped array + * + * @example + * // Using a transformation function on an object + * const obj = { a: 1, b: 2 }; + * map(obj, (value, key) => `${key}:${value}`); // => ['a:1', 'b:2'] + */ +declare function map(collection: T | null | undefined, iteratee: ObjectIterator): U[]; +/** + * Maps each element in an object to a new array by plucking the specified property. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @param {K} iteratee - The property to pluck from each element + * @returns {Array} - Returns the new array of plucked values + * + * @example + * // Plucking a property from each object + * const users = [{ name: 'John', age: 30 }, { name: 'Jane', age: 25 }]; + * map(users, 'name'); // => ['John', 'Jane'] + */ +declare function map(collection: Record | Record | null | undefined, iteratee: K): Array; +/** + * Maps each element in an object to a new array by plucking the specified string property. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @param {string} [iteratee] - The string property to pluck from each element + * @returns {any[]} - Returns the new array of plucked values + * + * @example + * // Plucking a nested property + * const users = [{ info: { name: 'John' } }, { info: { name: 'Jane' } }]; + * map(users, 'info.name'); // => ['John', 'Jane'] + */ +declare function map(collection: Record | Record | null | undefined, iteratee?: string): any[]; +/** + * Maps each element in an object to a new array by matching against a source object. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @param {object} [iteratee] - The object to match against + * @returns {boolean[]} - Returns an array of boolean values indicating matches + * + * @example + * // Matching against a source object + * const users = [{ name: 'John', age: 30 }, { name: 'Jane', age: 25 }]; + * map(users, { age: 30 }); // => [true, false] + */ +declare function map(collection: Record | Record | null | undefined, iteratee?: object): boolean[]; + +export { map }; diff --git a/node_modules/es-toolkit/dist/compat/array/map.d.ts b/node_modules/es-toolkit/dist/compat/array/map.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6be6989c076cb630b772313be94da307d608fced --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.d.ts @@ -0,0 +1,112 @@ +import { ArrayIterator } from '../_internal/ArrayIterator.js'; +import { ListIterator } from '../_internal/ListIterator.js'; +import { ObjectIterator } from '../_internal/ObjectIterator.js'; +import { TupleIterator } from '../_internal/TupleIterator.js'; + +/** + * Maps each element in a tuple to a new tuple of values using an iteratee. + * + * @param {T} collection - The tuple to iterate over + * @param {TupleIterator} iteratee - The function invoked per iteration + * @returns {{ [K in keyof T]: U }} - Returns the new mapped tuple + * + * @example + * // Using a transformation function on a tuple + * const tuple = [1, 'hello', true] as const; + * map(tuple, value => String(value)); // => ['1', 'hello', 'true'] + */ +declare function map(collection: T, iteratee: TupleIterator): { + [K in keyof T]: U; +}; +/** + * Maps each element in an array to a new array using an iteratee. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {ArrayIterator} iteratee - The function invoked per iteration + * @returns {U[]} - Returns the new mapped array + * + * @example + * // Using a transformation function on an array + * const array = [1, 2, 3]; + * map(array, x => x * 2); // => [2, 4, 6] + */ +declare function map(collection: T[] | null | undefined, iteratee: ArrayIterator): U[]; +/** + * Maps each element in an array-like object to a new array using an iteratee. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {ListIterator} iteratee - The function invoked per iteration + * @returns {U[]} - Returns the new mapped array + * + * @example + * // Using a transformation function on an array-like object + * const arrayLike = { length: 2, 0: 'a', 1: 'b' }; + * map(arrayLike, x => x.toUpperCase()); // => ['A', 'B'] + */ +declare function map(collection: ArrayLike | null | undefined, iteratee: ListIterator): U[]; +/** + * Maps each value in an object to a new array. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @returns {T[]} - Returns an array of the object's values + * + * @example + * // Converting an object's values to an array + * const obj = { a: 1, b: 2, c: 3 }; + * map(obj); // => [1, 2, 3] + */ +declare function map(collection: Record | Record | null | undefined): T[]; +/** + * Maps each element in an object to a new array using an iteratee. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {ObjectIterator} iteratee - The function invoked per iteration + * @returns {U[]} - Returns the new mapped array + * + * @example + * // Using a transformation function on an object + * const obj = { a: 1, b: 2 }; + * map(obj, (value, key) => `${key}:${value}`); // => ['a:1', 'b:2'] + */ +declare function map(collection: T | null | undefined, iteratee: ObjectIterator): U[]; +/** + * Maps each element in an object to a new array by plucking the specified property. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @param {K} iteratee - The property to pluck from each element + * @returns {Array} - Returns the new array of plucked values + * + * @example + * // Plucking a property from each object + * const users = [{ name: 'John', age: 30 }, { name: 'Jane', age: 25 }]; + * map(users, 'name'); // => ['John', 'Jane'] + */ +declare function map(collection: Record | Record | null | undefined, iteratee: K): Array; +/** + * Maps each element in an object to a new array by plucking the specified string property. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @param {string} [iteratee] - The string property to pluck from each element + * @returns {any[]} - Returns the new array of plucked values + * + * @example + * // Plucking a nested property + * const users = [{ info: { name: 'John' } }, { info: { name: 'Jane' } }]; + * map(users, 'info.name'); // => ['John', 'Jane'] + */ +declare function map(collection: Record | Record | null | undefined, iteratee?: string): any[]; +/** + * Maps each element in an object to a new array by matching against a source object. + * + * @param {Record | Record | null | undefined} collection - The object to iterate over + * @param {object} [iteratee] - The object to match against + * @returns {boolean[]} - Returns an array of boolean values indicating matches + * + * @example + * // Matching against a source object + * const users = [{ name: 'John', age: 30 }, { name: 'Jane', age: 25 }]; + * map(users, { age: 30 }); // => [true, false] + */ +declare function map(collection: Record | Record | null | undefined, iteratee?: object): boolean[]; + +export { map }; diff --git a/node_modules/es-toolkit/dist/compat/array/map.js b/node_modules/es-toolkit/dist/compat/array/map.js new file mode 100644 index 0000000000000000000000000000000000000000..4006eec19a4d63a45f04da3dfd888bf7cd8ca880 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const range = require('../../math/range.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const iteratee = require('../util/iteratee.js'); + +function map(collection, _iteratee) { + if (!collection) { + return []; + } + const keys = isArrayLike.isArrayLike(collection) || Array.isArray(collection) ? range.range(0, collection.length) : Object.keys(collection); + const iteratee$1 = iteratee.iteratee(_iteratee ?? identity.identity); + const result = new Array(keys.length); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + result[i] = iteratee$1(value, key, collection); + } + return result; +} + +exports.map = map; diff --git a/node_modules/es-toolkit/dist/compat/array/map.mjs b/node_modules/es-toolkit/dist/compat/array/map.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e8b12f7de16b9772acc2c32da4b6ed06f1b1f5be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.mjs @@ -0,0 +1,21 @@ +import { identity } from '../../function/identity.mjs'; +import { range } from '../../math/range.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function map(collection, _iteratee) { + if (!collection) { + return []; + } + const keys = isArrayLike(collection) || Array.isArray(collection) ? range(0, collection.length) : Object.keys(collection); + const iteratee$1 = iteratee(_iteratee ?? identity); + const result = new Array(keys.length); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + result[i] = iteratee$1(value, key, collection); + } + return result; +} + +export { map }; diff --git a/node_modules/es-toolkit/dist/compat/array/nth.d.mts b/node_modules/es-toolkit/dist/compat/array/nth.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5e5e381ffc91890f0d2e1895c91c2c5a7cf10053 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.d.mts @@ -0,0 +1,14 @@ +/** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=0] - The index of the element to return. + * @return {T | undefined} Returns the nth element of `array`. + * + * @example + * nth([1, 2, 3], 1); // => 2 + * nth([1, 2, 3], -1); // => 3 + */ +declare function nth(array: ArrayLike | null | undefined, n?: number): T | undefined; + +export { nth }; diff --git a/node_modules/es-toolkit/dist/compat/array/nth.d.ts b/node_modules/es-toolkit/dist/compat/array/nth.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e5e381ffc91890f0d2e1895c91c2c5a7cf10053 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.d.ts @@ -0,0 +1,14 @@ +/** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=0] - The index of the element to return. + * @return {T | undefined} Returns the nth element of `array`. + * + * @example + * nth([1, 2, 3], 1); // => 2 + * nth([1, 2, 3], -1); // => 3 + */ +declare function nth(array: ArrayLike | null | undefined, n?: number): T | undefined; + +export { nth }; diff --git a/node_modules/es-toolkit/dist/compat/array/nth.js b/node_modules/es-toolkit/dist/compat/array/nth.js new file mode 100644 index 0000000000000000000000000000000000000000..611900c8bfff575aed4025762ea2ac4f89ec3bb7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const toInteger = require('../util/toInteger.js'); + +function nth(array, n = 0) { + if (!isArrayLikeObject.isArrayLikeObject(array) || array.length === 0) { + return undefined; + } + n = toInteger.toInteger(n); + if (n < 0) { + n += array.length; + } + return array[n]; +} + +exports.nth = nth; diff --git a/node_modules/es-toolkit/dist/compat/array/nth.mjs b/node_modules/es-toolkit/dist/compat/array/nth.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4ab81f82d7f227b29a365c8df7500486762a768b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.mjs @@ -0,0 +1,15 @@ +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function nth(array, n = 0) { + if (!isArrayLikeObject(array) || array.length === 0) { + return undefined; + } + n = toInteger(n); + if (n < 0) { + n += array.length; + } + return array[n]; +} + +export { nth }; diff --git a/node_modules/es-toolkit/dist/compat/array/orderBy.d.mts b/node_modules/es-toolkit/dist/compat/array/orderBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8136918e240de666c6b48968b87ff823bb9a96c8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.d.mts @@ -0,0 +1,84 @@ +import { ListIteratee } from '../_internal/ListIteratee.mjs'; +import { ListIterator } from '../_internal/ListIterator.mjs'; +import { Many } from '../_internal/Many.mjs'; +import { ObjectIteratee } from '../_internal/ObjectIteratee.mjs'; +import { ObjectIterator } from '../_internal/ObjectIterator.mjs'; + +/** + * Sorts an array of elements based on multiple iteratee functions and their corresponding order directions. + * + * @template T The type of elements in the array + * @param {ArrayLike | null | undefined} collection The array to sort + * @param {Many>} iteratees The iteratee functions to sort by + * @param {Many} orders The sort orders + * @returns {T[]} Returns the new sorted array + * @example + * const users = [ + * { name: 'fred', age: 48 }, + * { name: 'barney', age: 34 } + * ]; + * + * // Sort by age in ascending order + * orderBy(users, [(user) => user.age], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: ArrayLike | null | undefined, iteratees?: Many>, orders?: Many): T[]; +/** + * Sorts an array of elements based on multiple property names/paths and their corresponding order directions. + * + * @template T The type of elements in the array + * @param {ArrayLike | null | undefined} collection The array to sort + * @param {Many>} iteratees The property names/paths to sort by + * @param {Many} orders The sort orders + * @returns {T[]} Returns the new sorted array + * @example + * const users = [ + * { name: 'fred', age: 48 }, + * { name: 'barney', age: 34 } + * ]; + * + * // Sort by name in ascending order + * orderBy(users, ['name'], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: ArrayLike | null | undefined, iteratees?: Many>, orders?: Many): T[]; +/** + * Sorts an object's values based on multiple iteratee functions and their corresponding order directions. + * + * @template T The object type + * @param {T | null | undefined} collection The object to sort values from + * @param {Many>} iteratees The iteratee functions to sort by + * @param {Many} orders The sort orders + * @returns {Array} Returns the new sorted array + * @example + * const obj = { + * a: { name: 'fred', age: 48 }, + * b: { name: 'barney', age: 34 } + * }; + * + * // Sort by age in ascending order + * orderBy(obj, [(user) => user.age], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: T | null | undefined, iteratees?: Many>, orders?: Many): Array; +/** + * Sorts an object's values based on multiple property names/paths and their corresponding order directions. + * + * @template T The object type + * @param {T | null | undefined} collection The object to sort values from + * @param {Many>} iteratees The property names/paths to sort by + * @param {Many} orders The sort orders + * @returns {Array} Returns the new sorted array + * @example + * const obj = { + * a: { name: 'fred', age: 48 }, + * b: { name: 'barney', age: 34 } + * }; + * + * // Sort by name in ascending order + * orderBy(obj, ['name'], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: T | null | undefined, iteratees?: Many>, orders?: Many): Array; + +export { orderBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/orderBy.d.ts b/node_modules/es-toolkit/dist/compat/array/orderBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..86bb98185a677f5ac13282164d8835a5403e5141 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.d.ts @@ -0,0 +1,84 @@ +import { ListIteratee } from '../_internal/ListIteratee.js'; +import { ListIterator } from '../_internal/ListIterator.js'; +import { Many } from '../_internal/Many.js'; +import { ObjectIteratee } from '../_internal/ObjectIteratee.js'; +import { ObjectIterator } from '../_internal/ObjectIterator.js'; + +/** + * Sorts an array of elements based on multiple iteratee functions and their corresponding order directions. + * + * @template T The type of elements in the array + * @param {ArrayLike | null | undefined} collection The array to sort + * @param {Many>} iteratees The iteratee functions to sort by + * @param {Many} orders The sort orders + * @returns {T[]} Returns the new sorted array + * @example + * const users = [ + * { name: 'fred', age: 48 }, + * { name: 'barney', age: 34 } + * ]; + * + * // Sort by age in ascending order + * orderBy(users, [(user) => user.age], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: ArrayLike | null | undefined, iteratees?: Many>, orders?: Many): T[]; +/** + * Sorts an array of elements based on multiple property names/paths and their corresponding order directions. + * + * @template T The type of elements in the array + * @param {ArrayLike | null | undefined} collection The array to sort + * @param {Many>} iteratees The property names/paths to sort by + * @param {Many} orders The sort orders + * @returns {T[]} Returns the new sorted array + * @example + * const users = [ + * { name: 'fred', age: 48 }, + * { name: 'barney', age: 34 } + * ]; + * + * // Sort by name in ascending order + * orderBy(users, ['name'], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: ArrayLike | null | undefined, iteratees?: Many>, orders?: Many): T[]; +/** + * Sorts an object's values based on multiple iteratee functions and their corresponding order directions. + * + * @template T The object type + * @param {T | null | undefined} collection The object to sort values from + * @param {Many>} iteratees The iteratee functions to sort by + * @param {Many} orders The sort orders + * @returns {Array} Returns the new sorted array + * @example + * const obj = { + * a: { name: 'fred', age: 48 }, + * b: { name: 'barney', age: 34 } + * }; + * + * // Sort by age in ascending order + * orderBy(obj, [(user) => user.age], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: T | null | undefined, iteratees?: Many>, orders?: Many): Array; +/** + * Sorts an object's values based on multiple property names/paths and their corresponding order directions. + * + * @template T The object type + * @param {T | null | undefined} collection The object to sort values from + * @param {Many>} iteratees The property names/paths to sort by + * @param {Many} orders The sort orders + * @returns {Array} Returns the new sorted array + * @example + * const obj = { + * a: { name: 'fred', age: 48 }, + * b: { name: 'barney', age: 34 } + * }; + * + * // Sort by name in ascending order + * orderBy(obj, ['name'], ['asc']); + * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] + */ +declare function orderBy(collection: T | null | undefined, iteratees?: Many>, orders?: Many): Array; + +export { orderBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/orderBy.js b/node_modules/es-toolkit/dist/compat/array/orderBy.js new file mode 100644 index 0000000000000000000000000000000000000000..b9a474d637db6bab9969d0620eba63d0141a39e5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.js @@ -0,0 +1,82 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const compareValues = require('../_internal/compareValues.js'); +const isKey = require('../_internal/isKey.js'); +const toPath = require('../util/toPath.js'); + +function orderBy(collection, criteria, orders, guard) { + if (collection == null) { + return []; + } + orders = guard ? undefined : orders; + if (!Array.isArray(collection)) { + collection = Object.values(collection); + } + if (!Array.isArray(criteria)) { + criteria = criteria == null ? [null] : [criteria]; + } + if (criteria.length === 0) { + criteria = [null]; + } + if (!Array.isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + orders = orders.map(order => String(order)); + const getValueByNestedPath = (object, path) => { + let target = object; + for (let i = 0; i < path.length && target != null; ++i) { + target = target[path[i]]; + } + return target; + }; + const getValueByCriterion = (criterion, object) => { + if (object == null || criterion == null) { + return object; + } + if (typeof criterion === 'object' && 'key' in criterion) { + if (Object.hasOwn(object, criterion.key)) { + return object[criterion.key]; + } + return getValueByNestedPath(object, criterion.path); + } + if (typeof criterion === 'function') { + return criterion(object); + } + if (Array.isArray(criterion)) { + return getValueByNestedPath(object, criterion); + } + if (typeof object === 'object') { + return object[criterion]; + } + return object; + }; + const preparedCriteria = criteria.map((criterion) => { + if (Array.isArray(criterion) && criterion.length === 1) { + criterion = criterion[0]; + } + if (criterion == null || typeof criterion === 'function' || Array.isArray(criterion) || isKey.isKey(criterion)) { + return criterion; + } + return { key: criterion, path: toPath.toPath(criterion) }; + }); + const preparedCollection = collection.map(item => ({ + original: item, + criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item)), + })); + return preparedCollection + .slice() + .sort((a, b) => { + for (let i = 0; i < preparedCriteria.length; i++) { + const comparedResult = compareValues.compareValues(a.criteria[i], b.criteria[i], orders[i]); + if (comparedResult !== 0) { + return comparedResult; + } + } + return 0; + }) + .map(item => item.original); +} + +exports.orderBy = orderBy; diff --git a/node_modules/es-toolkit/dist/compat/array/orderBy.mjs b/node_modules/es-toolkit/dist/compat/array/orderBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3ec5653d4dceeae4daa4a12f1fb77166d59f38b5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.mjs @@ -0,0 +1,78 @@ +import { compareValues } from '../_internal/compareValues.mjs'; +import { isKey } from '../_internal/isKey.mjs'; +import { toPath } from '../util/toPath.mjs'; + +function orderBy(collection, criteria, orders, guard) { + if (collection == null) { + return []; + } + orders = guard ? undefined : orders; + if (!Array.isArray(collection)) { + collection = Object.values(collection); + } + if (!Array.isArray(criteria)) { + criteria = criteria == null ? [null] : [criteria]; + } + if (criteria.length === 0) { + criteria = [null]; + } + if (!Array.isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + orders = orders.map(order => String(order)); + const getValueByNestedPath = (object, path) => { + let target = object; + for (let i = 0; i < path.length && target != null; ++i) { + target = target[path[i]]; + } + return target; + }; + const getValueByCriterion = (criterion, object) => { + if (object == null || criterion == null) { + return object; + } + if (typeof criterion === 'object' && 'key' in criterion) { + if (Object.hasOwn(object, criterion.key)) { + return object[criterion.key]; + } + return getValueByNestedPath(object, criterion.path); + } + if (typeof criterion === 'function') { + return criterion(object); + } + if (Array.isArray(criterion)) { + return getValueByNestedPath(object, criterion); + } + if (typeof object === 'object') { + return object[criterion]; + } + return object; + }; + const preparedCriteria = criteria.map((criterion) => { + if (Array.isArray(criterion) && criterion.length === 1) { + criterion = criterion[0]; + } + if (criterion == null || typeof criterion === 'function' || Array.isArray(criterion) || isKey(criterion)) { + return criterion; + } + return { key: criterion, path: toPath(criterion) }; + }); + const preparedCollection = collection.map(item => ({ + original: item, + criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item)), + })); + return preparedCollection + .slice() + .sort((a, b) => { + for (let i = 0; i < preparedCriteria.length; i++) { + const comparedResult = compareValues(a.criteria[i], b.criteria[i], orders[i]); + if (comparedResult !== 0) { + return comparedResult; + } + } + return 0; + }) + .map(item => item.original); +} + +export { orderBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/partition.d.mts b/node_modules/es-toolkit/dist/compat/array/partition.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ffad3fb011d6f15e3a91edf70976182ed5751799 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.d.mts @@ -0,0 +1,50 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; +import { ValueIteratorTypeGuard } from '../_internal/ValueIteratorTypeGuard.mjs'; + +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T, U + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {(value: T) => value is U} callback - The function invoked per iteration. + * @returns {[U[], Array>]} Returns the array of grouped elements. + * + * @example + * partition([1, 2, 3, 4], n => n % 2 === 0); + * // => [[2, 4], [1, 3]] + */ +declare function partition(collection: ArrayLike | null | undefined, callback: ValueIteratorTypeGuard): [U[], Array>]; +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial} callback - The function invoked per iteration. + * @returns {[T[], T[]]} Returns the array of grouped elements. + * + * @example + * partition([1, 2, 3, 4], n => n % 2 === 0); + * // => [[2, 4], [1, 3]] + */ +declare function partition(collection: ArrayLike | null | undefined, callback: ValueIteratee): [T[], T[]]; +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T + * @param {T | null | undefined} collection - The collection to iterate over. + * @param {((value: T[keyof T]) => unknown) | PropertyKey | [PropertyKey, any] | Partial} callback - The function invoked per iteration. + * @returns {[Array, Array]} Returns the array of grouped elements. + * + * @example + * partition({ a: 1, b: 2, c: 3 }, n => n % 2 === 0); + * // => [[2], [1, 3]] + */ +declare function partition(collection: T | null | undefined, callback: ValueIteratee): [Array, Array]; + +export { partition }; diff --git a/node_modules/es-toolkit/dist/compat/array/partition.d.ts b/node_modules/es-toolkit/dist/compat/array/partition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b8bc6d1610b924e594288215629f3e8d7b82d3a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.d.ts @@ -0,0 +1,50 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; +import { ValueIteratorTypeGuard } from '../_internal/ValueIteratorTypeGuard.js'; + +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T, U + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {(value: T) => value is U} callback - The function invoked per iteration. + * @returns {[U[], Array>]} Returns the array of grouped elements. + * + * @example + * partition([1, 2, 3, 4], n => n % 2 === 0); + * // => [[2, 4], [1, 3]] + */ +declare function partition(collection: ArrayLike | null | undefined, callback: ValueIteratorTypeGuard): [U[], Array>]; +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial} callback - The function invoked per iteration. + * @returns {[T[], T[]]} Returns the array of grouped elements. + * + * @example + * partition([1, 2, 3, 4], n => n % 2 === 0); + * // => [[2, 4], [1, 3]] + */ +declare function partition(collection: ArrayLike | null | undefined, callback: ValueIteratee): [T[], T[]]; +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T + * @param {T | null | undefined} collection - The collection to iterate over. + * @param {((value: T[keyof T]) => unknown) | PropertyKey | [PropertyKey, any] | Partial} callback - The function invoked per iteration. + * @returns {[Array, Array]} Returns the array of grouped elements. + * + * @example + * partition({ a: 1, b: 2, c: 3 }, n => n % 2 === 0); + * // => [[2], [1, 3]] + */ +declare function partition(collection: T | null | undefined, callback: ValueIteratee): [Array, Array]; + +export { partition }; diff --git a/node_modules/es-toolkit/dist/compat/array/partition.js b/node_modules/es-toolkit/dist/compat/array/partition.js new file mode 100644 index 0000000000000000000000000000000000000000..e42a18ca2b52d26c690ae18cdd5bbcbd7d79bb88 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const iteratee = require('../util/iteratee.js'); + +function partition(source, predicate = identity.identity) { + if (!source) { + return [[], []]; + } + const collection = isArrayLike.isArrayLike(source) ? source : Object.values(source); + predicate = iteratee.iteratee(predicate); + const matched = []; + const unmatched = []; + for (let i = 0; i < collection.length; i++) { + const value = collection[i]; + if (predicate(value)) { + matched.push(value); + } + else { + unmatched.push(value); + } + } + return [matched, unmatched]; +} + +exports.partition = partition; diff --git a/node_modules/es-toolkit/dist/compat/array/partition.mjs b/node_modules/es-toolkit/dist/compat/array/partition.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4f3658bb50f89cea3deccf97d9e89da4ea18aafc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.mjs @@ -0,0 +1,25 @@ +import { identity } from '../../function/identity.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function partition(source, predicate = identity) { + if (!source) { + return [[], []]; + } + const collection = isArrayLike(source) ? source : Object.values(source); + predicate = iteratee(predicate); + const matched = []; + const unmatched = []; + for (let i = 0; i < collection.length; i++) { + const value = collection[i]; + if (predicate(value)) { + matched.push(value); + } + else { + unmatched.push(value); + } + } + return [matched, unmatched]; +} + +export { partition }; diff --git a/node_modules/es-toolkit/dist/compat/array/pull.d.mts b/node_modules/es-toolkit/dist/compat/array/pull.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..77c1dc8f7dcdcabb80fffe6307107fd7e6c8f190 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.d.mts @@ -0,0 +1,38 @@ +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...T[]} values - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull(array: T[], ...values: T[]): T[]; +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...L[0][]} values - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull>(array: L extends readonly any[] ? never : L, ...values: Array): L; + +export { pull }; diff --git a/node_modules/es-toolkit/dist/compat/array/pull.d.ts b/node_modules/es-toolkit/dist/compat/array/pull.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..77c1dc8f7dcdcabb80fffe6307107fd7e6c8f190 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.d.ts @@ -0,0 +1,38 @@ +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...T[]} values - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull(array: T[], ...values: T[]): T[]; +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...L[0][]} values - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull>(array: L extends readonly any[] ? never : L, ...values: Array): L; + +export { pull }; diff --git a/node_modules/es-toolkit/dist/compat/array/pull.js b/node_modules/es-toolkit/dist/compat/array/pull.js new file mode 100644 index 0000000000000000000000000000000000000000..576fe98dedd38235cb261a443e59c41e156db8d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const pull$1 = require('../../array/pull.js'); + +function pull(arr, ...valuesToRemove) { + return pull$1.pull(arr, valuesToRemove); +} + +exports.pull = pull; diff --git a/node_modules/es-toolkit/dist/compat/array/pull.mjs b/node_modules/es-toolkit/dist/compat/array/pull.mjs new file mode 100644 index 0000000000000000000000000000000000000000..520a22ba39b1b280212c8ddd200282c2f7c9c725 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.mjs @@ -0,0 +1,7 @@ +import { pull as pull$1 } from '../../array/pull.mjs'; + +function pull(arr, ...valuesToRemove) { + return pull$1(arr, valuesToRemove); +} + +export { pull }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts b/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..07680d72affde3fce47c1fd0c8105c1d4ee17197 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts @@ -0,0 +1,41 @@ +import { MutableList } from '../_internal/MutableList.d.mjs'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.mjs'; + +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll(array: T[], values?: ArrayLike): T[]; +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll>(array: RejectReadonly, values?: ArrayLike): L; + +export { pullAll }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts b/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6e2c23dcd3807819285d8e60560d49ad3060629 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts @@ -0,0 +1,41 @@ +import { MutableList } from '../_internal/MutableList.d.js'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.js'; + +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll(array: T[], values?: ArrayLike): T[]; +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll>(array: RejectReadonly, values?: ArrayLike): L; + +export { pullAll }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAll.js b/node_modules/es-toolkit/dist/compat/array/pullAll.js new file mode 100644 index 0000000000000000000000000000000000000000..1f8fd096802449f8c1f34848938d97d5e57d0908 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const pull = require('../../array/pull.js'); + +function pullAll(arr, valuesToRemove = []) { + return pull.pull(arr, Array.from(valuesToRemove)); +} + +exports.pullAll = pullAll; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAll.mjs b/node_modules/es-toolkit/dist/compat/array/pullAll.mjs new file mode 100644 index 0000000000000000000000000000000000000000..beadc77ce8733d55e3668e4b380493df372b7597 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.mjs @@ -0,0 +1,7 @@ +import { pull } from '../../array/pull.mjs'; + +function pullAll(arr, valuesToRemove = []) { + return pull(arr, Array.from(valuesToRemove)); +} + +export { pullAll }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts b/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cf128ab4e4cb7f7136f9956124b0c82f5d87ff3d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts @@ -0,0 +1,86 @@ +import { MutableList } from '../_internal/MutableList.d.mjs'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.mjs'; +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values?: ArrayLike, iteratee?: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy>(array: RejectReadonly, values?: ArrayLike, iteratee?: ValueIteratee): L; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: T | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L, U + * @param {L} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: L[0] | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy, U>(array: L extends readonly any[] ? never : L, values: ArrayLike, iteratee: ValueIteratee): L; + +export { pullAllBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts b/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..87bf3c6d0f5c07af1ee9e1a724c244088f1ed8c3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts @@ -0,0 +1,86 @@ +import { MutableList } from '../_internal/MutableList.d.js'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.js'; +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values?: ArrayLike, iteratee?: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy>(array: RejectReadonly, values?: ArrayLike, iteratee?: ValueIteratee): L; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: T | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L, U + * @param {L} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: L[0] | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy, U>(array: L extends readonly any[] ? never : L, values: ArrayLike, iteratee: ValueIteratee): L; + +export { pullAllBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllBy.js b/node_modules/es-toolkit/dist/compat/array/pullAllBy.js new file mode 100644 index 0000000000000000000000000000000000000000..b4f8aba1349443a201a56fa73565d1d6a36218c4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const iteratee = require('../util/iteratee.js'); + +function pullAllBy(arr, valuesToRemove, _getValue) { + const getValue = iteratee.iteratee(_getValue); + const valuesSet = new Set(Array.from(valuesToRemove).map(x => getValue(x))); + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + const value = getValue(arr[i]); + if (valuesSet.has(value)) { + continue; + } + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return arr; +} + +exports.pullAllBy = pullAllBy; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs b/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d329d9d25fd037a08eda9e82cbebafc2e7e767b6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs @@ -0,0 +1,22 @@ +import { iteratee } from '../util/iteratee.mjs'; + +function pullAllBy(arr, valuesToRemove, _getValue) { + const getValue = iteratee(_getValue); + const valuesSet = new Set(Array.from(valuesToRemove).map(x => getValue(x))); + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + const value = getValue(arr[i]); + if (valuesSet.has(value)) { + continue; + } + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return arr; +} + +export { pullAllBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts b/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..eaeb8ac9f5d90c0c91e751272097d432f970d549 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts @@ -0,0 +1,89 @@ +import { MutableList } from '../_internal/MutableList.d.mjs'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.mjs'; + +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values?: ArrayLike, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @param {Comparator} [comparator] - The comparator invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith>(array: RejectReadonly, values?: ArrayLike, comparator?: (a: L[0], b: L[0]) => boolean): L; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {(a: T, b: U) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values: ArrayLike, comparator: (a: T, b: U) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L1, L2 + * @param {RejectReadonly} array - The array to modify. + * @param {List} values - The values to remove. + * @param {Comparator2} comparator - The comparator invoked per element. + * @returns {L1} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith, L2>(array: RejectReadonly, values: ArrayLike, comparator: (a: L1[0], b: L2) => boolean): L1; + +export { pullAllWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts b/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..31561472eda5f6a843a05c07c1c6b9afd3535e2b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts @@ -0,0 +1,89 @@ +import { MutableList } from '../_internal/MutableList.d.js'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.js'; + +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values?: ArrayLike, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @param {Comparator} [comparator] - The comparator invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith>(array: RejectReadonly, values?: ArrayLike, comparator?: (a: L[0], b: L[0]) => boolean): L; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {(a: T, b: U) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values: ArrayLike, comparator: (a: T, b: U) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L1, L2 + * @param {RejectReadonly} array - The array to modify. + * @param {List} values - The values to remove. + * @param {Comparator2} comparator - The comparator invoked per element. + * @returns {L1} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith, L2>(array: RejectReadonly, values: ArrayLike, comparator: (a: L1[0], b: L2) => boolean): L1; + +export { pullAllWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllWith.js b/node_modules/es-toolkit/dist/compat/array/pullAllWith.js new file mode 100644 index 0000000000000000000000000000000000000000..3adf54a264f16c9180587bd0a3a8562e04a48fdf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const copyArray = require('../_internal/copyArray.js'); +const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js'); + +function pullAllWith(array, values, comparator) { + if (array?.length == null || values?.length == null) { + return array; + } + if (array === values) { + values = copyArray(values); + } + let resultLength = 0; + if (comparator == null) { + comparator = (a, b) => isEqualsSameValueZero.isEqualsSameValueZero(a, b); + } + const valuesArray = Array.isArray(values) ? values : Array.from(values); + const hasUndefined = valuesArray.includes(undefined); + for (let i = 0; i < array.length; i++) { + if (i in array) { + const shouldRemove = valuesArray.some(value => comparator(array[i], value)); + if (!shouldRemove) { + array[resultLength++] = array[i]; + } + continue; + } + if (!hasUndefined) { + delete array[resultLength++]; + } + } + array.length = resultLength; + return array; +} + +exports.pullAllWith = pullAllWith; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs b/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fc4b449c7066067a5aaceadf140de82d752bbd46 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs @@ -0,0 +1,33 @@ +import copyArray from '../_internal/copyArray.mjs'; +import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs'; + +function pullAllWith(array, values, comparator) { + if (array?.length == null || values?.length == null) { + return array; + } + if (array === values) { + values = copyArray(values); + } + let resultLength = 0; + if (comparator == null) { + comparator = (a, b) => isEqualsSameValueZero(a, b); + } + const valuesArray = Array.isArray(values) ? values : Array.from(values); + const hasUndefined = valuesArray.includes(undefined); + for (let i = 0; i < array.length; i++) { + if (i in array) { + const shouldRemove = valuesArray.some(value => comparator(array[i], value)); + if (!shouldRemove) { + array[resultLength++] = array[i]; + } + continue; + } + if (!hasUndefined) { + delete array[resultLength++]; + } + } + array.length = resultLength; + return array; +} + +export { pullAllWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts b/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..db9179e1d510415101ec8b3131ce37cea60fb32c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts @@ -0,0 +1,50 @@ +import { Many } from '../_internal/Many.mjs'; +import { MutableList } from '../_internal/MutableList.d.mjs'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.mjs'; + +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {T[]} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt(array: T[], ...indexes: Array>): T[]; +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {L} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt>(array: RejectReadonly, ...indexes: Array>): L; + +export { pullAt }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts b/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e90cf069de4e72ff67423f3b1944fc021a7d77e9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts @@ -0,0 +1,50 @@ +import { Many } from '../_internal/Many.js'; +import { MutableList } from '../_internal/MutableList.d.js'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.js'; + +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {T[]} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt(array: T[], ...indexes: Array>): T[]; +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {L} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt>(array: RejectReadonly, ...indexes: Array>): L; + +export { pullAt }; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAt.js b/node_modules/es-toolkit/dist/compat/array/pullAt.js new file mode 100644 index 0000000000000000000000000000000000000000..1c6c1aa88e6c935221ce6d0f277637f130140362 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flattenDepth = require('./flattenDepth.js'); +const isIndex = require('../_internal/isIndex.js'); +const isKey = require('../_internal/isKey.js'); +const toKey = require('../_internal/toKey.js'); +const at = require('../object/at.js'); +const unset = require('../object/unset.js'); +const isArray = require('../predicate/isArray.js'); +const toPath = require('../util/toPath.js'); + +function pullAt(array, ..._indices) { + const indices = flattenDepth.flattenDepth(_indices, 1); + if (!array) { + return Array(indices.length); + } + const result = at.at(array, indices); + const indicesToPull = indices + .map(index => (isIndex.isIndex(index, array.length) ? Number(index) : index)) + .sort((a, b) => b - a); + for (const index of new Set(indicesToPull)) { + if (isIndex.isIndex(index, array.length)) { + Array.prototype.splice.call(array, index, 1); + continue; + } + if (isKey.isKey(index, array)) { + delete array[toKey.toKey(index)]; + continue; + } + const path = isArray.isArray(index) ? index : toPath.toPath(index); + unset.unset(array, path); + } + return result; +} + +exports.pullAt = pullAt; diff --git a/node_modules/es-toolkit/dist/compat/array/pullAt.mjs b/node_modules/es-toolkit/dist/compat/array/pullAt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fecaede7bf770ba66b2a2906b9a067b59dffab99 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.mjs @@ -0,0 +1,34 @@ +import { flattenDepth } from './flattenDepth.mjs'; +import { isIndex } from '../_internal/isIndex.mjs'; +import { isKey } from '../_internal/isKey.mjs'; +import { toKey } from '../_internal/toKey.mjs'; +import { at } from '../object/at.mjs'; +import { unset } from '../object/unset.mjs'; +import { isArray } from '../predicate/isArray.mjs'; +import { toPath } from '../util/toPath.mjs'; + +function pullAt(array, ..._indices) { + const indices = flattenDepth(_indices, 1); + if (!array) { + return Array(indices.length); + } + const result = at(array, indices); + const indicesToPull = indices + .map(index => (isIndex(index, array.length) ? Number(index) : index)) + .sort((a, b) => b - a); + for (const index of new Set(indicesToPull)) { + if (isIndex(index, array.length)) { + Array.prototype.splice.call(array, index, 1); + continue; + } + if (isKey(index, array)) { + delete array[toKey(index)]; + continue; + } + const path = isArray(index) ? index : toPath(index); + unset(array, path); + } + return result; +} + +export { pullAt }; diff --git a/node_modules/es-toolkit/dist/compat/array/reduce.d.mts b/node_modules/es-toolkit/dist/compat/array/reduce.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6f404b1474c2578d210db5ca5eebfbffd6934678 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.d.mts @@ -0,0 +1,80 @@ +import { MemoListIterator } from '../_internal/MemoListIterator.mjs'; +import { MemoObjectIterator } from '../_internal/MemoObjectIterator.mjs'; + +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @returns {T[keyof T] | undefined} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; + +export { reduce }; diff --git a/node_modules/es-toolkit/dist/compat/array/reduce.d.ts b/node_modules/es-toolkit/dist/compat/array/reduce.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6777ff3b9997dba0ee974554062e0f6836355435 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.d.ts @@ -0,0 +1,80 @@ +import { MemoListIterator } from '../_internal/MemoListIterator.js'; +import { MemoObjectIterator } from '../_internal/MemoObjectIterator.js'; + +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @returns {T[keyof T] | undefined} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; + +export { reduce }; diff --git a/node_modules/es-toolkit/dist/compat/array/reduce.js b/node_modules/es-toolkit/dist/compat/array/reduce.js new file mode 100644 index 0000000000000000000000000000000000000000..33e31ed92e9fea2ef96e4f2b5e6522660cc834c5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const range = require('../../math/range.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function reduce(collection, iteratee = identity.identity, accumulator) { + if (!collection) { + return accumulator; + } + let keys; + let startIndex = 0; + if (isArrayLike.isArrayLike(collection)) { + keys = range.range(0, collection.length); + if (accumulator == null && collection.length > 0) { + accumulator = collection[0]; + startIndex += 1; + } + } + else { + keys = Object.keys(collection); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex += 1; + } + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} + +exports.reduce = reduce; diff --git a/node_modules/es-toolkit/dist/compat/array/reduce.mjs b/node_modules/es-toolkit/dist/compat/array/reduce.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ef3bb27e557cd73a865451093361026625b17820 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.mjs @@ -0,0 +1,33 @@ +import { identity } from '../../function/identity.mjs'; +import { range } from '../../math/range.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function reduce(collection, iteratee = identity, accumulator) { + if (!collection) { + return accumulator; + } + let keys; + let startIndex = 0; + if (isArrayLike(collection)) { + keys = range(0, collection.length); + if (accumulator == null && collection.length > 0) { + accumulator = collection[0]; + startIndex += 1; + } + } + else { + keys = Object.keys(collection); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex += 1; + } + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} + +export { reduce }; diff --git a/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts b/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1348c5cdfffa1547949ae0f7e106309f0b296c5a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts @@ -0,0 +1,118 @@ +import { MemoListIterator } from '../_internal/MemoListIterator.mjs'; +import { MemoObjectIterator } from '../_internal/MemoObjectIterator.mjs'; + +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T, U + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @returns {T[keyof T] | undefined} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; + +export { reduceRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts b/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eaf8b6b0acb55c68e5a80208d706b6506143f109 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts @@ -0,0 +1,118 @@ +import { MemoListIterator } from '../_internal/MemoListIterator.js'; +import { MemoObjectIterator } from '../_internal/MemoObjectIterator.js'; + +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T, U + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @returns {T[keyof T] | undefined} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; + +export { reduceRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/reduceRight.js b/node_modules/es-toolkit/dist/compat/array/reduceRight.js new file mode 100644 index 0000000000000000000000000000000000000000..7024e752f0b4a578499f0b90125d5f1b7287d53e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const range = require('../../math/range.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function reduceRight(collection, iteratee = identity.identity, accumulator) { + if (!collection) { + return accumulator; + } + let keys; + let startIndex; + if (isArrayLike.isArrayLike(collection)) { + keys = range.range(0, collection.length).reverse(); + if (accumulator == null && collection.length > 0) { + accumulator = collection[collection.length - 1]; + startIndex = 1; + } + else { + startIndex = 0; + } + } + else { + keys = Object.keys(collection).reverse(); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex = 1; + } + else { + startIndex = 0; + } + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} + +exports.reduceRight = reduceRight; diff --git a/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs b/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9e686d80f01e091f5e62933fd8d37dfc783c9062 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs @@ -0,0 +1,39 @@ +import { identity } from '../../function/identity.mjs'; +import { range } from '../../math/range.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function reduceRight(collection, iteratee = identity, accumulator) { + if (!collection) { + return accumulator; + } + let keys; + let startIndex; + if (isArrayLike(collection)) { + keys = range(0, collection.length).reverse(); + if (accumulator == null && collection.length > 0) { + accumulator = collection[collection.length - 1]; + startIndex = 1; + } + else { + startIndex = 0; + } + } + else { + keys = Object.keys(collection).reverse(); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex = 1; + } + else { + startIndex = 0; + } + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} + +export { reduceRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/reject.d.mts b/node_modules/es-toolkit/dist/compat/array/reject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..65d698bfa3266d609159a76c986cffd644a3f702 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.d.mts @@ -0,0 +1,50 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.mjs'; +import { StringIterator } from '../_internal/StringIterator.mjs'; + +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @param {string | null | undefined} collection The string to iterate over + * @param {StringIterator} [predicate] The function invoked per iteration + * @returns {string[]} Returns a new array of characters that do not satisfy the predicate + * @example + * reject('abc', char => char === 'b') + * // => ['a', 'c'] + */ +declare function reject(collection: string | null | undefined, predicate?: StringIterator): string[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection The array-like to iterate over + * @param {ListIterateeCustom} [predicate] The function invoked per iteration + * @returns {T[]} Returns a new array of elements that do not satisfy the predicate + * @example + * reject([1, 2, 3], num => num % 2 === 0) + * // => [1, 3] + * + * reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a') + * // => [{ b: 1 }] + */ +declare function reject(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): T[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {T | null | undefined} collection The object to iterate over + * @param {ObjectIterateeCustom} [predicate] The function invoked per iteration + * @returns {Array} Returns a new array of elements that do not satisfy the predicate + * @example + * reject({ a: 1, b: 2, c: 3 }, value => value % 2 === 0) + * // => [1, 3] + * + * reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) + * // => [{ a: 0, b: true }, { a: 1, b: true }] + */ +declare function reject(collection: T | null | undefined, predicate?: ObjectIterateeCustom): Array; + +export { reject }; diff --git a/node_modules/es-toolkit/dist/compat/array/reject.d.ts b/node_modules/es-toolkit/dist/compat/array/reject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d345c3e8c05ee34e2594ff17f0b3baa5bc2166be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.d.ts @@ -0,0 +1,50 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.js'; +import { StringIterator } from '../_internal/StringIterator.js'; + +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @param {string | null | undefined} collection The string to iterate over + * @param {StringIterator} [predicate] The function invoked per iteration + * @returns {string[]} Returns a new array of characters that do not satisfy the predicate + * @example + * reject('abc', char => char === 'b') + * // => ['a', 'c'] + */ +declare function reject(collection: string | null | undefined, predicate?: StringIterator): string[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection The array-like to iterate over + * @param {ListIterateeCustom} [predicate] The function invoked per iteration + * @returns {T[]} Returns a new array of elements that do not satisfy the predicate + * @example + * reject([1, 2, 3], num => num % 2 === 0) + * // => [1, 3] + * + * reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a') + * // => [{ b: 1 }] + */ +declare function reject(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): T[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {T | null | undefined} collection The object to iterate over + * @param {ObjectIterateeCustom} [predicate] The function invoked per iteration + * @returns {Array} Returns a new array of elements that do not satisfy the predicate + * @example + * reject({ a: 1, b: 2, c: 3 }, value => value % 2 === 0) + * // => [1, 3] + * + * reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) + * // => [{ a: 0, b: true }, { a: 1, b: true }] + */ +declare function reject(collection: T | null | undefined, predicate?: ObjectIterateeCustom): Array; + +export { reject }; diff --git a/node_modules/es-toolkit/dist/compat/array/reject.js b/node_modules/es-toolkit/dist/compat/array/reject.js new file mode 100644 index 0000000000000000000000000000000000000000..1ac9d10540729f549c04c4e40440158f119cd1c6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const filter = require('./filter.js'); +const identity = require('../../function/identity.js'); +const negate = require('../function/negate.js'); +const iteratee = require('../util/iteratee.js'); + +function reject(source, predicate = identity.identity) { + return filter.filter(source, negate.negate(iteratee.iteratee(predicate))); +} + +exports.reject = reject; diff --git a/node_modules/es-toolkit/dist/compat/array/reject.mjs b/node_modules/es-toolkit/dist/compat/array/reject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a772c606111620eeb20181a6984912e93b2e73af --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.mjs @@ -0,0 +1,10 @@ +import { filter } from './filter.mjs'; +import { identity } from '../../function/identity.mjs'; +import { negate } from '../function/negate.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function reject(source, predicate = identity) { + return filter(source, negate(iteratee(predicate))); +} + +export { reject }; diff --git a/node_modules/es-toolkit/dist/compat/array/remove.d.mts b/node_modules/es-toolkit/dist/compat/array/remove.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7ea10038a4279623ced1065f1d80e11d6a4302cb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.d.mts @@ -0,0 +1,21 @@ +import { ListIteratee } from '../_internal/ListIteratee.mjs'; +import { MutableList } from '../_internal/MutableList.d.mjs'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.mjs'; + +/** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * + * @example + * const array = [1, 2, 3, 4]; + * const evens = remove(array, n => n % 2 === 0); + * console.log(array); // => [1, 3] + * console.log(evens); // => [2, 4] + */ +declare function remove>(array: RejectReadonly, predicate?: ListIteratee): Array; + +export { remove }; diff --git a/node_modules/es-toolkit/dist/compat/array/remove.d.ts b/node_modules/es-toolkit/dist/compat/array/remove.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..40588923bc97277aaa80d6f620f31629eee0967f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.d.ts @@ -0,0 +1,21 @@ +import { ListIteratee } from '../_internal/ListIteratee.js'; +import { MutableList } from '../_internal/MutableList.d.js'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.js'; + +/** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * + * @example + * const array = [1, 2, 3, 4]; + * const evens = remove(array, n => n % 2 === 0); + * console.log(array); // => [1, 3] + * console.log(evens); // => [2, 4] + */ +declare function remove>(array: RejectReadonly, predicate?: ListIteratee): Array; + +export { remove }; diff --git a/node_modules/es-toolkit/dist/compat/array/remove.js b/node_modules/es-toolkit/dist/compat/array/remove.js new file mode 100644 index 0000000000000000000000000000000000000000..3f229f017c7cee85362d771951e0668c2f431731 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const remove$1 = require('../../array/remove.js'); +const identity = require('../../function/identity.js'); +const iteratee = require('../util/iteratee.js'); + +function remove(arr, shouldRemoveElement = identity.identity) { + return remove$1.remove(arr, iteratee.iteratee(shouldRemoveElement)); +} + +exports.remove = remove; diff --git a/node_modules/es-toolkit/dist/compat/array/remove.mjs b/node_modules/es-toolkit/dist/compat/array/remove.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d4162379c67d2f5169cc65d1827d7f50542e542b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.mjs @@ -0,0 +1,9 @@ +import { remove as remove$1 } from '../../array/remove.mjs'; +import { identity } from '../../function/identity.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function remove(arr, shouldRemoveElement = identity) { + return remove$1(arr, iteratee(shouldRemoveElement)); +} + +export { remove }; diff --git a/node_modules/es-toolkit/dist/compat/array/reverse.d.mts b/node_modules/es-toolkit/dist/compat/array/reverse.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..942adcc2e9e96a12e29a986b54690b476e7e6642 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.d.mts @@ -0,0 +1,18 @@ +import { MutableList } from '../_internal/MutableList.d.mjs'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.mjs'; + +/** + * Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on. + * + * @template L + * @param {L extends readonly any[] ? never : L} array - The array to reverse. + * @returns {L} Returns `array`. + * + * @example + * const array = [1, 2, 3]; + * reverse(array); + * // => [3, 2, 1] + */ +declare function reverse>(array: RejectReadonly): L; + +export { reverse }; diff --git a/node_modules/es-toolkit/dist/compat/array/reverse.d.ts b/node_modules/es-toolkit/dist/compat/array/reverse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cafeadefb2a329892166faca917d3fcb65454489 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.d.ts @@ -0,0 +1,18 @@ +import { MutableList } from '../_internal/MutableList.d.js'; +import { RejectReadonly } from '../_internal/RejectReadonly.d.js'; + +/** + * Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on. + * + * @template L + * @param {L extends readonly any[] ? never : L} array - The array to reverse. + * @returns {L} Returns `array`. + * + * @example + * const array = [1, 2, 3]; + * reverse(array); + * // => [3, 2, 1] + */ +declare function reverse>(array: RejectReadonly): L; + +export { reverse }; diff --git a/node_modules/es-toolkit/dist/compat/array/reverse.js b/node_modules/es-toolkit/dist/compat/array/reverse.js new file mode 100644 index 0000000000000000000000000000000000000000..8009e7aed119ddc24beea2f292407de5dcfb3b79 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function reverse(array) { + if (array == null) { + return array; + } + return array.reverse(); +} + +exports.reverse = reverse; diff --git a/node_modules/es-toolkit/dist/compat/array/reverse.mjs b/node_modules/es-toolkit/dist/compat/array/reverse.mjs new file mode 100644 index 0000000000000000000000000000000000000000..24d2329fa86da2bed2d836b2f7e90d7bc96df21f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.mjs @@ -0,0 +1,8 @@ +function reverse(array) { + if (array == null) { + return array; + } + return array.reverse(); +} + +export { reverse }; diff --git a/node_modules/es-toolkit/dist/compat/array/sample.d.mts b/node_modules/es-toolkit/dist/compat/array/sample.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0f0b5fd098d2be822d01875dafdde4ef6b6c7d46 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.d.mts @@ -0,0 +1,38 @@ +/** + * Gets a random element from collection. + * + * @template T + * @param {readonly [T, ...T[]]} collection - The collection to sample. + * @returns {T} Returns the random element. + * + * @example + * sample([1, 2, 3, 4]); + * // => 2 + */ +declare function sample(collection: readonly [T, ...T[]]): T; +/** + * Gets a random element from collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample. + * @returns {T | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: Record | Record | null | undefined): T | undefined; +/** + * Gets a random element from collection. + * + * @template T + * @param {T | null | undefined} collection - The collection to sample. + * @returns {T[keyof T] | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: T | null | undefined): T[keyof T] | undefined; + +export { sample }; diff --git a/node_modules/es-toolkit/dist/compat/array/sample.d.ts b/node_modules/es-toolkit/dist/compat/array/sample.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0f0b5fd098d2be822d01875dafdde4ef6b6c7d46 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.d.ts @@ -0,0 +1,38 @@ +/** + * Gets a random element from collection. + * + * @template T + * @param {readonly [T, ...T[]]} collection - The collection to sample. + * @returns {T} Returns the random element. + * + * @example + * sample([1, 2, 3, 4]); + * // => 2 + */ +declare function sample(collection: readonly [T, ...T[]]): T; +/** + * Gets a random element from collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample. + * @returns {T | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: Record | Record | null | undefined): T | undefined; +/** + * Gets a random element from collection. + * + * @template T + * @param {T | null | undefined} collection - The collection to sample. + * @returns {T[keyof T] | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: T | null | undefined): T[keyof T] | undefined; + +export { sample }; diff --git a/node_modules/es-toolkit/dist/compat/array/sample.js b/node_modules/es-toolkit/dist/compat/array/sample.js new file mode 100644 index 0000000000000000000000000000000000000000..8dc1ed6e52f9f0fc157edf60492104d51dcd7d62 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const sample$1 = require('../../array/sample.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function sample(collection) { + if (collection == null) { + return undefined; + } + if (isArrayLike.isArrayLike(collection)) { + return sample$1.sample(toArray.toArray(collection)); + } + return sample$1.sample(Object.values(collection)); +} + +exports.sample = sample; diff --git a/node_modules/es-toolkit/dist/compat/array/sample.mjs b/node_modules/es-toolkit/dist/compat/array/sample.mjs new file mode 100644 index 0000000000000000000000000000000000000000..807b995ae20d9cc424e8934b26f38be4eae98cba --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.mjs @@ -0,0 +1,15 @@ +import { sample as sample$1 } from '../../array/sample.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function sample(collection) { + if (collection == null) { + return undefined; + } + if (isArrayLike(collection)) { + return sample$1(toArray(collection)); + } + return sample$1(Object.values(collection)); +} + +export { sample }; diff --git a/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts b/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..935c69a1f7c721ee850580915cf0187c29bb81bf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts @@ -0,0 +1,28 @@ +/** + * Returns a sample element array of a specified size from a collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample from. + * @param {number} [n] - The size of sample. + * @returns {T[]} A new array with sample size applied. + * + * @example + * sampleSize([1, 2, 3], 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: Record | Record | null | undefined, n?: number): T[]; +/** + * Returns a sample element array of a specified size from an object. + * + * @template T + * @param {T | null | undefined} collection - The object to sample from. + * @param {number} [n] - The size of sample. + * @returns {Array} A new array with sample size applied. + * + * @example + * sampleSize({ a: 1, b: 2, c: 3 }, 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: T | null | undefined, n?: number): Array; + +export { sampleSize }; diff --git a/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts b/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..935c69a1f7c721ee850580915cf0187c29bb81bf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts @@ -0,0 +1,28 @@ +/** + * Returns a sample element array of a specified size from a collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample from. + * @param {number} [n] - The size of sample. + * @returns {T[]} A new array with sample size applied. + * + * @example + * sampleSize([1, 2, 3], 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: Record | Record | null | undefined, n?: number): T[]; +/** + * Returns a sample element array of a specified size from an object. + * + * @template T + * @param {T | null | undefined} collection - The object to sample from. + * @param {number} [n] - The size of sample. + * @returns {Array} A new array with sample size applied. + * + * @example + * sampleSize({ a: 1, b: 2, c: 3 }, 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: T | null | undefined, n?: number): Array; + +export { sampleSize }; diff --git a/node_modules/es-toolkit/dist/compat/array/sampleSize.js b/node_modules/es-toolkit/dist/compat/array/sampleSize.js new file mode 100644 index 0000000000000000000000000000000000000000..016392e15e911f413d361bb7eda01e43802bfdc7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const sampleSize$1 = require('../../array/sampleSize.js'); +const isIterateeCall = require('../_internal/isIterateeCall.js'); +const clamp = require('../math/clamp.js'); +const toArray = require('../util/toArray.js'); +const toInteger = require('../util/toInteger.js'); + +function sampleSize(collection, size, guard) { + const arrayCollection = toArray.toArray(collection); + if (guard ? isIterateeCall.isIterateeCall(collection, size, guard) : size === undefined) { + size = 1; + } + else { + size = clamp.clamp(toInteger.toInteger(size), 0, arrayCollection.length); + } + return sampleSize$1.sampleSize(arrayCollection, size); +} + +exports.sampleSize = sampleSize; diff --git a/node_modules/es-toolkit/dist/compat/array/sampleSize.mjs b/node_modules/es-toolkit/dist/compat/array/sampleSize.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f3d23a95431f8b2e99541c3d27e83a7b09eb73f9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.mjs @@ -0,0 +1,18 @@ +import { sampleSize as sampleSize$1 } from '../../array/sampleSize.mjs'; +import { isIterateeCall } from '../_internal/isIterateeCall.mjs'; +import { clamp } from '../math/clamp.mjs'; +import { toArray } from '../util/toArray.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function sampleSize(collection, size, guard) { + const arrayCollection = toArray(collection); + if (guard ? isIterateeCall(collection, size, guard) : size === undefined) { + size = 1; + } + else { + size = clamp(toInteger(size), 0, arrayCollection.length); + } + return sampleSize$1(arrayCollection, size); +} + +export { sampleSize }; diff --git a/node_modules/es-toolkit/dist/compat/array/shuffle.d.mts b/node_modules/es-toolkit/dist/compat/array/shuffle.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b4ab5e72b78e44020aaf8995cdc226bc559d9d0d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.d.mts @@ -0,0 +1,22 @@ +/** + * Randomizes the order of elements in an `array` using the Fisher-Yates algorithm. + * + * This function takes an `array` and returns a new `array` with its elements shuffled in a random order. + * + * @template T - The type of elements in the `array`. + * @param {T[]} array - The `array` to shuffle. + * @returns {T[]} A new `array` with its elements shuffled in random order. + */ +declare function shuffle(array: ArrayLike | null | undefined): T[]; +/** + * Randomizes the order of elements in an `object` using the Fisher-Yates algorithm. + * + * This function takes an `object` and returns a new `object` with its values shuffled in a random order. + * + * @template T - The type of elements in the `object`. + * @param {T} object - The `object` to shuffle. + * @returns {T[]} A new `Array` with the values of the `object` shuffled in a random order. + */ +declare function shuffle(object: T | null | undefined): Array; + +export { shuffle }; diff --git a/node_modules/es-toolkit/dist/compat/array/shuffle.d.ts b/node_modules/es-toolkit/dist/compat/array/shuffle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b4ab5e72b78e44020aaf8995cdc226bc559d9d0d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.d.ts @@ -0,0 +1,22 @@ +/** + * Randomizes the order of elements in an `array` using the Fisher-Yates algorithm. + * + * This function takes an `array` and returns a new `array` with its elements shuffled in a random order. + * + * @template T - The type of elements in the `array`. + * @param {T[]} array - The `array` to shuffle. + * @returns {T[]} A new `array` with its elements shuffled in random order. + */ +declare function shuffle(array: ArrayLike | null | undefined): T[]; +/** + * Randomizes the order of elements in an `object` using the Fisher-Yates algorithm. + * + * This function takes an `object` and returns a new `object` with its values shuffled in a random order. + * + * @template T - The type of elements in the `object`. + * @param {T} object - The `object` to shuffle. + * @returns {T[]} A new `Array` with the values of the `object` shuffled in a random order. + */ +declare function shuffle(object: T | null | undefined): Array; + +export { shuffle }; diff --git a/node_modules/es-toolkit/dist/compat/array/shuffle.js b/node_modules/es-toolkit/dist/compat/array/shuffle.js new file mode 100644 index 0000000000000000000000000000000000000000..fcf1724d2d074df654360a433c10046ed20a9c65 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.js @@ -0,0 +1,28 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const shuffle$1 = require('../../array/shuffle.js'); +const values = require('../object/values.js'); +const isArray = require('../predicate/isArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const isNil = require('../predicate/isNil.js'); +const isObjectLike = require('../predicate/isObjectLike.js'); + +function shuffle(collection) { + if (isNil.isNil(collection)) { + return []; + } + if (isArray.isArray(collection)) { + return shuffle$1.shuffle(collection); + } + if (isArrayLike.isArrayLike(collection)) { + return shuffle$1.shuffle(Array.from(collection)); + } + if (isObjectLike.isObjectLike(collection)) { + return shuffle$1.shuffle(values.values(collection)); + } + return []; +} + +exports.shuffle = shuffle; diff --git a/node_modules/es-toolkit/dist/compat/array/shuffle.mjs b/node_modules/es-toolkit/dist/compat/array/shuffle.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7f4104349e037e79b95a11444b54ff33e7c62bb5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.mjs @@ -0,0 +1,24 @@ +import { shuffle as shuffle$1 } from '../../array/shuffle.mjs'; +import { values } from '../object/values.mjs'; +import { isArray } from '../predicate/isArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { isNil } from '../predicate/isNil.mjs'; +import { isObjectLike } from '../predicate/isObjectLike.mjs'; + +function shuffle(collection) { + if (isNil(collection)) { + return []; + } + if (isArray(collection)) { + return shuffle$1(collection); + } + if (isArrayLike(collection)) { + return shuffle$1(Array.from(collection)); + } + if (isObjectLike(collection)) { + return shuffle$1(values(collection)); + } + return []; +} + +export { shuffle }; diff --git a/node_modules/es-toolkit/dist/compat/array/size.d.mts b/node_modules/es-toolkit/dist/compat/array/size.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9e7b776c53efb11792c555f6ed9be4fd9e2492f3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.d.mts @@ -0,0 +1,39 @@ +/** + * Returns the length of an array, string, or object. + * + * This function takes an array, string, or object and returns its length. + * For arrays and strings, it returns the number of elements or characters, respectively. + * For objects, it returns the number of enumerable properties. + * + * @template T - The type of the input value. + * @param {T[] | object | string | Map | Set | null | undefined } target - The value whose size is to be determined. It can be an array, string, or object. + * @returns {number} The size of the input value. + * + * @example + * const arr = [1, 2, 3]; + * const arrSize = size(arr); + * // arrSize will be 3 + * + * const str = 'hello'; + * const strSize = size(str); + * // strSize will be 5 + * + * const obj = { a: 1, b: 2, c: 3 }; + * const objSize = size(obj); + * // objSize will be 3 + * + * const emptyArr = []; + * const emptyArrSize = size(emptyArr); + * // emptyArrSize will be 0 + * + * const emptyStr = ''; + * const emptyStrSize = size(emptyStr); + * // emptyStrSize will be 0 + * + * const emptyObj = {}; + * const emptyObjSize = size(emptyObj); + * // emptyObjSize will be 0 + */ +declare function size(collection: object | string | null | undefined): number; + +export { size }; diff --git a/node_modules/es-toolkit/dist/compat/array/size.d.ts b/node_modules/es-toolkit/dist/compat/array/size.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e7b776c53efb11792c555f6ed9be4fd9e2492f3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.d.ts @@ -0,0 +1,39 @@ +/** + * Returns the length of an array, string, or object. + * + * This function takes an array, string, or object and returns its length. + * For arrays and strings, it returns the number of elements or characters, respectively. + * For objects, it returns the number of enumerable properties. + * + * @template T - The type of the input value. + * @param {T[] | object | string | Map | Set | null | undefined } target - The value whose size is to be determined. It can be an array, string, or object. + * @returns {number} The size of the input value. + * + * @example + * const arr = [1, 2, 3]; + * const arrSize = size(arr); + * // arrSize will be 3 + * + * const str = 'hello'; + * const strSize = size(str); + * // strSize will be 5 + * + * const obj = { a: 1, b: 2, c: 3 }; + * const objSize = size(obj); + * // objSize will be 3 + * + * const emptyArr = []; + * const emptyArrSize = size(emptyArr); + * // emptyArrSize will be 0 + * + * const emptyStr = ''; + * const emptyStrSize = size(emptyStr); + * // emptyStrSize will be 0 + * + * const emptyObj = {}; + * const emptyObjSize = size(emptyObj); + * // emptyObjSize will be 0 + */ +declare function size(collection: object | string | null | undefined): number; + +export { size }; diff --git a/node_modules/es-toolkit/dist/compat/array/size.js b/node_modules/es-toolkit/dist/compat/array/size.js new file mode 100644 index 0000000000000000000000000000000000000000..ec91ddf46656ff1ff653fdd7b90a2215d2e599d9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isNil = require('../../predicate/isNil.js'); + +function size(target) { + if (isNil.isNil(target)) { + return 0; + } + if (target instanceof Map || target instanceof Set) { + return target.size; + } + return Object.keys(target).length; +} + +exports.size = size; diff --git a/node_modules/es-toolkit/dist/compat/array/size.mjs b/node_modules/es-toolkit/dist/compat/array/size.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0392cf8ed607cec2fd4405cb54d1a5aa70767061 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.mjs @@ -0,0 +1,13 @@ +import { isNil } from '../../predicate/isNil.mjs'; + +function size(target) { + if (isNil(target)) { + return 0; + } + if (target instanceof Map || target instanceof Set) { + return target.size; + } + return Object.keys(target).length; +} + +export { size }; diff --git a/node_modules/es-toolkit/dist/compat/array/slice.d.mts b/node_modules/es-toolkit/dist/compat/array/slice.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f9c2e53b9e39d27a0c00a09b28c3d4c27cb4a2f7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.d.mts @@ -0,0 +1,18 @@ +/** + * Create a slice of `array` from `start` up to, but not including, `end`. + * + * It does not return a dense array for sparse arrays unlike the native `Array.prototype.slice`. + * + * @template T - The type of the array elements. + * @param {ArrayLike | null | undefined} array - The array to slice. + * @param {number} [start=0] - The start position. + * @param {number} [end=array.length] - The end position. + * @returns {T[]} - Returns the slice of `array`. + * + * @example + * slice([1, 2, 3], 1, 2); // => [2] + * slice(new Array(3)); // => [undefined, undefined, undefined] + */ +declare function slice(array: ArrayLike | null | undefined, start?: number, end?: number): T[]; + +export { slice }; diff --git a/node_modules/es-toolkit/dist/compat/array/slice.d.ts b/node_modules/es-toolkit/dist/compat/array/slice.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9c2e53b9e39d27a0c00a09b28c3d4c27cb4a2f7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.d.ts @@ -0,0 +1,18 @@ +/** + * Create a slice of `array` from `start` up to, but not including, `end`. + * + * It does not return a dense array for sparse arrays unlike the native `Array.prototype.slice`. + * + * @template T - The type of the array elements. + * @param {ArrayLike | null | undefined} array - The array to slice. + * @param {number} [start=0] - The start position. + * @param {number} [end=array.length] - The end position. + * @returns {T[]} - Returns the slice of `array`. + * + * @example + * slice([1, 2, 3], 1, 2); // => [2] + * slice(new Array(3)); // => [undefined, undefined, undefined] + */ +declare function slice(array: ArrayLike | null | undefined, start?: number, end?: number): T[]; + +export { slice }; diff --git a/node_modules/es-toolkit/dist/compat/array/slice.js b/node_modules/es-toolkit/dist/compat/array/slice.js new file mode 100644 index 0000000000000000000000000000000000000000..5c1fa4aa26aec9f2d9de62a68054fc8bf1be8332 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isIterateeCall = require('../_internal/isIterateeCall.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const toInteger = require('../util/toInteger.js'); + +function slice(array, start, end) { + if (!isArrayLike.isArrayLike(array)) { + return []; + } + const length = array.length; + if (end === undefined) { + end = length; + } + else if (typeof end !== 'number' && isIterateeCall.isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + start = toInteger.toInteger(start); + end = toInteger.toInteger(end); + if (start < 0) { + start = Math.max(length + start, 0); + } + else { + start = Math.min(start, length); + } + if (end < 0) { + end = Math.max(length + end, 0); + } + else { + end = Math.min(end, length); + } + const resultLength = Math.max(end - start, 0); + const result = new Array(resultLength); + for (let i = 0; i < resultLength; ++i) { + result[i] = array[start + i]; + } + return result; +} + +exports.slice = slice; diff --git a/node_modules/es-toolkit/dist/compat/array/slice.mjs b/node_modules/es-toolkit/dist/compat/array/slice.mjs new file mode 100644 index 0000000000000000000000000000000000000000..026bec4878c2bfb52518928379040810c1d5c285 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.mjs @@ -0,0 +1,39 @@ +import { isIterateeCall } from '../_internal/isIterateeCall.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function slice(array, start, end) { + if (!isArrayLike(array)) { + return []; + } + const length = array.length; + if (end === undefined) { + end = length; + } + else if (typeof end !== 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + start = toInteger(start); + end = toInteger(end); + if (start < 0) { + start = Math.max(length + start, 0); + } + else { + start = Math.min(start, length); + } + if (end < 0) { + end = Math.max(length + end, 0); + } + else { + end = Math.min(end, length); + } + const resultLength = Math.max(end - start, 0); + const result = new Array(resultLength); + for (let i = 0; i < resultLength; ++i) { + result[i] = array[start + i]; + } + return result; +} + +export { slice }; diff --git a/node_modules/es-toolkit/dist/compat/array/some.d.mts b/node_modules/es-toolkit/dist/compat/array/some.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8a5ab16f86fd2885321e1c2700c7007829c4a8cc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.d.mts @@ -0,0 +1,31 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.mjs'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.mjs'; + +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some([null, 0, 'yes', false], Boolean); + * // => true + */ +declare function some(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): boolean; +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some({ 'a': 0, 'b': 1, 'c': 0 }, function(n) { return n > 0; }); + * // => true + */ +declare function some(collection: T | null | undefined, predicate?: ObjectIterateeCustom): boolean; + +export { some }; diff --git a/node_modules/es-toolkit/dist/compat/array/some.d.ts b/node_modules/es-toolkit/dist/compat/array/some.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf44fbc58bc4fd501b40c66f2ffa62837cb2b58a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.d.ts @@ -0,0 +1,31 @@ +import { ListIterateeCustom } from '../_internal/ListIterateeCustom.js'; +import { ObjectIterateeCustom } from '../_internal/ObjectIteratee.js'; + +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some([null, 0, 'yes', false], Boolean); + * // => true + */ +declare function some(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): boolean; +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some({ 'a': 0, 'b': 1, 'c': 0 }, function(n) { return n > 0; }); + * // => true + */ +declare function some(collection: T | null | undefined, predicate?: ObjectIterateeCustom): boolean; + +export { some }; diff --git a/node_modules/es-toolkit/dist/compat/array/some.js b/node_modules/es-toolkit/dist/compat/array/some.js new file mode 100644 index 0000000000000000000000000000000000000000..7878e6d779e9d8900f58be117e09beb7ddd17991 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.js @@ -0,0 +1,86 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const property = require('../object/property.js'); +const matches = require('../predicate/matches.js'); +const matchesProperty = require('../predicate/matchesProperty.js'); + +function some(source, predicate, guard) { + if (!source) { + return false; + } + if (guard != null) { + predicate = undefined; + } + if (predicate == null) { + predicate = identity.identity; + } + const values = Array.isArray(source) ? source : Object.values(source); + switch (typeof predicate) { + case 'function': { + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (predicate(value, key, source)) { + return true; + } + } + return false; + } + for (let i = 0; i < source.length; i++) { + if (predicate(source[i], i, source)) { + return true; + } + } + return false; + } + case 'object': { + if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + const matchFunc = matchesProperty.matchesProperty(key, value); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) { + if (matchFunc(source[i])) { + return true; + } + } + return false; + } + return values.some(matchFunc); + } + else { + const matchFunc = matches.matches(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) { + if (matchFunc(source[i])) { + return true; + } + } + return false; + } + return values.some(matchFunc); + } + } + case 'number': + case 'symbol': + case 'string': { + const propFunc = property.property(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) { + if (propFunc(source[i])) { + return true; + } + } + return false; + } + return values.some(propFunc); + } + } +} + +exports.some = some; diff --git a/node_modules/es-toolkit/dist/compat/array/some.mjs b/node_modules/es-toolkit/dist/compat/array/some.mjs new file mode 100644 index 0000000000000000000000000000000000000000..16e079eab199e6ac3b590f72163e8a8620d9d404 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.mjs @@ -0,0 +1,82 @@ +import { identity } from '../../function/identity.mjs'; +import { property } from '../object/property.mjs'; +import { matches } from '../predicate/matches.mjs'; +import { matchesProperty } from '../predicate/matchesProperty.mjs'; + +function some(source, predicate, guard) { + if (!source) { + return false; + } + if (guard != null) { + predicate = undefined; + } + if (predicate == null) { + predicate = identity; + } + const values = Array.isArray(source) ? source : Object.values(source); + switch (typeof predicate) { + case 'function': { + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (predicate(value, key, source)) { + return true; + } + } + return false; + } + for (let i = 0; i < source.length; i++) { + if (predicate(source[i], i, source)) { + return true; + } + } + return false; + } + case 'object': { + if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + const matchFunc = matchesProperty(key, value); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) { + if (matchFunc(source[i])) { + return true; + } + } + return false; + } + return values.some(matchFunc); + } + else { + const matchFunc = matches(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) { + if (matchFunc(source[i])) { + return true; + } + } + return false; + } + return values.some(matchFunc); + } + } + case 'number': + case 'symbol': + case 'string': { + const propFunc = property(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) { + if (propFunc(source[i])) { + return true; + } + } + return false; + } + return values.some(propFunc); + } + } +} + +export { some }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortBy.d.mts b/node_modules/es-toolkit/dist/compat/array/sortBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8aecc4cc46755256f8c26b11ca1f63c39fa9c5b3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.d.mts @@ -0,0 +1,73 @@ +import { ListIteratee } from '../_internal/ListIteratee.mjs'; +import { Many } from '../_internal/Many.mjs'; +import { ObjectIteratee } from '../_internal/ObjectIteratee.mjs'; + +/** + * Sorts an array of objects based on multiple properties and their corresponding order directions. + * + * This function takes an array of objects, an array of criteria to sort by. + * It returns the ascending sorted array, ordering by each key. + * If values for a key are equal, it moves to the next key to determine the order. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | object | null | undefined} collection - The array of objects to be sorted. + * @param {Array | Criterion>>} criteria - An array of criteria (property names or property paths or custom key functions) to sort by. + * @returns {T[]} - The ascending sorted array. + * + * @example + * // Sort an array of objects by 'user' in ascending order and 'age' in descending order. + * const users = [ + * { user: 'fred', age: 48 }, + * { user: 'barney', age: 34 }, + * { user: 'fred', age: 40 }, + * { user: 'barney', age: 36 }, + * ]; + * const result = sortBy(users, ['user', (item) => item.age]) + * // result will be: + * // [ + * // { user: 'barney', age: 34 }, + * // { user: 'barney', age: 36 }, + * // { user: 'fred', age: 40 }, + * // { user: 'fred', age: 48 }, + * // ] + */ +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {...Array>} iteratees - The iteratees to sort by. + * @returns {T[]} Returns the new sorted array. + * + * @example + * const users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +declare function sortBy(collection: ArrayLike | null | undefined, ...iteratees: Array>>): T[]; +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {...Array | ObjectIteratee>} iteratees - The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * + * @example + * const users = { + * 'a': { 'user': 'fred', 'age': 48 }, + * 'b': { 'user': 'barney', 'age': 36 } + * }; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 48 }] + */ +declare function sortBy(collection: T | null | undefined, ...iteratees: Array>>): Array; + +export { sortBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortBy.d.ts b/node_modules/es-toolkit/dist/compat/array/sortBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eccafb087a529ef834439f91bcedd4115d10cedb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.d.ts @@ -0,0 +1,73 @@ +import { ListIteratee } from '../_internal/ListIteratee.js'; +import { Many } from '../_internal/Many.js'; +import { ObjectIteratee } from '../_internal/ObjectIteratee.js'; + +/** + * Sorts an array of objects based on multiple properties and their corresponding order directions. + * + * This function takes an array of objects, an array of criteria to sort by. + * It returns the ascending sorted array, ordering by each key. + * If values for a key are equal, it moves to the next key to determine the order. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | object | null | undefined} collection - The array of objects to be sorted. + * @param {Array | Criterion>>} criteria - An array of criteria (property names or property paths or custom key functions) to sort by. + * @returns {T[]} - The ascending sorted array. + * + * @example + * // Sort an array of objects by 'user' in ascending order and 'age' in descending order. + * const users = [ + * { user: 'fred', age: 48 }, + * { user: 'barney', age: 34 }, + * { user: 'fred', age: 40 }, + * { user: 'barney', age: 36 }, + * ]; + * const result = sortBy(users, ['user', (item) => item.age]) + * // result will be: + * // [ + * // { user: 'barney', age: 34 }, + * // { user: 'barney', age: 36 }, + * // { user: 'fred', age: 40 }, + * // { user: 'fred', age: 48 }, + * // ] + */ +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {...Array>} iteratees - The iteratees to sort by. + * @returns {T[]} Returns the new sorted array. + * + * @example + * const users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +declare function sortBy(collection: ArrayLike | null | undefined, ...iteratees: Array>>): T[]; +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {...Array | ObjectIteratee>} iteratees - The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * + * @example + * const users = { + * 'a': { 'user': 'fred', 'age': 48 }, + * 'b': { 'user': 'barney', 'age': 36 } + * }; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 48 }] + */ +declare function sortBy(collection: T | null | undefined, ...iteratees: Array>>): Array; + +export { sortBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortBy.js b/node_modules/es-toolkit/dist/compat/array/sortBy.js new file mode 100644 index 0000000000000000000000000000000000000000..f786b5e14c334735fd4c288e3810e629dbe3bf4e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const orderBy = require('./orderBy.js'); +const flatten = require('../../array/flatten.js'); +const isIterateeCall = require('../_internal/isIterateeCall.js'); + +function sortBy(collection, ...criteria) { + const length = criteria.length; + if (length > 1 && isIterateeCall.isIterateeCall(collection, criteria[0], criteria[1])) { + criteria = []; + } + else if (length > 2 && isIterateeCall.isIterateeCall(criteria[0], criteria[1], criteria[2])) { + criteria = [criteria[0]]; + } + return orderBy.orderBy(collection, flatten.flatten(criteria), ['asc']); +} + +exports.sortBy = sortBy; diff --git a/node_modules/es-toolkit/dist/compat/array/sortBy.mjs b/node_modules/es-toolkit/dist/compat/array/sortBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fddfbe6ab54aae4a0dfa934d1d9eac8a9de91d3b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.mjs @@ -0,0 +1,16 @@ +import { orderBy } from './orderBy.mjs'; +import { flatten } from '../../array/flatten.mjs'; +import { isIterateeCall } from '../_internal/isIterateeCall.mjs'; + +function sortBy(collection, ...criteria) { + const length = criteria.length; + if (length > 1 && isIterateeCall(collection, criteria[0], criteria[1])) { + criteria = []; + } + else if (length > 2 && isIterateeCall(criteria[0], criteria[1], criteria[2])) { + criteria = [criteria[0]]; + } + return orderBy(collection, flatten(criteria), ['asc']); +} + +export { sortBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.mts b/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d5e2f7327dba8ea97fa59ea0f095ca8ace953cc1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.mts @@ -0,0 +1,30 @@ +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; + +export { sortedIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts b/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d5e2f7327dba8ea97fa59ea0f095ca8ace953cc1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts @@ -0,0 +1,30 @@ +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; + +export { sortedIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndex.js b/node_modules/es-toolkit/dist/compat/array/sortedIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..e513b276249b47f8471e7c253631a7527763926b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const sortedIndexBy = require('./sortedIndexBy.js'); +const isNil = require('../../predicate/isNil.js'); +const isNull = require('../../predicate/isNull.js'); +const isSymbol = require('../../predicate/isSymbol.js'); +const isNumber = require('../predicate/isNumber.js'); + +const MAX_ARRAY_LENGTH = 4294967295; +const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; +function sortedIndex(array, value) { + if (isNil.isNil(array)) { + return 0; + } + let low = 0; + let high = array.length; + if (isNumber.isNumber(value) && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + const mid = (low + high) >>> 1; + const compute = array[mid]; + if (!isNull.isNull(compute) && !isSymbol.isSymbol(compute) && compute < value) { + low = mid + 1; + } + else { + high = mid; + } + } + return high; + } + return sortedIndexBy.sortedIndexBy(array, value, value => value); +} + +exports.sortedIndex = sortedIndex; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndex.mjs b/node_modules/es-toolkit/dist/compat/array/sortedIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9541536f5bb5c35d11ada56e065074b2b1c1c85f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.mjs @@ -0,0 +1,31 @@ +import { sortedIndexBy } from './sortedIndexBy.mjs'; +import { isNil } from '../../predicate/isNil.mjs'; +import { isNull } from '../../predicate/isNull.mjs'; +import { isSymbol } from '../../predicate/isSymbol.mjs'; +import { isNumber } from '../predicate/isNumber.mjs'; + +const MAX_ARRAY_LENGTH = 4294967295; +const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; +function sortedIndex(array, value) { + if (isNil(array)) { + return 0; + } + let low = 0; + let high = array.length; + if (isNumber(value) && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + const mid = (low + high) >>> 1; + const compute = array[mid]; + if (!isNull(compute) && !isSymbol(compute) && compute < value) { + low = mid + 1; + } + else { + high = mid; + } + } + return high; + } + return sortedIndexBy(array, value, value => value); +} + +export { sortedIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.mts b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..edbca67f25ef5bb361201915dd231a8844488c6c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.mts @@ -0,0 +1,25 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * This method is like `sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * const dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * @example + * sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ +declare function sortedIndexBy(array: ArrayLike | null | undefined, value: T, iteratee?: ValueIteratee): number; + +export { sortedIndexBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.ts b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c81f1ac6ad6b48138f63bf8f34f545aaa8f3eef --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.ts @@ -0,0 +1,25 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * This method is like `sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * const dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * @example + * sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ +declare function sortedIndexBy(array: ArrayLike | null | undefined, value: T, iteratee?: ValueIteratee): number; + +export { sortedIndexBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js new file mode 100644 index 0000000000000000000000000000000000000000..117bda71b9487a3731280422c76a12c3cb2423be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js @@ -0,0 +1,63 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isNull = require('../../predicate/isNull.js'); +const isUndefined = require('../../predicate/isUndefined.js'); +const identity = require('../function/identity.js'); +const isNaN = require('../predicate/isNaN.js'); +const isNil = require('../predicate/isNil.js'); +const isSymbol = require('../predicate/isSymbol.js'); +const iteratee = require('../util/iteratee.js'); + +const MAX_ARRAY_LENGTH = 4294967295; +const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; +function sortedIndexBy(array, value, iteratee$1 = identity.identity, retHighest) { + if (isNil.isNil(array) || array.length === 0) { + return 0; + } + let low = 0; + let high = array.length; + const iterateeFunction = iteratee.iteratee(iteratee$1); + const transformedValue = iterateeFunction(value); + const valIsNaN = isNaN.isNaN(transformedValue); + const valIsNull = isNull.isNull(transformedValue); + const valIsSymbol = isSymbol.isSymbol(transformedValue); + const valIsUndefined = isUndefined.isUndefined(transformedValue); + while (low < high) { + let setLow; + const mid = Math.floor((low + high) / 2); + const computed = iterateeFunction(array[mid]); + const othIsDefined = !isUndefined.isUndefined(computed); + const othIsNull = isNull.isNull(computed); + const othIsReflexive = !isNaN.isNaN(computed); + const othIsSymbol = isSymbol.isSymbol(computed); + if (valIsNaN) { + setLow = retHighest || othIsReflexive; + } + else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } + else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } + else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } + else if (othIsNull || othIsSymbol) { + setLow = false; + } + else { + setLow = retHighest ? computed <= transformedValue : computed < transformedValue; + } + if (setLow) { + low = mid + 1; + } + else { + high = mid; + } + } + return Math.min(high, MAX_ARRAY_INDEX); +} + +exports.sortedIndexBy = sortedIndexBy; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2d15493d6620c5b32a0e0d3b20408ef4296ff29d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs @@ -0,0 +1,59 @@ +import { isNull } from '../../predicate/isNull.mjs'; +import { isUndefined } from '../../predicate/isUndefined.mjs'; +import { identity } from '../function/identity.mjs'; +import { isNaN } from '../predicate/isNaN.mjs'; +import { isNil } from '../predicate/isNil.mjs'; +import { isSymbol } from '../predicate/isSymbol.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +const MAX_ARRAY_LENGTH = 4294967295; +const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; +function sortedIndexBy(array, value, iteratee$1 = identity, retHighest) { + if (isNil(array) || array.length === 0) { + return 0; + } + let low = 0; + let high = array.length; + const iterateeFunction = iteratee(iteratee$1); + const transformedValue = iterateeFunction(value); + const valIsNaN = isNaN(transformedValue); + const valIsNull = isNull(transformedValue); + const valIsSymbol = isSymbol(transformedValue); + const valIsUndefined = isUndefined(transformedValue); + while (low < high) { + let setLow; + const mid = Math.floor((low + high) / 2); + const computed = iterateeFunction(array[mid]); + const othIsDefined = !isUndefined(computed); + const othIsNull = isNull(computed); + const othIsReflexive = !isNaN(computed); + const othIsSymbol = isSymbol(computed); + if (valIsNaN) { + setLow = retHighest || othIsReflexive; + } + else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } + else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } + else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } + else if (othIsNull || othIsSymbol) { + setLow = false; + } + else { + setLow = retHighest ? computed <= transformedValue : computed < transformedValue; + } + if (setLow) { + low = mid + 1; + } + else { + high = mid; + } + } + return Math.min(high, MAX_ARRAY_INDEX); +} + +export { sortedIndexBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.mts b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ee3a4f971bb690df4339dfb5f7e800c730d913b6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.mts @@ -0,0 +1,34 @@ +/** + * Finds the index of the first occurrence of a value in a sorted array, similar to how `Array#indexOf` works, but specifically for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedIndexOf(numbers, 11); // Return value: 0 + * sortedIndexOf(numbers, 30); // Return value: -1 + * + * // If the value is duplicated, it returns the first index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedIndexOf(duplicateNumbers, 3); // Return value: 3 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedIndexOf(mixedZeroArray, 0); // Return value: 0 + * sortedIndexOf(mixedZeroArray, -0); // Return value: 0 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 30 }; + * sortedIndexOf(arrayLike, 20); // Return value: 1 + */ +declare function sortedIndexOf(array: ArrayLike | null | undefined, value: T): number; + +export { sortedIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.ts b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee3a4f971bb690df4339dfb5f7e800c730d913b6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.ts @@ -0,0 +1,34 @@ +/** + * Finds the index of the first occurrence of a value in a sorted array, similar to how `Array#indexOf` works, but specifically for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedIndexOf(numbers, 11); // Return value: 0 + * sortedIndexOf(numbers, 30); // Return value: -1 + * + * // If the value is duplicated, it returns the first index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedIndexOf(duplicateNumbers, 3); // Return value: 3 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedIndexOf(mixedZeroArray, 0); // Return value: 0 + * sortedIndexOf(mixedZeroArray, -0); // Return value: 0 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 30 }; + * sortedIndexOf(arrayLike, 20); // Return value: 1 + */ +declare function sortedIndexOf(array: ArrayLike | null | undefined, value: T): number; + +export { sortedIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.js b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..e4cdedf6f9c1a212bc50128f8bbaefd03f23a964 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const sortedIndex = require('./sortedIndex.js'); +const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js'); + +function sortedIndexOf(array, value) { + if (!array?.length) { + return -1; + } + const index = sortedIndex.sortedIndex(array, value); + if (index < array.length && isEqualsSameValueZero.isEqualsSameValueZero(array[index], value)) { + return index; + } + return -1; +} + +exports.sortedIndexOf = sortedIndexOf; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.mjs b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5413cb5029b3d749405f292e08cc2dd94c364a1a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.mjs @@ -0,0 +1,15 @@ +import { sortedIndex } from './sortedIndex.mjs'; +import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs'; + +function sortedIndexOf(array, value) { + if (!array?.length) { + return -1; + } + const index = sortedIndex(array, value); + if (index < array.length && isEqualsSameValueZero(array[index], value)) { + return index; + } + return -1; +} + +export { sortedIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.mts b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d42a443aea95cfbbb5a766fa2c406b26f8fb918e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.mts @@ -0,0 +1,16 @@ +/** + * Uses a binary search to determine the highest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([4, 5, 5, 5, 6], 5) + * // => 4 + */ +declare function sortedLastIndex(array: ArrayLike | null | undefined, value: T): number; + +export { sortedLastIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.ts b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d42a443aea95cfbbb5a766fa2c406b26f8fb918e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.ts @@ -0,0 +1,16 @@ +/** + * Uses a binary search to determine the highest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([4, 5, 5, 5, 6], 5) + * // => 4 + */ +declare function sortedLastIndex(array: ArrayLike | null | undefined, value: T): number; + +export { sortedLastIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.js b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..40455292c2f3527be55aa1e9be86869ad13e3ed4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const sortedLastIndexBy = require('./sortedLastIndexBy.js'); +const isNil = require('../../predicate/isNil.js'); +const isNull = require('../../predicate/isNull.js'); +const isSymbol = require('../../predicate/isSymbol.js'); +const isNumber = require('../predicate/isNumber.js'); + +const MAX_ARRAY_LENGTH = 4294967295; +const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; +function sortedLastIndex(array, value) { + if (isNil.isNil(array)) { + return 0; + } + let high = array.length; + if (!isNumber.isNumber(value) || Number.isNaN(value) || high > HALF_MAX_ARRAY_LENGTH) { + return sortedLastIndexBy.sortedLastIndexBy(array, value, value => value); + } + let low = 0; + while (low < high) { + const mid = (low + high) >>> 1; + const compute = array[mid]; + if (!isNull.isNull(compute) && !isSymbol.isSymbol(compute) && compute <= value) { + low = mid + 1; + } + else { + high = mid; + } + } + return high; +} + +exports.sortedLastIndex = sortedLastIndex; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.mjs b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..50dc40bb78e2ffeffd5b8daaae056c095307af6f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.mjs @@ -0,0 +1,31 @@ +import { sortedLastIndexBy } from './sortedLastIndexBy.mjs'; +import { isNil } from '../../predicate/isNil.mjs'; +import { isNull } from '../../predicate/isNull.mjs'; +import { isSymbol } from '../../predicate/isSymbol.mjs'; +import { isNumber } from '../predicate/isNumber.mjs'; + +const MAX_ARRAY_LENGTH = 4294967295; +const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; +function sortedLastIndex(array, value) { + if (isNil(array)) { + return 0; + } + let high = array.length; + if (!isNumber(value) || Number.isNaN(value) || high > HALF_MAX_ARRAY_LENGTH) { + return sortedLastIndexBy(array, value, value => value); + } + let low = 0; + while (low < high) { + const mid = (low + high) >>> 1; + const compute = array[mid]; + if (!isNull(compute) && !isSymbol(compute) && compute <= value) { + low = mid + 1; + } + else { + high = mid; + } + } + return high; +} + +export { sortedLastIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.mts b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..43ef9a764ab7be6005268c930d44d0e0db660f7c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.mts @@ -0,0 +1,20 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * This method is like `sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ +declare function sortedLastIndexBy(array: ArrayLike | null | undefined, value: T, iteratee: ValueIteratee): number; + +export { sortedLastIndexBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.ts b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c2cc5404862ca11bbca3c71fcb30ef8fc023704e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.ts @@ -0,0 +1,20 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * This method is like `sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ +declare function sortedLastIndexBy(array: ArrayLike | null | undefined, value: T, iteratee: ValueIteratee): number; + +export { sortedLastIndexBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.js b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.js new file mode 100644 index 0000000000000000000000000000000000000000..b4616aaaf722d0c13f3694679cdf43a83795b985 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const sortedIndexBy = require('./sortedIndexBy.js'); + +function sortedLastIndexBy(array, value, iteratee) { + return sortedIndexBy.sortedIndexBy(array, value, iteratee, true); +} + +exports.sortedLastIndexBy = sortedLastIndexBy; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..510bc016c15024c644c5ffe07010bd133af5ef7e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs @@ -0,0 +1,7 @@ +import { sortedIndexBy } from './sortedIndexBy.mjs'; + +function sortedLastIndexBy(array, value, iteratee) { + return sortedIndexBy(array, value, iteratee, true); +} + +export { sortedLastIndexBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.mts b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e227d8dad12560dc5b85b32d80f6f1bccfea7571 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.mts @@ -0,0 +1,35 @@ +/** + * Finds the index of the last occurrence of a value in a sorted array. + * This function is similar to `Array#lastIndexOf` but is specifically designed for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the last matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedLastIndexOf(numbers, 3); // Return value: 2 + * sortedLastIndexOf(numbers, 6); // Return value: -1 + * + * // If the value is duplicated, it returns the last index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedLastIndexOf(duplicateNumbers, 3); // Return value: 5 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedLastIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedLastIndexOf(mixedZeroArray, 0); // Return value: 1 + * sortedLastIndexOf(mixedZeroArray, -0); // Return value: 1 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 20 }; + * sortedLastIndexOf(arrayLike, 20); // Return value: 2 + */ +declare function sortedLastIndexOf(array: ArrayLike | null | undefined, value: T): number; + +export { sortedLastIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.ts b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e227d8dad12560dc5b85b32d80f6f1bccfea7571 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.ts @@ -0,0 +1,35 @@ +/** + * Finds the index of the last occurrence of a value in a sorted array. + * This function is similar to `Array#lastIndexOf` but is specifically designed for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the last matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedLastIndexOf(numbers, 3); // Return value: 2 + * sortedLastIndexOf(numbers, 6); // Return value: -1 + * + * // If the value is duplicated, it returns the last index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedLastIndexOf(duplicateNumbers, 3); // Return value: 5 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedLastIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedLastIndexOf(mixedZeroArray, 0); // Return value: 1 + * sortedLastIndexOf(mixedZeroArray, -0); // Return value: 1 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 20 }; + * sortedLastIndexOf(arrayLike, 20); // Return value: 2 + */ +declare function sortedLastIndexOf(array: ArrayLike | null | undefined, value: T): number; + +export { sortedLastIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.js b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..6694c0fe9da829514696b14b6352257f7f4d7b72 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const sortedLastIndex = require('./sortedLastIndex.js'); +const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js'); + +function sortedLastIndexOf(array, value) { + if (!array?.length) { + return -1; + } + const index = sortedLastIndex.sortedLastIndex(array, value) - 1; + if (index >= 0 && isEqualsSameValueZero.isEqualsSameValueZero(array[index], value)) { + return index; + } + return -1; +} + +exports.sortedLastIndexOf = sortedLastIndexOf; diff --git a/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e874ce9347abd82ea0dadfa4960840c3eabb5cfe --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs @@ -0,0 +1,15 @@ +import { sortedLastIndex } from './sortedLastIndex.mjs'; +import { isEqualsSameValueZero } from '../../_internal/isEqualsSameValueZero.mjs'; + +function sortedLastIndexOf(array, value) { + if (!array?.length) { + return -1; + } + const index = sortedLastIndex(array, value) - 1; + if (index >= 0 && isEqualsSameValueZero(array[index], value)) { + return index; + } + return -1; +} + +export { sortedLastIndexOf }; diff --git a/node_modules/es-toolkit/dist/compat/array/tail.d.mts b/node_modules/es-toolkit/dist/compat/array/tail.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cd4714cbf56e708016345cbe8c420f2e5e662ead --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.d.mts @@ -0,0 +1,26 @@ +/** + * Gets all but the first element of array. + * + * @template T + * @param {readonly [unknown, ...T]} array - The array to query. + * @returns {T} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: readonly [unknown, ...T]): T; +/** + * Gets all but the first element of array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @returns {T[]} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: ArrayLike | null | undefined): T[]; + +export { tail }; diff --git a/node_modules/es-toolkit/dist/compat/array/tail.d.ts b/node_modules/es-toolkit/dist/compat/array/tail.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd4714cbf56e708016345cbe8c420f2e5e662ead --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.d.ts @@ -0,0 +1,26 @@ +/** + * Gets all but the first element of array. + * + * @template T + * @param {readonly [unknown, ...T]} array - The array to query. + * @returns {T} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: readonly [unknown, ...T]): T; +/** + * Gets all but the first element of array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @returns {T[]} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: ArrayLike | null | undefined): T[]; + +export { tail }; diff --git a/node_modules/es-toolkit/dist/compat/array/tail.js b/node_modules/es-toolkit/dist/compat/array/tail.js new file mode 100644 index 0000000000000000000000000000000000000000..e564188edb56960db1843104fa75a0a0ea8c4fd9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const tail$1 = require('../../array/tail.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function tail(arr) { + if (!isArrayLike.isArrayLike(arr)) { + return []; + } + return tail$1.tail(toArray.toArray(arr)); +} + +exports.tail = tail; diff --git a/node_modules/es-toolkit/dist/compat/array/tail.mjs b/node_modules/es-toolkit/dist/compat/array/tail.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fbbb7104ed8f20d9c11f7f50606f9c6b64d3c89f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.mjs @@ -0,0 +1,12 @@ +import { tail as tail$1 } from '../../array/tail.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function tail(arr) { + if (!isArrayLike(arr)) { + return []; + } + return tail$1(toArray(arr)); +} + +export { tail }; diff --git a/node_modules/es-toolkit/dist/compat/array/take.d.mts b/node_modules/es-toolkit/dist/compat/array/take.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..582ab7027afb2141d6f24aea1cd04cedc0d852c9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.d.mts @@ -0,0 +1,27 @@ +/** + * Creates a slice of array with n elements taken from the beginning. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * take([1, 2, 3]); + * // => [1] + * + * @example + * take([1, 2, 3], 2); + * // => [1, 2] + * + * @example + * take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * take([1, 2, 3], 0); + * // => [] + */ +declare function take(array: ArrayLike | null | undefined, n?: number): T[]; + +export { take }; diff --git a/node_modules/es-toolkit/dist/compat/array/take.d.ts b/node_modules/es-toolkit/dist/compat/array/take.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..582ab7027afb2141d6f24aea1cd04cedc0d852c9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.d.ts @@ -0,0 +1,27 @@ +/** + * Creates a slice of array with n elements taken from the beginning. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * take([1, 2, 3]); + * // => [1] + * + * @example + * take([1, 2, 3], 2); + * // => [1, 2] + * + * @example + * take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * take([1, 2, 3], 0); + * // => [] + */ +declare function take(array: ArrayLike | null | undefined, n?: number): T[]; + +export { take }; diff --git a/node_modules/es-toolkit/dist/compat/array/take.js b/node_modules/es-toolkit/dist/compat/array/take.js new file mode 100644 index 0000000000000000000000000000000000000000..7860480ed50800a844245985d20e74637431c521 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const take$1 = require('../../array/take.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const toInteger = require('../util/toInteger.js'); + +function take(arr, count = 1, guard) { + count = guard ? 1 : toInteger.toInteger(count); + if (count < 1 || !isArrayLike.isArrayLike(arr)) { + return []; + } + return take$1.take(toArray.toArray(arr), count); +} + +exports.take = take; diff --git a/node_modules/es-toolkit/dist/compat/array/take.mjs b/node_modules/es-toolkit/dist/compat/array/take.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c1b4ed3a6bd6ac1f1d3ec5f2ada9421aa89c041a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.mjs @@ -0,0 +1,14 @@ +import { take as take$1 } from '../../array/take.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function take(arr, count = 1, guard) { + count = guard ? 1 : toInteger(count); + if (count < 1 || !isArrayLike(arr)) { + return []; + } + return take$1(toArray(arr), count); +} + +export { take }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRight.d.mts b/node_modules/es-toolkit/dist/compat/array/takeRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..31df7e7a5a84de3ce013e6171b3ca723ac37f1fd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.d.mts @@ -0,0 +1,27 @@ +/** + * Creates a slice of array with n elements taken from the end. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * takeRight([1, 2, 3]); + * // => [3] + * + * @example + * takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * @example + * takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * takeRight([1, 2, 3], 0); + * // => [] + */ +declare function takeRight(array: ArrayLike | null | undefined, n?: number): T[]; + +export { takeRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRight.d.ts b/node_modules/es-toolkit/dist/compat/array/takeRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..31df7e7a5a84de3ce013e6171b3ca723ac37f1fd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.d.ts @@ -0,0 +1,27 @@ +/** + * Creates a slice of array with n elements taken from the end. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * takeRight([1, 2, 3]); + * // => [3] + * + * @example + * takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * @example + * takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * takeRight([1, 2, 3], 0); + * // => [] + */ +declare function takeRight(array: ArrayLike | null | undefined, n?: number): T[]; + +export { takeRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRight.js b/node_modules/es-toolkit/dist/compat/array/takeRight.js new file mode 100644 index 0000000000000000000000000000000000000000..fece14d91c7ba5171a836f5c2328503cb7c05b89 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const takeRight$1 = require('../../array/takeRight.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); +const toInteger = require('../util/toInteger.js'); + +function takeRight(arr, count = 1, guard) { + count = guard ? 1 : toInteger.toInteger(count); + if (count <= 0 || !isArrayLike.isArrayLike(arr)) { + return []; + } + return takeRight$1.takeRight(toArray.toArray(arr), count); +} + +exports.takeRight = takeRight; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRight.mjs b/node_modules/es-toolkit/dist/compat/array/takeRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2d6cf86218e8925c064023871d03fe6a9f2d2a0a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.mjs @@ -0,0 +1,14 @@ +import { takeRight as takeRight$1 } from '../../array/takeRight.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; +import { toInteger } from '../util/toInteger.mjs'; + +function takeRight(arr, count = 1, guard) { + count = guard ? 1 : toInteger(count); + if (count <= 0 || !isArrayLike(arr)) { + return []; + } + return takeRight$1(toArray(arr), count); +} + +export { takeRight }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.mts b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5243bc4756de855b445a900c673467db5d9d46ad --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.mts @@ -0,0 +1,36 @@ +import { ListIteratee } from '../_internal/ListIteratee.mjs'; + +/** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * @example + * takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, 'active'); + * // => [] + */ +declare function takeRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { takeRightWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..afc53aa32f69a4c820ff0e3db5bdc22b883f2d42 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts @@ -0,0 +1,36 @@ +import { ListIteratee } from '../_internal/ListIteratee.js'; + +/** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * @example + * takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, 'active'); + * // => [] + */ +declare function takeRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { takeRightWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..310fce36866766051032c87403f6c562a2d3d744 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const identity = require('../../function/identity.js'); +const negate = require('../../function/negate.js'); +const toArray = require('../_internal/toArray.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const iteratee = require('../util/iteratee.js'); + +function takeRightWhile(_array, predicate) { + if (!isArrayLikeObject.isArrayLikeObject(_array)) { + return []; + } + const array = toArray.toArray(_array); + const index = array.findLastIndex(negate.negate(iteratee.iteratee(predicate ?? identity.identity))); + return array.slice(index + 1); +} + +exports.takeRightWhile = takeRightWhile; diff --git a/node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c7ef177ccd9aaadaf64d61d2e923c3cfdf3a18d8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs @@ -0,0 +1,16 @@ +import { identity } from '../../function/identity.mjs'; +import { negate } from '../../function/negate.mjs'; +import { toArray } from '../_internal/toArray.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function takeRightWhile(_array, predicate) { + if (!isArrayLikeObject(_array)) { + return []; + } + const array = toArray(_array); + const index = array.findLastIndex(negate(iteratee(predicate ?? identity))); + return array.slice(index + 1); +} + +export { takeRightWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeWhile.d.mts b/node_modules/es-toolkit/dist/compat/array/takeWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..32565bb14c9c386d9fc8e492a8138774acff9d8b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.d.mts @@ -0,0 +1,36 @@ +import { ListIteratee } from '../_internal/ListIteratee.mjs'; + +/** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * @example + * takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, 'active'); + * // => [] + */ +declare function takeWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { takeWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeWhile.d.ts b/node_modules/es-toolkit/dist/compat/array/takeWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ded714589c006c68aa391a9636d5f4c7ee84437f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.d.ts @@ -0,0 +1,36 @@ +import { ListIteratee } from '../_internal/ListIteratee.js'; + +/** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * @example + * takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, 'active'); + * // => [] + */ +declare function takeWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; + +export { takeWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/takeWhile.js b/node_modules/es-toolkit/dist/compat/array/takeWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..48fae13d14ce2d19a1d9a9b22177b367b10bdf5c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const toArray = require('../_internal/toArray.js'); +const identity = require('../function/identity.js'); +const negate = require('../function/negate.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const iteratee = require('../util/iteratee.js'); + +function takeWhile(array, predicate) { + if (!isArrayLikeObject.isArrayLikeObject(array)) { + return []; + } + const _array = toArray.toArray(array); + const index = _array.findIndex(negate.negate(iteratee.iteratee(predicate ?? identity.identity))); + return index === -1 ? _array : _array.slice(0, index); +} + +exports.takeWhile = takeWhile; diff --git a/node_modules/es-toolkit/dist/compat/array/takeWhile.mjs b/node_modules/es-toolkit/dist/compat/array/takeWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d6a80ff00bc4028d8e5c4e8f01dcdb38a6c2bdc5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.mjs @@ -0,0 +1,16 @@ +import { toArray } from '../_internal/toArray.mjs'; +import { identity } from '../function/identity.mjs'; +import { negate } from '../function/negate.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function takeWhile(array, predicate) { + if (!isArrayLikeObject(array)) { + return []; + } + const _array = toArray(array); + const index = _array.findIndex(negate(iteratee(predicate ?? identity))); + return index === -1 ? _array : _array.slice(0, index); +} + +export { takeWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/union.d.mts b/node_modules/es-toolkit/dist/compat/array/union.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f9cc7655b3dd77c8b74353354f865ac3da34a849 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.d.mts @@ -0,0 +1,30 @@ +/** + * This function takes multiple arrays and returns a new array containing only the unique values + * from all input arrays, preserving the order of their first occurrence. + * + * @template T - The type of elements in the arrays. + * @param {Array | null | undefined>} arrays - The arrays to inspect. + * @returns {T[]} Returns the new array of combined unique values. + * + * @example + * // Returns [2, 1] + * union([2], [1, 2]); + * + * @example + * // Returns [2, 1, 3] + * union([2], [1, 2], [2, 3]); + * + * @example + * // Returns [1, 3, 2, [5], [4]] (does not deeply flatten nested arrays) + * union([1, 3, 2], [1, [5]], [2, [4]]); + * + * @example + * // Returns [0, 2, 1] (ignores non-array values like 3 and { '0': 1 }) + * union([0], 3, { '0': 1 }, null, [2, 1]); + * @example + * // Returns [0, 'a', 2, 1] (treats array-like object { 0: 'a', length: 1 } as a valid array) + * union([0], { 0: 'a', length: 1 }, [2, 1]); + */ +declare function union(...arrays: Array | null | undefined>): T[]; + +export { union }; diff --git a/node_modules/es-toolkit/dist/compat/array/union.d.ts b/node_modules/es-toolkit/dist/compat/array/union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9cc7655b3dd77c8b74353354f865ac3da34a849 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.d.ts @@ -0,0 +1,30 @@ +/** + * This function takes multiple arrays and returns a new array containing only the unique values + * from all input arrays, preserving the order of their first occurrence. + * + * @template T - The type of elements in the arrays. + * @param {Array | null | undefined>} arrays - The arrays to inspect. + * @returns {T[]} Returns the new array of combined unique values. + * + * @example + * // Returns [2, 1] + * union([2], [1, 2]); + * + * @example + * // Returns [2, 1, 3] + * union([2], [1, 2], [2, 3]); + * + * @example + * // Returns [1, 3, 2, [5], [4]] (does not deeply flatten nested arrays) + * union([1, 3, 2], [1, [5]], [2, [4]]); + * + * @example + * // Returns [0, 2, 1] (ignores non-array values like 3 and { '0': 1 }) + * union([0], 3, { '0': 1 }, null, [2, 1]); + * @example + * // Returns [0, 'a', 2, 1] (treats array-like object { 0: 'a', length: 1 } as a valid array) + * union([0], { 0: 'a', length: 1 }, [2, 1]); + */ +declare function union(...arrays: Array | null | undefined>): T[]; + +export { union }; diff --git a/node_modules/es-toolkit/dist/compat/array/union.js b/node_modules/es-toolkit/dist/compat/array/union.js new file mode 100644 index 0000000000000000000000000000000000000000..5a72086b5a78d7446489e32870ed419cb0aa96bd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatMapDepth = require('./flatMapDepth.js'); +const uniq = require('../../array/uniq.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function union(...arrays) { + const validArrays = arrays.filter(isArrayLikeObject.isArrayLikeObject); + const flattened = flatMapDepth.flatMapDepth(validArrays, v => Array.from(v), 1); + return uniq.uniq(flattened); +} + +exports.union = union; diff --git a/node_modules/es-toolkit/dist/compat/array/union.mjs b/node_modules/es-toolkit/dist/compat/array/union.mjs new file mode 100644 index 0000000000000000000000000000000000000000..060317bfb9d665cea391dfe978a9a4363d7599c6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.mjs @@ -0,0 +1,11 @@ +import { flatMapDepth } from './flatMapDepth.mjs'; +import { uniq } from '../../array/uniq.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function union(...arrays) { + const validArrays = arrays.filter(isArrayLikeObject); + const flattened = flatMapDepth(validArrays, v => Array.from(v), 1); + return uniq(flattened); +} + +export { union }; diff --git a/node_modules/es-toolkit/dist/compat/array/unionBy.d.mts b/node_modules/es-toolkit/dist/compat/array/unionBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..766a940bcbf896b308ac51d32ae69a37c81f453d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.d.mts @@ -0,0 +1,93 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * @example + * unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ +declare function unionBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], Math.floor); + * // => [2.1, 1.2, 3.4] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ArrayLike | null | undefined} arrays5 - The fifth array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], [5.6], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5, 5.6] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, arrays5: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; + +export { unionBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/unionBy.d.ts b/node_modules/es-toolkit/dist/compat/array/unionBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..88ea6aeebfe0fd2e9969be10e77e29062dbd7954 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.d.ts @@ -0,0 +1,93 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * @example + * unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ +declare function unionBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], Math.floor); + * // => [2.1, 1.2, 3.4] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ArrayLike | null | undefined} arrays5 - The fifth array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], [5.6], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5, 5.6] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, arrays5: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; + +export { unionBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/unionBy.js b/node_modules/es-toolkit/dist/compat/array/unionBy.js new file mode 100644 index 0000000000000000000000000000000000000000..cf3dbe152e60b5cf6e4d3a2e09f9a7ce74215524 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const last = require('../../array/last.js'); +const uniq = require('../../array/uniq.js'); +const uniqBy = require('../../array/uniqBy.js'); +const ary = require('../../function/ary.js'); +const flattenArrayLike = require('../_internal/flattenArrayLike.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const iteratee = require('../util/iteratee.js'); + +function unionBy(...values) { + const lastValue = last.last(values); + const flattened = flattenArrayLike.flattenArrayLike(values); + if (isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) { + return uniq.uniq(flattened); + } + return uniqBy.uniqBy(flattened, ary.ary(iteratee.iteratee(lastValue), 1)); +} + +exports.unionBy = unionBy; diff --git a/node_modules/es-toolkit/dist/compat/array/unionBy.mjs b/node_modules/es-toolkit/dist/compat/array/unionBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d6a52bb6dc613b6e2e5e787fbe12892a8872fe79 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.mjs @@ -0,0 +1,18 @@ +import { last } from '../../array/last.mjs'; +import { uniq } from '../../array/uniq.mjs'; +import { uniqBy } from '../../array/uniqBy.mjs'; +import { ary } from '../../function/ary.mjs'; +import { flattenArrayLike } from '../_internal/flattenArrayLike.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function unionBy(...values) { + const lastValue = last(values); + const flattened = flattenArrayLike(values); + if (isArrayLikeObject(lastValue) || lastValue == null) { + return uniq(flattened); + } + return uniqBy(flattened, ary(iteratee(lastValue), 1)); +} + +export { unionBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/unionWith.d.mts b/node_modules/es-toolkit/dist/compat/array/unionWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..39bf36948af0923a3095428c1aa4be935d46dfbd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.d.mts @@ -0,0 +1,52 @@ +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * unionWith(objects, others, isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; + +export { unionWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/unionWith.d.ts b/node_modules/es-toolkit/dist/compat/array/unionWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..39bf36948af0923a3095428c1aa4be935d46dfbd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.d.ts @@ -0,0 +1,52 @@ +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * unionWith(objects, others, isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; + +export { unionWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/unionWith.js b/node_modules/es-toolkit/dist/compat/array/unionWith.js new file mode 100644 index 0000000000000000000000000000000000000000..2ad77f99e00d63fd5797b9f92cabe55759364720 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const last = require('../../array/last.js'); +const uniq = require('../../array/uniq.js'); +const uniqWith = require('../../array/uniqWith.js'); +const flattenArrayLike = require('../_internal/flattenArrayLike.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function unionWith(...values) { + const lastValue = last.last(values); + const flattened = flattenArrayLike.flattenArrayLike(values); + if (isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) { + return uniq.uniq(flattened); + } + return uniqWith.uniqWith(flattened, lastValue); +} + +exports.unionWith = unionWith; diff --git a/node_modules/es-toolkit/dist/compat/array/unionWith.mjs b/node_modules/es-toolkit/dist/compat/array/unionWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9e1f27e474d8f8c01923f1037bd34ed493391a7c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.mjs @@ -0,0 +1,16 @@ +import { last } from '../../array/last.mjs'; +import { uniq } from '../../array/uniq.mjs'; +import { uniqWith } from '../../array/uniqWith.mjs'; +import { flattenArrayLike } from '../_internal/flattenArrayLike.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function unionWith(...values) { + const lastValue = last(values); + const flattened = flattenArrayLike(values); + if (isArrayLikeObject(lastValue) || lastValue == null) { + return uniq(flattened); + } + return uniqWith(flattened, lastValue); +} + +export { unionWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniq.d.mts b/node_modules/es-toolkit/dist/compat/array/uniq.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d08236ea46ce39765524448c38da2acd36d9a6a6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniq.d.mts @@ -0,0 +1,18 @@ +/** + * Creates a duplicate-free version of an array. + * + * This function takes an array and returns a new array containing only the unique values + * from the original array, preserving the order of first occurrence. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @returns {T[]} A new array with only unique values from the original array. + * + * @example + * const array = [1, 2, 2, 3, 4, 4, 5]; + * const result = uniq(array); + * // result will be [1, 2, 3, 4, 5] + */ +declare function uniq(arr: ArrayLike | null | undefined): T[]; + +export { uniq }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniq.d.ts b/node_modules/es-toolkit/dist/compat/array/uniq.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d08236ea46ce39765524448c38da2acd36d9a6a6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniq.d.ts @@ -0,0 +1,18 @@ +/** + * Creates a duplicate-free version of an array. + * + * This function takes an array and returns a new array containing only the unique values + * from the original array, preserving the order of first occurrence. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @returns {T[]} A new array with only unique values from the original array. + * + * @example + * const array = [1, 2, 2, 3, 4, 4, 5]; + * const result = uniq(array); + * // result will be [1, 2, 3, 4, 5] + */ +declare function uniq(arr: ArrayLike | null | undefined): T[]; + +export { uniq }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniq.js b/node_modules/es-toolkit/dist/compat/array/uniq.js new file mode 100644 index 0000000000000000000000000000000000000000..5c98d488999f1fb3f2772658b06a2e8afd399760 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniq.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const uniq$1 = require('../../array/uniq.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function uniq(arr) { + if (!isArrayLike.isArrayLike(arr)) { + return []; + } + return uniq$1.uniq(Array.from(arr)); +} + +exports.uniq = uniq; diff --git a/node_modules/es-toolkit/dist/compat/array/uniq.mjs b/node_modules/es-toolkit/dist/compat/array/uniq.mjs new file mode 100644 index 0000000000000000000000000000000000000000..028f89427a90058bcf4b06a7d679fc5ffcb1b465 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniq.mjs @@ -0,0 +1,11 @@ +import { uniq as uniq$1 } from '../../array/uniq.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function uniq(arr) { + if (!isArrayLike(arr)) { + return []; + } + return uniq$1(Array.from(arr)); +} + +export { uniq }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts b/node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..92a7ac79f263a78e590454aa138a446d5fb6ad82 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts @@ -0,0 +1,17 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * Creates a duplicate-free version of an array, using an optional transform function. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ValueIteratee} iteratee - The transform function or property name to get values from. + * @returns {T[]} Returns the new duplicate-free array. + * + * @example + * uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function uniqBy(array: ArrayLike | null | undefined, iteratee: ValueIteratee): T[]; + +export { uniqBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts b/node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dd6a23de5bcef6e68012faf54da1fffcb1ada9e7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts @@ -0,0 +1,17 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * Creates a duplicate-free version of an array, using an optional transform function. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ValueIteratee} iteratee - The transform function or property name to get values from. + * @returns {T[]} Returns the new duplicate-free array. + * + * @example + * uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function uniqBy(array: ArrayLike | null | undefined, iteratee: ValueIteratee): T[]; + +export { uniqBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqBy.js b/node_modules/es-toolkit/dist/compat/array/uniqBy.js new file mode 100644 index 0000000000000000000000000000000000000000..e0b0bf2c6c9edee0272ed1849feea6f685610b08 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqBy.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const uniqBy$1 = require('../../array/uniqBy.js'); +const ary = require('../../function/ary.js'); +const identity = require('../../function/identity.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const iteratee = require('../util/iteratee.js'); + +function uniqBy(array, iteratee$1 = identity.identity) { + if (!isArrayLikeObject.isArrayLikeObject(array)) { + return []; + } + return uniqBy$1.uniqBy(Array.from(array), ary.ary(iteratee.iteratee(iteratee$1), 1)); +} + +exports.uniqBy = uniqBy; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqBy.mjs b/node_modules/es-toolkit/dist/compat/array/uniqBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..84517880af05408edb8829bc28faabed3a0c913f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqBy.mjs @@ -0,0 +1,14 @@ +import { uniqBy as uniqBy$1 } from '../../array/uniqBy.mjs'; +import { ary } from '../../function/ary.mjs'; +import { identity } from '../../function/identity.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function uniqBy(array, iteratee$1 = identity) { + if (!isArrayLikeObject(array)) { + return []; + } + return uniqBy$1(Array.from(array), ary(iteratee(iteratee$1), 1)); +} + +export { uniqBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts b/node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d1e266c7dd22a9810efb08822f4c923dad2feb13 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts @@ -0,0 +1,27 @@ +type Comparator = (a: T, b: T) => boolean; +/** + * This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements. + * + * It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept. + * If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements. + * If no comparator is provided, shallow equality is used. + * + * The order of result values is determined by the order they appear in the input array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @param {Comparator} [comparator] - Optional function to compare elements for equality. + * @returns {T[]} A new array with only unique values based on the comparator. + * + * @example + * const array = [1, 2, 2, 3]; + * const result = uniqWith(array); + * // result will be [1, 2, 3] + * + * const array = [1, 2, 3]; + * const result = uniqWith(array, (a, b) => a % 2 === b % 2) + * // result will be [1, 2] + */ +declare function uniqWith(arr: ArrayLike | null | undefined, comparator?: Comparator): T[]; + +export { uniqWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts b/node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d1e266c7dd22a9810efb08822f4c923dad2feb13 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts @@ -0,0 +1,27 @@ +type Comparator = (a: T, b: T) => boolean; +/** + * This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements. + * + * It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept. + * If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements. + * If no comparator is provided, shallow equality is used. + * + * The order of result values is determined by the order they appear in the input array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @param {Comparator} [comparator] - Optional function to compare elements for equality. + * @returns {T[]} A new array with only unique values based on the comparator. + * + * @example + * const array = [1, 2, 2, 3]; + * const result = uniqWith(array); + * // result will be [1, 2, 3] + * + * const array = [1, 2, 3]; + * const result = uniqWith(array, (a, b) => a % 2 === b % 2) + * // result will be [1, 2] + */ +declare function uniqWith(arr: ArrayLike | null | undefined, comparator?: Comparator): T[]; + +export { uniqWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqWith.js b/node_modules/es-toolkit/dist/compat/array/uniqWith.js new file mode 100644 index 0000000000000000000000000000000000000000..66fa121b27dde8dae1024aa1e5a19131ead072dd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqWith.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const uniqWith$1 = require('../../array/uniqWith.js'); +const uniq = require('./uniq.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function uniqWith(arr, comparator) { + if (!isArrayLike.isArrayLike(arr)) { + return []; + } + return typeof comparator === 'function' ? uniqWith$1.uniqWith(Array.from(arr), comparator) : uniq.uniq(Array.from(arr)); +} + +exports.uniqWith = uniqWith; diff --git a/node_modules/es-toolkit/dist/compat/array/uniqWith.mjs b/node_modules/es-toolkit/dist/compat/array/uniqWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0ab3f53dcbcecc55eb5430f60baad5a2142ec48f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/uniqWith.mjs @@ -0,0 +1,12 @@ +import { uniqWith as uniqWith$1 } from '../../array/uniqWith.mjs'; +import { uniq } from './uniq.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function uniqWith(arr, comparator) { + if (!isArrayLike(arr)) { + return []; + } + return typeof comparator === 'function' ? uniqWith$1(Array.from(arr), comparator) : uniq(Array.from(arr)); +} + +export { uniqWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/unzip.d.mts b/node_modules/es-toolkit/dist/compat/array/unzip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b444aefdf1064d72dc38af4977ae52684a761994 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzip.d.mts @@ -0,0 +1,16 @@ +/** + * Gathers elements in the same position in an internal array + * from a grouped array of elements and returns them as a new array. + * + * @template T - The type of elements in the nested array. + * @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. + * @returns {T[][]} A new array of unzipped elements. + * + * @example + * const zipped = [['a', true, 1],['b', false, 2]]; + * const result = unzip(zipped); + * // result will be [['a', 'b'], [true, false], [1, 2]] + */ +declare function unzip(array: T[][] | ArrayLike> | null | undefined): T[][]; + +export { unzip }; diff --git a/node_modules/es-toolkit/dist/compat/array/unzip.d.ts b/node_modules/es-toolkit/dist/compat/array/unzip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b444aefdf1064d72dc38af4977ae52684a761994 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzip.d.ts @@ -0,0 +1,16 @@ +/** + * Gathers elements in the same position in an internal array + * from a grouped array of elements and returns them as a new array. + * + * @template T - The type of elements in the nested array. + * @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. + * @returns {T[][]} A new array of unzipped elements. + * + * @example + * const zipped = [['a', true, 1],['b', false, 2]]; + * const result = unzip(zipped); + * // result will be [['a', 'b'], [true, false], [1, 2]] + */ +declare function unzip(array: T[][] | ArrayLike> | null | undefined): T[][]; + +export { unzip }; diff --git a/node_modules/es-toolkit/dist/compat/array/unzip.js b/node_modules/es-toolkit/dist/compat/array/unzip.js new file mode 100644 index 0000000000000000000000000000000000000000..4110eadc4d6bc1703b923dadcfd4b8dfe0705f83 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzip.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const unzip$1 = require('../../array/unzip.js'); +const isArray = require('../predicate/isArray.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function unzip(array) { + if (!isArrayLikeObject.isArrayLikeObject(array) || !array.length) { + return []; + } + array = isArray.isArray(array) ? array : Array.from(array); + array = array.filter(item => isArrayLikeObject.isArrayLikeObject(item)); + return unzip$1.unzip(array); +} + +exports.unzip = unzip; diff --git a/node_modules/es-toolkit/dist/compat/array/unzip.mjs b/node_modules/es-toolkit/dist/compat/array/unzip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..631df333bbf5280d6a49796d2fb3a7a9057dd1e8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzip.mjs @@ -0,0 +1,14 @@ +import { unzip as unzip$1 } from '../../array/unzip.mjs'; +import { isArray } from '../predicate/isArray.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function unzip(array) { + if (!isArrayLikeObject(array) || !array.length) { + return []; + } + array = isArray(array) ? array : Array.from(array); + array = array.filter(item => isArrayLikeObject(item)); + return unzip$1(array); +} + +export { unzip }; diff --git a/node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts b/node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ed501dc0171561419f782adacd55282e4db07afe --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts @@ -0,0 +1,30 @@ +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @template T, R + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @param {(...values: T[]) => R} iteratee - The function to combine regrouped values. + * @returns {R[]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]], (a, b) => a + b); + * // => [3, 30, 300] + */ +declare function unzipWith(array: ArrayLike> | null | undefined, iteratee: (...values: T[]) => R): R[]; +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. + * + * @template T + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @returns {T[][]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]]); + * // => [[1, 2], [10, 20], [100, 200]] + */ +declare function unzipWith(array: ArrayLike> | null | undefined): T[][]; + +export { unzipWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts b/node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed501dc0171561419f782adacd55282e4db07afe --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts @@ -0,0 +1,30 @@ +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @template T, R + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @param {(...values: T[]) => R} iteratee - The function to combine regrouped values. + * @returns {R[]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]], (a, b) => a + b); + * // => [3, 30, 300] + */ +declare function unzipWith(array: ArrayLike> | null | undefined, iteratee: (...values: T[]) => R): R[]; +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. + * + * @template T + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @returns {T[][]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]]); + * // => [[1, 2], [10, 20], [100, 200]] + */ +declare function unzipWith(array: ArrayLike> | null | undefined): T[][]; + +export { unzipWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/unzipWith.js b/node_modules/es-toolkit/dist/compat/array/unzipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..ee23c9128abc9990c8d0fb21e60b996391d05593 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzipWith.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const unzip = require('../../array/unzip.js'); +const isArray = require('../predicate/isArray.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function unzipWith(array, iteratee) { + if (!isArrayLikeObject.isArrayLikeObject(array) || !array.length) { + return []; + } + const unzipped = isArray.isArray(array) ? unzip.unzip(array) : unzip.unzip(Array.from(array, value => Array.from(value))); + if (!iteratee) { + return unzipped; + } + const result = new Array(unzipped.length); + for (let i = 0; i < unzipped.length; i++) { + const value = unzipped[i]; + result[i] = iteratee(...value); + } + return result; +} + +exports.unzipWith = unzipWith; diff --git a/node_modules/es-toolkit/dist/compat/array/unzipWith.mjs b/node_modules/es-toolkit/dist/compat/array/unzipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f2c53f38f8182a04ee5cd2637c079f3f038f7bb4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unzipWith.mjs @@ -0,0 +1,21 @@ +import { unzip } from '../../array/unzip.mjs'; +import { isArray } from '../predicate/isArray.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function unzipWith(array, iteratee) { + if (!isArrayLikeObject(array) || !array.length) { + return []; + } + const unzipped = isArray(array) ? unzip(array) : unzip(Array.from(array, value => Array.from(value))); + if (!iteratee) { + return unzipped; + } + const result = new Array(unzipped.length); + for (let i = 0; i < unzipped.length; i++) { + const value = unzipped[i]; + result[i] = iteratee(...value); + } + return result; +} + +export { unzipWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/without.d.mts b/node_modules/es-toolkit/dist/compat/array/without.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c27e9fcf8cef3910a984ca95c5feca938c8cf063 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/without.d.mts @@ -0,0 +1,23 @@ +/** + * Creates an array that excludes all specified values. + * + * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to filter. + * @param {...T[]} values - The values to exclude. + * @returns {T[]} A new array without the specified values. + * + * @example + * // Removes the specified values from the array + * without([1, 2, 3, 4, 5], 2, 4); + * // Returns: [1, 3, 5] + * + * @example + * // Removes specified string values from the array + * without(['a', 'b', 'c', 'a'], 'a'); + * // Returns: ['b', 'c'] + */ +declare function without(array: ArrayLike | null | undefined, ...values: T[]): T[]; + +export { without }; diff --git a/node_modules/es-toolkit/dist/compat/array/without.d.ts b/node_modules/es-toolkit/dist/compat/array/without.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c27e9fcf8cef3910a984ca95c5feca938c8cf063 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/without.d.ts @@ -0,0 +1,23 @@ +/** + * Creates an array that excludes all specified values. + * + * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to filter. + * @param {...T[]} values - The values to exclude. + * @returns {T[]} A new array without the specified values. + * + * @example + * // Removes the specified values from the array + * without([1, 2, 3, 4, 5], 2, 4); + * // Returns: [1, 3, 5] + * + * @example + * // Removes specified string values from the array + * without(['a', 'b', 'c', 'a'], 'a'); + * // Returns: ['b', 'c'] + */ +declare function without(array: ArrayLike | null | undefined, ...values: T[]): T[]; + +export { without }; diff --git a/node_modules/es-toolkit/dist/compat/array/without.js b/node_modules/es-toolkit/dist/compat/array/without.js new file mode 100644 index 0000000000000000000000000000000000000000..3ec02b077d936105bbfeb3c228cd2695cf311575 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/without.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const without$1 = require('../../array/without.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function without(array, ...values) { + if (!isArrayLikeObject.isArrayLikeObject(array)) { + return []; + } + return without$1.without(Array.from(array), ...values); +} + +exports.without = without; diff --git a/node_modules/es-toolkit/dist/compat/array/without.mjs b/node_modules/es-toolkit/dist/compat/array/without.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6fd25d571aad1a584ddbe1a8acc8cf9b4206474a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/without.mjs @@ -0,0 +1,11 @@ +import { without as without$1 } from '../../array/without.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function without(array, ...values) { + if (!isArrayLikeObject(array)) { + return []; + } + return without$1(Array.from(array), ...values); +} + +export { without }; diff --git a/node_modules/es-toolkit/dist/compat/array/xor.d.mts b/node_modules/es-toolkit/dist/compat/array/xor.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b10a08c6ab070813021b9f19ddb607247d343282 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xor.d.mts @@ -0,0 +1,23 @@ +/** + * Computes the symmetric difference of the provided arrays, returning an array of elements + * that exist in only one of the arrays. + * + * @template T - The type of elements in the arrays. + * @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. + * @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`. + * + * @example + * // Returns [1, 2, 5, 6] + * xor([1, 2, 3, 4], [3, 4, 5, 6]); + * + * @example + * // Returns ['a', 'c'] + * xor(['a', 'b'], ['b', 'c']); + * + * @example + * // Returns [1, 3, 5] + * xor([1, 2], [2, 3], [4, 5]); + */ +declare function xor(...arrays: Array | null | undefined>): T[]; + +export { xor }; diff --git a/node_modules/es-toolkit/dist/compat/array/xor.d.ts b/node_modules/es-toolkit/dist/compat/array/xor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b10a08c6ab070813021b9f19ddb607247d343282 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xor.d.ts @@ -0,0 +1,23 @@ +/** + * Computes the symmetric difference of the provided arrays, returning an array of elements + * that exist in only one of the arrays. + * + * @template T - The type of elements in the arrays. + * @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. + * @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`. + * + * @example + * // Returns [1, 2, 5, 6] + * xor([1, 2, 3, 4], [3, 4, 5, 6]); + * + * @example + * // Returns ['a', 'c'] + * xor(['a', 'b'], ['b', 'c']); + * + * @example + * // Returns [1, 3, 5] + * xor([1, 2], [2, 3], [4, 5]); + */ +declare function xor(...arrays: Array | null | undefined>): T[]; + +export { xor }; diff --git a/node_modules/es-toolkit/dist/compat/array/xor.js b/node_modules/es-toolkit/dist/compat/array/xor.js new file mode 100644 index 0000000000000000000000000000000000000000..c8cda1736c037ea1efbaafbc2e3843fdb0926ee0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xor.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const toArray = require('../util/toArray.js'); + +function xor(...arrays) { + const itemCounts = new Map(); + for (let i = 0; i < arrays.length; i++) { + const array = arrays[i]; + if (!isArrayLikeObject.isArrayLikeObject(array)) { + continue; + } + const itemSet = new Set(toArray.toArray(array)); + for (const item of itemSet) { + if (!itemCounts.has(item)) { + itemCounts.set(item, 1); + } + else { + itemCounts.set(item, itemCounts.get(item) + 1); + } + } + } + const result = []; + for (const [item, count] of itemCounts) { + if (count === 1) { + result.push(item); + } + } + return result; +} + +exports.xor = xor; diff --git a/node_modules/es-toolkit/dist/compat/array/xor.mjs b/node_modules/es-toolkit/dist/compat/array/xor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6ac3e40f3c48e508c4b5947d75cb78b9a05267c1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xor.mjs @@ -0,0 +1,30 @@ +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { toArray } from '../util/toArray.mjs'; + +function xor(...arrays) { + const itemCounts = new Map(); + for (let i = 0; i < arrays.length; i++) { + const array = arrays[i]; + if (!isArrayLikeObject(array)) { + continue; + } + const itemSet = new Set(toArray(array)); + for (const item of itemSet) { + if (!itemCounts.has(item)) { + itemCounts.set(item, 1); + } + else { + itemCounts.set(item, itemCounts.get(item) + 1); + } + } + } + const result = []; + for (const [item, count] of itemCounts) { + if (count === 1) { + result.push(item); + } + } + return result; +} + +export { xor }; diff --git a/node_modules/es-toolkit/dist/compat/array/xorBy.d.mts b/node_modules/es-toolkit/dist/compat/array/xorBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..50ea2c71a19730164ddce94361a0b5def9b1a6e2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorBy.d.mts @@ -0,0 +1,56 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.mjs'; + +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * @example + * xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([1.2, 2.3], [3.4, 4.5], [5.6, 6.7], Math.floor); + * // => [1.2, 3.4, 5.6] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; + +export { xorBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/xorBy.d.ts b/node_modules/es-toolkit/dist/compat/array/xorBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ffd371a41e39718411116d1427b839afd6442c8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorBy.d.ts @@ -0,0 +1,56 @@ +import { ValueIteratee } from '../_internal/ValueIteratee.js'; + +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * @example + * xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([1.2, 2.3], [3.4, 4.5], [5.6, 6.7], Math.floor); + * // => [1.2, 3.4, 5.6] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; + +export { xorBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/xorBy.js b/node_modules/es-toolkit/dist/compat/array/xorBy.js new file mode 100644 index 0000000000000000000000000000000000000000..85c7049b18cf35cd6e53e6f4cd0498f58cebfe50 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorBy.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const differenceBy = require('./differenceBy.js'); +const intersectionBy = require('./intersectionBy.js'); +const last = require('./last.js'); +const unionBy = require('./unionBy.js'); +const windowed = require('../../array/windowed.js'); +const identity = require('../../function/identity.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); +const iteratee = require('../util/iteratee.js'); + +function xorBy(...values) { + const lastValue = last.last(values); + let mapper = identity.identity; + if (!isArrayLikeObject.isArrayLikeObject(lastValue) && lastValue != null) { + mapper = iteratee.iteratee(lastValue); + values = values.slice(0, -1); + } + const arrays = values.filter(isArrayLikeObject.isArrayLikeObject); + const union = unionBy.unionBy(...arrays, mapper); + const intersections = windowed.windowed(arrays, 2).map(([arr1, arr2]) => intersectionBy.intersectionBy(arr1, arr2, mapper)); + return differenceBy.differenceBy(union, unionBy.unionBy(...intersections, mapper), mapper); +} + +exports.xorBy = xorBy; diff --git a/node_modules/es-toolkit/dist/compat/array/xorBy.mjs b/node_modules/es-toolkit/dist/compat/array/xorBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e51cdcfbbe7b4e9aaa8a1a5fee482cbd5e5b1632 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorBy.mjs @@ -0,0 +1,23 @@ +import { differenceBy } from './differenceBy.mjs'; +import { intersectionBy } from './intersectionBy.mjs'; +import { last } from './last.mjs'; +import { unionBy } from './unionBy.mjs'; +import { windowed } from '../../array/windowed.mjs'; +import { identity } from '../../function/identity.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; +import { iteratee } from '../util/iteratee.mjs'; + +function xorBy(...values) { + const lastValue = last(values); + let mapper = identity; + if (!isArrayLikeObject(lastValue) && lastValue != null) { + mapper = iteratee(lastValue); + values = values.slice(0, -1); + } + const arrays = values.filter(isArrayLikeObject); + const union = unionBy(...arrays, mapper); + const intersections = windowed(arrays, 2).map(([arr1, arr2]) => intersectionBy(arr1, arr2, mapper)); + return differenceBy(union, unionBy(...intersections, mapper), mapper); +} + +export { xorBy }; diff --git a/node_modules/es-toolkit/dist/compat/array/xorWith.d.mts b/node_modules/es-toolkit/dist/compat/array/xorWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f29c717d5f2e161fda182d90a807b6abe4ae3004 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorWith.d.mts @@ -0,0 +1,52 @@ +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * xorWith(objects, others, isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; + +export { xorWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/xorWith.d.ts b/node_modules/es-toolkit/dist/compat/array/xorWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f29c717d5f2e161fda182d90a807b6abe4ae3004 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorWith.d.ts @@ -0,0 +1,52 @@ +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * xorWith(objects, others, isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; + +export { xorWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/xorWith.js b/node_modules/es-toolkit/dist/compat/array/xorWith.js new file mode 100644 index 0000000000000000000000000000000000000000..5cdbb90a33f0ba142227f5f1afe08a5046dd4624 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorWith.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const differenceWith = require('./differenceWith.js'); +const intersectionWith = require('./intersectionWith.js'); +const last = require('./last.js'); +const unionWith = require('./unionWith.js'); +const windowed = require('../../array/windowed.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function xorWith(...values) { + const lastValue = last.last(values); + let comparator = (a, b) => a === b; + if (typeof lastValue === 'function') { + comparator = lastValue; + values = values.slice(0, -1); + } + const arrays = values.filter(isArrayLikeObject.isArrayLikeObject); + const union = unionWith.unionWith(...arrays, comparator); + const intersections = windowed.windowed(arrays, 2).map(([arr1, arr2]) => intersectionWith.intersectionWith(arr1, arr2, comparator)); + return differenceWith.differenceWith(union, unionWith.unionWith(...intersections, comparator), comparator); +} + +exports.xorWith = xorWith; diff --git a/node_modules/es-toolkit/dist/compat/array/xorWith.mjs b/node_modules/es-toolkit/dist/compat/array/xorWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a4e16c6813fe5f565e45873aa61d0c2f10859ba1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/xorWith.mjs @@ -0,0 +1,21 @@ +import { differenceWith } from './differenceWith.mjs'; +import { intersectionWith } from './intersectionWith.mjs'; +import { last } from './last.mjs'; +import { unionWith } from './unionWith.mjs'; +import { windowed } from '../../array/windowed.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function xorWith(...values) { + const lastValue = last(values); + let comparator = (a, b) => a === b; + if (typeof lastValue === 'function') { + comparator = lastValue; + values = values.slice(0, -1); + } + const arrays = values.filter(isArrayLikeObject); + const union = unionWith(...arrays, comparator); + const intersections = windowed(arrays, 2).map(([arr1, arr2]) => intersectionWith(arr1, arr2, comparator)); + return differenceWith(union, unionWith(...intersections, comparator), comparator); +} + +export { xorWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/zip.d.mts b/node_modules/es-toolkit/dist/compat/array/zip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6e50b6f585503bfcb6e3ed71e7efb78aea50b2ab --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zip.d.mts @@ -0,0 +1,186 @@ +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zip(arr1, arr2); + * // result will be [[1, 'a'], [2, 'b'], [3, 'c']] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b']); + * // => [[1, 'a'], [2, 'b']] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike): Array<[T | undefined, U | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike): Array<[T | undefined, U | undefined, V | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const result = zip(arr1, arr2, arr3, arr4); + * // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null]); + * // => [[1, 'a', true, null]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W, X + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null], [undefined]); + * // => [[1, 'a', true, null, undefined]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {Array | null | undefined>} arrays - The arrays to zip. + * @returns {Array>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T + * @param {...Array | null | undefined>} arrays - The arrays to process. + * @returns {Array>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(...arrays: Array | null | undefined>): Array>; + +export { zip }; diff --git a/node_modules/es-toolkit/dist/compat/array/zip.d.ts b/node_modules/es-toolkit/dist/compat/array/zip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e50b6f585503bfcb6e3ed71e7efb78aea50b2ab --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zip.d.ts @@ -0,0 +1,186 @@ +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zip(arr1, arr2); + * // result will be [[1, 'a'], [2, 'b'], [3, 'c']] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b']); + * // => [[1, 'a'], [2, 'b']] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike): Array<[T | undefined, U | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike): Array<[T | undefined, U | undefined, V | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const result = zip(arr1, arr2, arr3, arr4); + * // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null]); + * // => [[1, 'a', true, null]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W, X + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null], [undefined]); + * // => [[1, 'a', true, null, undefined]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {Array | null | undefined>} arrays - The arrays to zip. + * @returns {Array>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T + * @param {...Array | null | undefined>} arrays - The arrays to process. + * @returns {Array>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(...arrays: Array | null | undefined>): Array>; + +export { zip }; diff --git a/node_modules/es-toolkit/dist/compat/array/zip.js b/node_modules/es-toolkit/dist/compat/array/zip.js new file mode 100644 index 0000000000000000000000000000000000000000..971a9e756153f6cd8d91855069ac51f656dbea92 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zip.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const zip$1 = require('../../array/zip.js'); +const isArrayLikeObject = require('../predicate/isArrayLikeObject.js'); + +function zip(...arrays) { + if (!arrays.length) { + return []; + } + return zip$1.zip(...arrays.filter(group => isArrayLikeObject.isArrayLikeObject(group))); +} + +exports.zip = zip; diff --git a/node_modules/es-toolkit/dist/compat/array/zip.mjs b/node_modules/es-toolkit/dist/compat/array/zip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..efdd4b032e69719e72fa5d605bf52e0348bb1b8a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zip.mjs @@ -0,0 +1,11 @@ +import { zip as zip$1 } from '../../array/zip.mjs'; +import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; + +function zip(...arrays) { + if (!arrays.length) { + return []; + } + return zip$1(...arrays.filter(group => isArrayLikeObject(group))); +} + +export { zip }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObject.d.mts b/node_modules/es-toolkit/dist/compat/array/zipObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b265b5c892dbed1c32f0c16d47566f3f5f08d476 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObject.d.mts @@ -0,0 +1,29 @@ +/** + * Combines two arrays, one of property names and one of corresponding values, into a single object. + * + * @template T - The type of values in the values array + * @param {ArrayLike} props - An array of property names + * @param {ArrayLike} values - An array of values corresponding to the property names + * @returns {Record} A new object composed of the given property names and values + * + * @example + * const props = ['a', 'b', 'c']; + * const values = [1, 2, 3]; + * zipObject(props, values); + * // => { a: 1, b: 2, c: 3 } + */ +declare function zipObject(props: ArrayLike, values: ArrayLike): Record; +/** + * Creates an object from an array of property names, with undefined values. + * + * @param {ArrayLike} [props] - An array of property names + * @returns {Record} A new object with the given property names and undefined values + * + * @example + * const props = ['a', 'b', 'c']; + * zipObject(props); + * // => { a: undefined, b: undefined, c: undefined } + */ +declare function zipObject(props?: ArrayLike): Record; + +export { zipObject }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObject.d.ts b/node_modules/es-toolkit/dist/compat/array/zipObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b265b5c892dbed1c32f0c16d47566f3f5f08d476 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObject.d.ts @@ -0,0 +1,29 @@ +/** + * Combines two arrays, one of property names and one of corresponding values, into a single object. + * + * @template T - The type of values in the values array + * @param {ArrayLike} props - An array of property names + * @param {ArrayLike} values - An array of values corresponding to the property names + * @returns {Record} A new object composed of the given property names and values + * + * @example + * const props = ['a', 'b', 'c']; + * const values = [1, 2, 3]; + * zipObject(props, values); + * // => { a: 1, b: 2, c: 3 } + */ +declare function zipObject(props: ArrayLike, values: ArrayLike): Record; +/** + * Creates an object from an array of property names, with undefined values. + * + * @param {ArrayLike} [props] - An array of property names + * @returns {Record} A new object with the given property names and undefined values + * + * @example + * const props = ['a', 'b', 'c']; + * zipObject(props); + * // => { a: undefined, b: undefined, c: undefined } + */ +declare function zipObject(props?: ArrayLike): Record; + +export { zipObject }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObject.js b/node_modules/es-toolkit/dist/compat/array/zipObject.js new file mode 100644 index 0000000000000000000000000000000000000000..6bc6c9101c8cd478e16c5b0e9146fa874dc08416 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObject.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const assignValue = require('../_internal/assignValue.js'); + +function zipObject(keys = [], values = []) { + const result = {}; + for (let i = 0; i < keys.length; i++) { + assignValue.assignValue(result, keys[i], values[i]); + } + return result; +} + +exports.zipObject = zipObject; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObject.mjs b/node_modules/es-toolkit/dist/compat/array/zipObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3b4025096d1220979b35546195f2f3ef5ac0845b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObject.mjs @@ -0,0 +1,11 @@ +import { assignValue } from '../_internal/assignValue.mjs'; + +function zipObject(keys = [], values = []) { + const result = {}; + for (let i = 0; i < keys.length; i++) { + assignValue(result, keys[i], values[i]); + } + return result; +} + +export { zipObject }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fb63cfe4ad2f374bc91a441a5a24cf16d9c7f821 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts @@ -0,0 +1,38 @@ +import { PropertyPath } from '../_internal/PropertyPath.mjs'; + +/** + * Creates a deeply nested object given arrays of paths and values. + * + * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values. + * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values. + * Paths can be dot-separated strings or arrays of property names. + * + * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values. + * + * @template P - The type of property paths. + * @template V - The type of values corresponding to the property paths. + * @param {ArrayLike

} keys - An array of property paths, each path can be a dot-separated string or an array of property names. + * @param {ArrayLike} values - An array of values corresponding to the property paths. + * @returns {Record} A new object composed of the given property paths and values. + * + * @example + * const paths = ['a.b.c', 'd.e.f']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']]; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = ['a.b[0].c', 'a.b[1].d']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ +declare function zipObjectDeep(keys?: ArrayLike, values?: ArrayLike): object; + +export { zipObjectDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ed39d8b202a79194192946b075a2d496921168c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts @@ -0,0 +1,38 @@ +import { PropertyPath } from '../_internal/PropertyPath.js'; + +/** + * Creates a deeply nested object given arrays of paths and values. + * + * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values. + * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values. + * Paths can be dot-separated strings or arrays of property names. + * + * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values. + * + * @template P - The type of property paths. + * @template V - The type of values corresponding to the property paths. + * @param {ArrayLike

} keys - An array of property paths, each path can be a dot-separated string or an array of property names. + * @param {ArrayLike} values - An array of values corresponding to the property paths. + * @returns {Record} A new object composed of the given property paths and values. + * + * @example + * const paths = ['a.b.c', 'd.e.f']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']]; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = ['a.b[0].c', 'a.b[1].d']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ +declare function zipObjectDeep(keys?: ArrayLike, values?: ArrayLike): object; + +export { zipObjectDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..76e7c212d0d62be25bab502446c8551ff88d3c55 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const zip = require('../../array/zip.js'); +const set = require('../object/set.js'); +const isArrayLike = require('../predicate/isArrayLike.js'); + +function zipObjectDeep(keys, values) { + const result = {}; + if (!isArrayLike.isArrayLike(keys)) { + return result; + } + if (!isArrayLike.isArrayLike(values)) { + values = []; + } + const zipped = zip.zip(Array.from(keys), Array.from(values)); + for (let i = 0; i < zipped.length; i++) { + const [key, value] = zipped[i]; + if (key != null) { + set.set(result, key, value); + } + } + return result; +} + +exports.zipObjectDeep = zipObjectDeep; diff --git a/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a6ffcb4aafc59e12a7d8c640bba9d46fddcdfcb9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs @@ -0,0 +1,23 @@ +import { zip } from '../../array/zip.mjs'; +import { set } from '../object/set.mjs'; +import { isArrayLike } from '../predicate/isArrayLike.mjs'; + +function zipObjectDeep(keys, values) { + const result = {}; + if (!isArrayLike(keys)) { + return result; + } + if (!isArrayLike(values)) { + values = []; + } + const zipped = zip(Array.from(keys), Array.from(values)); + for (let i = 0; i < zipped.length; i++) { + const [key, value] = zipped[i]; + if (key != null) { + set(result, key, value); + } + } + return result; +} + +export { zipObjectDeep }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipWith.d.mts b/node_modules/es-toolkit/dist/compat/array/zipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e9766f54e1e64ee0804407414fcdad855e4daabb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipWith.d.mts @@ -0,0 +1,92 @@ +/** + * Combines one array into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {(item: T) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, combine: (item: T) => R): R[]; +/** + * Combines two arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {(item1: T, item2: U) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, combine: (item1: T, item2: U) => R): R[]; +/** + * Combines three arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {(item1: T, item2: U, item3: V) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, combine: (item1: T, item2: U, item3: V) => R): R[]; +/** + * Combines four arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W) => R): R[]; +/** + * Combines five arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template X - The type of elements in the fifth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W, item5: X) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W, item5: X) => R): R[]; +/** + * Combines multiple arrays into a single array using a custom combiner function. + * + * This function takes one array and a variable number of additional arrays, + * applying the provided combiner function to the corresponding elements of each array. + * If the input arrays are of different lengths, the resulting array will have the length + * of the longest input array, with undefined values for missing elements. + * + * @template T - The type of elements in the input arrays. + * @template R - The type of elements in the resulting array. + * @param {Array<((...group: T[]) => R) | ArrayLike | null | undefined>} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`); + * // result will be ['1a', '2b', '3c'] + */ +declare function zipWith(...combine: Array<((...group: T[]) => R) | ArrayLike | null | undefined>): R[]; + +export { zipWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipWith.d.ts b/node_modules/es-toolkit/dist/compat/array/zipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9766f54e1e64ee0804407414fcdad855e4daabb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipWith.d.ts @@ -0,0 +1,92 @@ +/** + * Combines one array into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {(item: T) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, combine: (item: T) => R): R[]; +/** + * Combines two arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {(item1: T, item2: U) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, combine: (item1: T, item2: U) => R): R[]; +/** + * Combines three arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {(item1: T, item2: U, item3: V) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, combine: (item1: T, item2: U, item3: V) => R): R[]; +/** + * Combines four arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W) => R): R[]; +/** + * Combines five arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template X - The type of elements in the fifth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W, item5: X) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W, item5: X) => R): R[]; +/** + * Combines multiple arrays into a single array using a custom combiner function. + * + * This function takes one array and a variable number of additional arrays, + * applying the provided combiner function to the corresponding elements of each array. + * If the input arrays are of different lengths, the resulting array will have the length + * of the longest input array, with undefined values for missing elements. + * + * @template T - The type of elements in the input arrays. + * @template R - The type of elements in the resulting array. + * @param {Array<((...group: T[]) => R) | ArrayLike | null | undefined>} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`); + * // result will be ['1a', '2b', '3c'] + */ +declare function zipWith(...combine: Array<((...group: T[]) => R) | ArrayLike | null | undefined>): R[]; + +export { zipWith }; diff --git a/node_modules/es-toolkit/dist/compat/array/zipWith.js b/node_modules/es-toolkit/dist/compat/array/zipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..007d98175461189dbd03fe61d8cce8eda1b847f2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipWith.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const unzip = require('./unzip.js'); +const isFunction = require('../../predicate/isFunction.js'); + +function zipWith(...combine) { + let iteratee = combine.pop(); + if (!isFunction.isFunction(iteratee)) { + combine.push(iteratee); + iteratee = undefined; + } + if (!combine?.length) { + return []; + } + const result = unzip.unzip(combine); + if (iteratee == null) { + return result; + } + return result.map(group => iteratee(...group)); +} + +exports.zipWith = zipWith; diff --git a/node_modules/es-toolkit/dist/compat/array/zipWith.mjs b/node_modules/es-toolkit/dist/compat/array/zipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..00da136d6a46f83c50f79c048d34bea632ed1f71 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/zipWith.mjs @@ -0,0 +1,20 @@ +import { unzip } from './unzip.mjs'; +import { isFunction } from '../../predicate/isFunction.mjs'; + +function zipWith(...combine) { + let iteratee = combine.pop(); + if (!isFunction(iteratee)) { + combine.push(iteratee); + iteratee = undefined; + } + if (!combine?.length) { + return []; + } + const result = unzip(combine); + if (iteratee == null) { + return result; + } + return result.map(group => iteratee(...group)); +} + +export { zipWith }; diff --git a/node_modules/es-toolkit/dist/compat/compat.d.mts b/node_modules/es-toolkit/dist/compat/compat.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4807461f80f0bfef2e2ec5971f1025e656258800 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/compat.d.mts @@ -0,0 +1,291 @@ +export { castArray } from './array/castArray.mjs'; +export { chunk } from './array/chunk.mjs'; +export { compact } from './array/compact.mjs'; +export { concat } from './array/concat.mjs'; +export { countBy } from './array/countBy.mjs'; +export { difference } from './array/difference.mjs'; +export { differenceBy } from './array/differenceBy.mjs'; +export { differenceWith } from './array/differenceWith.mjs'; +export { drop } from './array/drop.mjs'; +export { dropRight } from './array/dropRight.mjs'; +export { dropRightWhile } from './array/dropRightWhile.mjs'; +export { dropWhile } from './array/dropWhile.mjs'; +export { forEach as each, forEach } from './array/forEach.mjs'; +export { forEachRight as eachRight, forEachRight } from './array/forEachRight.mjs'; +export { every } from './array/every.mjs'; +export { fill } from './array/fill.mjs'; +export { filter } from './array/filter.mjs'; +export { find } from './array/find.mjs'; +export { findIndex } from './array/findIndex.mjs'; +export { findLast } from './array/findLast.mjs'; +export { findLastIndex } from './array/findLastIndex.mjs'; +export { head as first, head } from './array/head.mjs'; +export { flatMap } from './array/flatMap.mjs'; +export { flatMapDeep } from './array/flatMapDeep.mjs'; +export { flatMapDepth } from './array/flatMapDepth.mjs'; +export { flatten } from './array/flatten.mjs'; +export { flattenDeep } from './array/flattenDeep.mjs'; +export { flattenDepth } from './array/flattenDepth.mjs'; +export { groupBy } from './array/groupBy.mjs'; +export { includes } from './array/includes.mjs'; +export { indexOf } from './array/indexOf.mjs'; +export { initial } from './array/initial.mjs'; +export { intersection } from './array/intersection.mjs'; +export { intersectionBy } from './array/intersectionBy.mjs'; +export { intersectionWith } from './array/intersectionWith.mjs'; +export { invokeMap } from './array/invokeMap.mjs'; +export { join } from './array/join.mjs'; +export { keyBy } from './array/keyBy.mjs'; +export { last } from './array/last.mjs'; +export { lastIndexOf } from './array/lastIndexOf.mjs'; +export { map } from './array/map.mjs'; +export { nth } from './array/nth.mjs'; +export { orderBy } from './array/orderBy.mjs'; +export { partition } from './array/partition.mjs'; +export { pull } from './array/pull.mjs'; +export { pullAll } from './array/pullAll.mjs'; +export { pullAllBy } from './array/pullAllBy.mjs'; +export { pullAllWith } from './array/pullAllWith.mjs'; +export { pullAt } from './array/pullAt.mjs'; +export { reduce } from './array/reduce.mjs'; +export { reduceRight } from './array/reduceRight.mjs'; +export { reject } from './array/reject.mjs'; +export { remove } from './array/remove.mjs'; +export { reverse } from './array/reverse.mjs'; +export { sample } from './array/sample.mjs'; +export { sampleSize } from './array/sampleSize.mjs'; +export { shuffle } from './array/shuffle.mjs'; +export { size } from './array/size.mjs'; +export { slice } from './array/slice.mjs'; +export { some } from './array/some.mjs'; +export { sortBy } from './array/sortBy.mjs'; +export { sortedIndex } from './array/sortedIndex.mjs'; +export { sortedIndexBy } from './array/sortedIndexBy.mjs'; +export { sortedIndexOf } from './array/sortedIndexOf.mjs'; +export { sortedLastIndex } from './array/sortedLastIndex.mjs'; +export { sortedLastIndexBy } from './array/sortedLastIndexBy.mjs'; +export { sortedLastIndexOf } from './array/sortedLastIndexOf.mjs'; +export { tail } from './array/tail.mjs'; +export { take } from './array/take.mjs'; +export { takeRight } from './array/takeRight.mjs'; +export { takeRightWhile } from './array/takeRightWhile.mjs'; +export { takeWhile } from './array/takeWhile.mjs'; +export { union } from './array/union.mjs'; +export { unionBy } from './array/unionBy.mjs'; +export { unionWith } from './array/unionWith.mjs'; +export { uniq } from './array/uniq.mjs'; +export { uniqBy } from './array/uniqBy.mjs'; +export { uniqWith } from './array/uniqWith.mjs'; +export { unzip } from './array/unzip.mjs'; +export { unzipWith } from './array/unzipWith.mjs'; +export { without } from './array/without.mjs'; +export { xor } from './array/xor.mjs'; +export { xorBy } from './array/xorBy.mjs'; +export { xorWith } from './array/xorWith.mjs'; +export { zip } from './array/zip.mjs'; +export { zipObject } from './array/zipObject.mjs'; +export { zipObjectDeep } from './array/zipObjectDeep.mjs'; +export { zipWith } from './array/zipWith.mjs'; +export { after } from './function/after.mjs'; +export { ary } from './function/ary.mjs'; +export { attempt } from './function/attempt.mjs'; +export { before } from './function/before.mjs'; +export { bind } from './function/bind.mjs'; +export { bindKey } from './function/bindKey.mjs'; +export { curry } from './function/curry.mjs'; +export { curryRight } from './function/curryRight.mjs'; +export { DebouncedFunc, debounce } from './function/debounce.mjs'; +export { defer } from './function/defer.mjs'; +export { delay } from './function/delay.mjs'; +export { flip } from './function/flip.mjs'; +export { flow } from './function/flow.mjs'; +export { flowRight } from './function/flowRight.mjs'; +export { memoize } from './function/memoize.mjs'; +export { negate } from './function/negate.mjs'; +export { nthArg } from './function/nthArg.mjs'; +export { once } from './function/once.mjs'; +export { overArgs } from './function/overArgs.mjs'; +export { partial } from './function/partial.mjs'; +export { partialRight } from './function/partialRight.mjs'; +export { rearg } from './function/rearg.mjs'; +export { rest } from './function/rest.mjs'; +export { spread } from './function/spread.mjs'; +export { throttle } from './function/throttle.mjs'; +export { unary } from './function/unary.mjs'; +export { wrap } from './function/wrap.mjs'; +export { add } from './math/add.mjs'; +export { ceil } from './math/ceil.mjs'; +export { clamp } from './math/clamp.mjs'; +export { divide } from './math/divide.mjs'; +export { floor } from './math/floor.mjs'; +export { inRange } from './math/inRange.mjs'; +export { max } from './math/max.mjs'; +export { maxBy } from './math/maxBy.mjs'; +export { mean } from './math/mean.mjs'; +export { meanBy } from './math/meanBy.mjs'; +export { min } from './math/min.mjs'; +export { minBy } from './math/minBy.mjs'; +export { multiply } from './math/multiply.mjs'; +export { parseInt } from './math/parseInt.mjs'; +export { random } from './math/random.mjs'; +export { range } from './math/range.mjs'; +export { rangeRight } from './math/rangeRight.mjs'; +export { round } from './math/round.mjs'; +export { subtract } from './math/subtract.mjs'; +export { sum } from './math/sum.mjs'; +export { sumBy } from './math/sumBy.mjs'; +export { isEqual } from '../predicate/isEqual.mjs'; +export { identity } from './function/identity.mjs'; +export { noop } from './function/noop.mjs'; +export { assign } from './object/assign.mjs'; +export { assignIn, assignIn as extend } from './object/assignIn.mjs'; +export { assignInWith, assignInWith as extendWith } from './object/assignInWith.mjs'; +export { assignWith } from './object/assignWith.mjs'; +export { at } from './object/at.mjs'; +export { clone } from './object/clone.mjs'; +export { cloneDeep } from './object/cloneDeep.mjs'; +export { cloneDeepWith } from './object/cloneDeepWith.mjs'; +export { cloneWith } from './object/cloneWith.mjs'; +export { create } from './object/create.mjs'; +export { defaults } from './object/defaults.mjs'; +export { defaultsDeep } from './object/defaultsDeep.mjs'; +export { findKey } from './object/findKey.mjs'; +export { findLastKey } from './object/findLastKey.mjs'; +export { forIn } from './object/forIn.mjs'; +export { forInRight } from './object/forInRight.mjs'; +export { forOwn } from './object/forOwn.mjs'; +export { forOwnRight } from './object/forOwnRight.mjs'; +export { fromPairs } from './object/fromPairs.mjs'; +export { functions } from './object/functions.mjs'; +export { functionsIn } from './object/functionsIn.mjs'; +export { get } from './object/get.mjs'; +export { has } from './object/has.mjs'; +export { hasIn } from './object/hasIn.mjs'; +export { invert } from './object/invert.mjs'; +export { invertBy } from './object/invertBy.mjs'; +export { keys } from './object/keys.mjs'; +export { keysIn } from './object/keysIn.mjs'; +export { mapKeys } from './object/mapKeys.mjs'; +export { mapValues } from './object/mapValues.mjs'; +export { merge } from './object/merge.mjs'; +export { mergeWith } from './object/mergeWith.mjs'; +export { omit } from './object/omit.mjs'; +export { omitBy } from './object/omitBy.mjs'; +export { pick } from './object/pick.mjs'; +export { pickBy } from './object/pickBy.mjs'; +export { property } from './object/property.mjs'; +export { propertyOf } from './object/propertyOf.mjs'; +export { result } from './object/result.mjs'; +export { set } from './object/set.mjs'; +export { setWith } from './object/setWith.mjs'; +export { toDefaulted } from './object/toDefaulted.mjs'; +export { toPairs } from './object/toPairs.mjs'; +export { toPairsIn } from './object/toPairsIn.mjs'; +export { transform } from './object/transform.mjs'; +export { unset } from './object/unset.mjs'; +export { update } from './object/update.mjs'; +export { updateWith } from './object/updateWith.mjs'; +export { values } from './object/values.mjs'; +export { valuesIn } from './object/valuesIn.mjs'; +export { isFunction } from './predicate/isFunction.mjs'; +export { isLength } from './predicate/isLength.mjs'; +export { isMatchWith } from './predicate/isMatchWith.mjs'; +export { isNative } from './predicate/isNative.mjs'; +export { isNull } from './predicate/isNull.mjs'; +export { isUndefined } from './predicate/isUndefined.mjs'; +export { conforms } from './predicate/conforms.mjs'; +export { conformsTo } from './predicate/conformsTo.mjs'; +export { isArguments } from './predicate/isArguments.mjs'; +export { isArray } from './predicate/isArray.mjs'; +export { isArrayBuffer } from './predicate/isArrayBuffer.mjs'; +export { isArrayLike } from './predicate/isArrayLike.mjs'; +export { isArrayLikeObject } from './predicate/isArrayLikeObject.mjs'; +export { isBoolean } from './predicate/isBoolean.mjs'; +export { isBuffer } from './predicate/isBuffer.mjs'; +export { isDate } from './predicate/isDate.mjs'; +export { isElement } from './predicate/isElement.mjs'; +export { isEmpty } from './predicate/isEmpty.mjs'; +export { isEqualWith } from './predicate/isEqualWith.mjs'; +export { isError } from './predicate/isError.mjs'; +export { isFinite } from './predicate/isFinite.mjs'; +export { isInteger } from './predicate/isInteger.mjs'; +export { isMap } from './predicate/isMap.mjs'; +export { isMatch } from './predicate/isMatch.mjs'; +export { isNaN } from './predicate/isNaN.mjs'; +export { isNil } from './predicate/isNil.mjs'; +export { isNumber } from './predicate/isNumber.mjs'; +export { isObject } from './predicate/isObject.mjs'; +export { isObjectLike } from './predicate/isObjectLike.mjs'; +export { isPlainObject } from './predicate/isPlainObject.mjs'; +export { isRegExp } from './predicate/isRegExp.mjs'; +export { isSafeInteger } from './predicate/isSafeInteger.mjs'; +export { isSet } from './predicate/isSet.mjs'; +export { isString } from './predicate/isString.mjs'; +export { isSymbol } from './predicate/isSymbol.mjs'; +export { isTypedArray } from './predicate/isTypedArray.mjs'; +export { isWeakMap } from './predicate/isWeakMap.mjs'; +export { isWeakSet } from './predicate/isWeakSet.mjs'; +export { matches } from './predicate/matches.mjs'; +export { matchesProperty } from './predicate/matchesProperty.mjs'; +export { capitalize } from './string/capitalize.mjs'; +export { bindAll } from './util/bindAll.mjs'; +export { camelCase } from './string/camelCase.mjs'; +export { deburr } from './string/deburr.mjs'; +export { endsWith } from './string/endsWith.mjs'; +export { escape } from './string/escape.mjs'; +export { escapeRegExp } from './string/escapeRegExp.mjs'; +export { kebabCase } from './string/kebabCase.mjs'; +export { lowerCase } from './string/lowerCase.mjs'; +export { lowerFirst } from './string/lowerFirst.mjs'; +export { pad } from './string/pad.mjs'; +export { padEnd } from './string/padEnd.mjs'; +export { padStart } from './string/padStart.mjs'; +export { repeat } from './string/repeat.mjs'; +export { replace } from './string/replace.mjs'; +export { snakeCase } from './string/snakeCase.mjs'; +export { split } from './string/split.mjs'; +export { startCase } from './string/startCase.mjs'; +export { startsWith } from './string/startsWith.mjs'; +export { template, templateSettings } from './string/template.mjs'; +export { toLower } from './string/toLower.mjs'; +export { toUpper } from './string/toUpper.mjs'; +export { trim } from './string/trim.mjs'; +export { trimEnd } from './string/trimEnd.mjs'; +export { trimStart } from './string/trimStart.mjs'; +export { truncate } from './string/truncate.mjs'; +export { unescape } from './string/unescape.mjs'; +export { upperCase } from './string/upperCase.mjs'; +export { upperFirst } from './string/upperFirst.mjs'; +export { words } from './string/words.mjs'; +export { cond } from './util/cond.mjs'; +export { constant } from './util/constant.mjs'; +export { defaultTo } from './util/defaultTo.mjs'; +export { isEqualsSameValueZero as eq } from '../_internal/isEqualsSameValueZero.mjs'; +export { gt } from './util/gt.mjs'; +export { gte } from './util/gte.mjs'; +export { invoke } from './util/invoke.mjs'; +export { iteratee } from './util/iteratee.mjs'; +export { lt } from './util/lt.mjs'; +export { lte } from './util/lte.mjs'; +export { method } from './util/method.mjs'; +export { methodOf } from './util/methodOf.mjs'; +export { now } from './util/now.mjs'; +export { over } from './util/over.mjs'; +export { overEvery } from './util/overEvery.mjs'; +export { overSome } from './util/overSome.mjs'; +export { stubArray } from './util/stubArray.mjs'; +export { stubFalse } from './util/stubFalse.mjs'; +export { stubObject } from './util/stubObject.mjs'; +export { stubString } from './util/stubString.mjs'; +export { stubTrue } from './util/stubTrue.mjs'; +export { times } from './util/times.mjs'; +export { toArray } from './util/toArray.mjs'; +export { toFinite } from './util/toFinite.mjs'; +export { toInteger } from './util/toInteger.mjs'; +export { toLength } from './util/toLength.mjs'; +export { toNumber } from './util/toNumber.mjs'; +export { toPath } from './util/toPath.mjs'; +export { toPlainObject } from './util/toPlainObject.mjs'; +export { toSafeInteger } from './util/toSafeInteger.mjs'; +export { toString } from './util/toString.mjs'; +export { uniqueId } from './util/uniqueId.mjs'; diff --git a/node_modules/es-toolkit/dist/compat/compat.d.ts b/node_modules/es-toolkit/dist/compat/compat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3776171cf4578fc5914339d3fe23102cadab7f58 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/compat.d.ts @@ -0,0 +1,291 @@ +export { castArray } from './array/castArray.js'; +export { chunk } from './array/chunk.js'; +export { compact } from './array/compact.js'; +export { concat } from './array/concat.js'; +export { countBy } from './array/countBy.js'; +export { difference } from './array/difference.js'; +export { differenceBy } from './array/differenceBy.js'; +export { differenceWith } from './array/differenceWith.js'; +export { drop } from './array/drop.js'; +export { dropRight } from './array/dropRight.js'; +export { dropRightWhile } from './array/dropRightWhile.js'; +export { dropWhile } from './array/dropWhile.js'; +export { forEach as each, forEach } from './array/forEach.js'; +export { forEachRight as eachRight, forEachRight } from './array/forEachRight.js'; +export { every } from './array/every.js'; +export { fill } from './array/fill.js'; +export { filter } from './array/filter.js'; +export { find } from './array/find.js'; +export { findIndex } from './array/findIndex.js'; +export { findLast } from './array/findLast.js'; +export { findLastIndex } from './array/findLastIndex.js'; +export { head as first, head } from './array/head.js'; +export { flatMap } from './array/flatMap.js'; +export { flatMapDeep } from './array/flatMapDeep.js'; +export { flatMapDepth } from './array/flatMapDepth.js'; +export { flatten } from './array/flatten.js'; +export { flattenDeep } from './array/flattenDeep.js'; +export { flattenDepth } from './array/flattenDepth.js'; +export { groupBy } from './array/groupBy.js'; +export { includes } from './array/includes.js'; +export { indexOf } from './array/indexOf.js'; +export { initial } from './array/initial.js'; +export { intersection } from './array/intersection.js'; +export { intersectionBy } from './array/intersectionBy.js'; +export { intersectionWith } from './array/intersectionWith.js'; +export { invokeMap } from './array/invokeMap.js'; +export { join } from './array/join.js'; +export { keyBy } from './array/keyBy.js'; +export { last } from './array/last.js'; +export { lastIndexOf } from './array/lastIndexOf.js'; +export { map } from './array/map.js'; +export { nth } from './array/nth.js'; +export { orderBy } from './array/orderBy.js'; +export { partition } from './array/partition.js'; +export { pull } from './array/pull.js'; +export { pullAll } from './array/pullAll.js'; +export { pullAllBy } from './array/pullAllBy.js'; +export { pullAllWith } from './array/pullAllWith.js'; +export { pullAt } from './array/pullAt.js'; +export { reduce } from './array/reduce.js'; +export { reduceRight } from './array/reduceRight.js'; +export { reject } from './array/reject.js'; +export { remove } from './array/remove.js'; +export { reverse } from './array/reverse.js'; +export { sample } from './array/sample.js'; +export { sampleSize } from './array/sampleSize.js'; +export { shuffle } from './array/shuffle.js'; +export { size } from './array/size.js'; +export { slice } from './array/slice.js'; +export { some } from './array/some.js'; +export { sortBy } from './array/sortBy.js'; +export { sortedIndex } from './array/sortedIndex.js'; +export { sortedIndexBy } from './array/sortedIndexBy.js'; +export { sortedIndexOf } from './array/sortedIndexOf.js'; +export { sortedLastIndex } from './array/sortedLastIndex.js'; +export { sortedLastIndexBy } from './array/sortedLastIndexBy.js'; +export { sortedLastIndexOf } from './array/sortedLastIndexOf.js'; +export { tail } from './array/tail.js'; +export { take } from './array/take.js'; +export { takeRight } from './array/takeRight.js'; +export { takeRightWhile } from './array/takeRightWhile.js'; +export { takeWhile } from './array/takeWhile.js'; +export { union } from './array/union.js'; +export { unionBy } from './array/unionBy.js'; +export { unionWith } from './array/unionWith.js'; +export { uniq } from './array/uniq.js'; +export { uniqBy } from './array/uniqBy.js'; +export { uniqWith } from './array/uniqWith.js'; +export { unzip } from './array/unzip.js'; +export { unzipWith } from './array/unzipWith.js'; +export { without } from './array/without.js'; +export { xor } from './array/xor.js'; +export { xorBy } from './array/xorBy.js'; +export { xorWith } from './array/xorWith.js'; +export { zip } from './array/zip.js'; +export { zipObject } from './array/zipObject.js'; +export { zipObjectDeep } from './array/zipObjectDeep.js'; +export { zipWith } from './array/zipWith.js'; +export { after } from './function/after.js'; +export { ary } from './function/ary.js'; +export { attempt } from './function/attempt.js'; +export { before } from './function/before.js'; +export { bind } from './function/bind.js'; +export { bindKey } from './function/bindKey.js'; +export { curry } from './function/curry.js'; +export { curryRight } from './function/curryRight.js'; +export { DebouncedFunc, debounce } from './function/debounce.js'; +export { defer } from './function/defer.js'; +export { delay } from './function/delay.js'; +export { flip } from './function/flip.js'; +export { flow } from './function/flow.js'; +export { flowRight } from './function/flowRight.js'; +export { memoize } from './function/memoize.js'; +export { negate } from './function/negate.js'; +export { nthArg } from './function/nthArg.js'; +export { once } from './function/once.js'; +export { overArgs } from './function/overArgs.js'; +export { partial } from './function/partial.js'; +export { partialRight } from './function/partialRight.js'; +export { rearg } from './function/rearg.js'; +export { rest } from './function/rest.js'; +export { spread } from './function/spread.js'; +export { throttle } from './function/throttle.js'; +export { unary } from './function/unary.js'; +export { wrap } from './function/wrap.js'; +export { add } from './math/add.js'; +export { ceil } from './math/ceil.js'; +export { clamp } from './math/clamp.js'; +export { divide } from './math/divide.js'; +export { floor } from './math/floor.js'; +export { inRange } from './math/inRange.js'; +export { max } from './math/max.js'; +export { maxBy } from './math/maxBy.js'; +export { mean } from './math/mean.js'; +export { meanBy } from './math/meanBy.js'; +export { min } from './math/min.js'; +export { minBy } from './math/minBy.js'; +export { multiply } from './math/multiply.js'; +export { parseInt } from './math/parseInt.js'; +export { random } from './math/random.js'; +export { range } from './math/range.js'; +export { rangeRight } from './math/rangeRight.js'; +export { round } from './math/round.js'; +export { subtract } from './math/subtract.js'; +export { sum } from './math/sum.js'; +export { sumBy } from './math/sumBy.js'; +export { isEqual } from '../predicate/isEqual.js'; +export { identity } from './function/identity.js'; +export { noop } from './function/noop.js'; +export { assign } from './object/assign.js'; +export { assignIn, assignIn as extend } from './object/assignIn.js'; +export { assignInWith, assignInWith as extendWith } from './object/assignInWith.js'; +export { assignWith } from './object/assignWith.js'; +export { at } from './object/at.js'; +export { clone } from './object/clone.js'; +export { cloneDeep } from './object/cloneDeep.js'; +export { cloneDeepWith } from './object/cloneDeepWith.js'; +export { cloneWith } from './object/cloneWith.js'; +export { create } from './object/create.js'; +export { defaults } from './object/defaults.js'; +export { defaultsDeep } from './object/defaultsDeep.js'; +export { findKey } from './object/findKey.js'; +export { findLastKey } from './object/findLastKey.js'; +export { forIn } from './object/forIn.js'; +export { forInRight } from './object/forInRight.js'; +export { forOwn } from './object/forOwn.js'; +export { forOwnRight } from './object/forOwnRight.js'; +export { fromPairs } from './object/fromPairs.js'; +export { functions } from './object/functions.js'; +export { functionsIn } from './object/functionsIn.js'; +export { get } from './object/get.js'; +export { has } from './object/has.js'; +export { hasIn } from './object/hasIn.js'; +export { invert } from './object/invert.js'; +export { invertBy } from './object/invertBy.js'; +export { keys } from './object/keys.js'; +export { keysIn } from './object/keysIn.js'; +export { mapKeys } from './object/mapKeys.js'; +export { mapValues } from './object/mapValues.js'; +export { merge } from './object/merge.js'; +export { mergeWith } from './object/mergeWith.js'; +export { omit } from './object/omit.js'; +export { omitBy } from './object/omitBy.js'; +export { pick } from './object/pick.js'; +export { pickBy } from './object/pickBy.js'; +export { property } from './object/property.js'; +export { propertyOf } from './object/propertyOf.js'; +export { result } from './object/result.js'; +export { set } from './object/set.js'; +export { setWith } from './object/setWith.js'; +export { toDefaulted } from './object/toDefaulted.js'; +export { toPairs } from './object/toPairs.js'; +export { toPairsIn } from './object/toPairsIn.js'; +export { transform } from './object/transform.js'; +export { unset } from './object/unset.js'; +export { update } from './object/update.js'; +export { updateWith } from './object/updateWith.js'; +export { values } from './object/values.js'; +export { valuesIn } from './object/valuesIn.js'; +export { isFunction } from './predicate/isFunction.js'; +export { isLength } from './predicate/isLength.js'; +export { isMatchWith } from './predicate/isMatchWith.js'; +export { isNative } from './predicate/isNative.js'; +export { isNull } from './predicate/isNull.js'; +export { isUndefined } from './predicate/isUndefined.js'; +export { conforms } from './predicate/conforms.js'; +export { conformsTo } from './predicate/conformsTo.js'; +export { isArguments } from './predicate/isArguments.js'; +export { isArray } from './predicate/isArray.js'; +export { isArrayBuffer } from './predicate/isArrayBuffer.js'; +export { isArrayLike } from './predicate/isArrayLike.js'; +export { isArrayLikeObject } from './predicate/isArrayLikeObject.js'; +export { isBoolean } from './predicate/isBoolean.js'; +export { isBuffer } from './predicate/isBuffer.js'; +export { isDate } from './predicate/isDate.js'; +export { isElement } from './predicate/isElement.js'; +export { isEmpty } from './predicate/isEmpty.js'; +export { isEqualWith } from './predicate/isEqualWith.js'; +export { isError } from './predicate/isError.js'; +export { isFinite } from './predicate/isFinite.js'; +export { isInteger } from './predicate/isInteger.js'; +export { isMap } from './predicate/isMap.js'; +export { isMatch } from './predicate/isMatch.js'; +export { isNaN } from './predicate/isNaN.js'; +export { isNil } from './predicate/isNil.js'; +export { isNumber } from './predicate/isNumber.js'; +export { isObject } from './predicate/isObject.js'; +export { isObjectLike } from './predicate/isObjectLike.js'; +export { isPlainObject } from './predicate/isPlainObject.js'; +export { isRegExp } from './predicate/isRegExp.js'; +export { isSafeInteger } from './predicate/isSafeInteger.js'; +export { isSet } from './predicate/isSet.js'; +export { isString } from './predicate/isString.js'; +export { isSymbol } from './predicate/isSymbol.js'; +export { isTypedArray } from './predicate/isTypedArray.js'; +export { isWeakMap } from './predicate/isWeakMap.js'; +export { isWeakSet } from './predicate/isWeakSet.js'; +export { matches } from './predicate/matches.js'; +export { matchesProperty } from './predicate/matchesProperty.js'; +export { capitalize } from './string/capitalize.js'; +export { bindAll } from './util/bindAll.js'; +export { camelCase } from './string/camelCase.js'; +export { deburr } from './string/deburr.js'; +export { endsWith } from './string/endsWith.js'; +export { escape } from './string/escape.js'; +export { escapeRegExp } from './string/escapeRegExp.js'; +export { kebabCase } from './string/kebabCase.js'; +export { lowerCase } from './string/lowerCase.js'; +export { lowerFirst } from './string/lowerFirst.js'; +export { pad } from './string/pad.js'; +export { padEnd } from './string/padEnd.js'; +export { padStart } from './string/padStart.js'; +export { repeat } from './string/repeat.js'; +export { replace } from './string/replace.js'; +export { snakeCase } from './string/snakeCase.js'; +export { split } from './string/split.js'; +export { startCase } from './string/startCase.js'; +export { startsWith } from './string/startsWith.js'; +export { template, templateSettings } from './string/template.js'; +export { toLower } from './string/toLower.js'; +export { toUpper } from './string/toUpper.js'; +export { trim } from './string/trim.js'; +export { trimEnd } from './string/trimEnd.js'; +export { trimStart } from './string/trimStart.js'; +export { truncate } from './string/truncate.js'; +export { unescape } from './string/unescape.js'; +export { upperCase } from './string/upperCase.js'; +export { upperFirst } from './string/upperFirst.js'; +export { words } from './string/words.js'; +export { cond } from './util/cond.js'; +export { constant } from './util/constant.js'; +export { defaultTo } from './util/defaultTo.js'; +export { isEqualsSameValueZero as eq } from '../_internal/isEqualsSameValueZero.js'; +export { gt } from './util/gt.js'; +export { gte } from './util/gte.js'; +export { invoke } from './util/invoke.js'; +export { iteratee } from './util/iteratee.js'; +export { lt } from './util/lt.js'; +export { lte } from './util/lte.js'; +export { method } from './util/method.js'; +export { methodOf } from './util/methodOf.js'; +export { now } from './util/now.js'; +export { over } from './util/over.js'; +export { overEvery } from './util/overEvery.js'; +export { overSome } from './util/overSome.js'; +export { stubArray } from './util/stubArray.js'; +export { stubFalse } from './util/stubFalse.js'; +export { stubObject } from './util/stubObject.js'; +export { stubString } from './util/stubString.js'; +export { stubTrue } from './util/stubTrue.js'; +export { times } from './util/times.js'; +export { toArray } from './util/toArray.js'; +export { toFinite } from './util/toFinite.js'; +export { toInteger } from './util/toInteger.js'; +export { toLength } from './util/toLength.js'; +export { toNumber } from './util/toNumber.js'; +export { toPath } from './util/toPath.js'; +export { toPlainObject } from './util/toPlainObject.js'; +export { toSafeInteger } from './util/toSafeInteger.js'; +export { toString } from './util/toString.js'; +export { uniqueId } from './util/uniqueId.js'; diff --git a/node_modules/es-toolkit/dist/compat/compat.js b/node_modules/es-toolkit/dist/compat/compat.js new file mode 100644 index 0000000000000000000000000000000000000000..6518672aa8c8a22b07737b22642e9d81d20acefd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/compat.js @@ -0,0 +1,595 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const castArray = require('./array/castArray.js'); +const chunk = require('./array/chunk.js'); +const compact = require('./array/compact.js'); +const concat = require('./array/concat.js'); +const countBy = require('./array/countBy.js'); +const difference = require('./array/difference.js'); +const differenceBy = require('./array/differenceBy.js'); +const differenceWith = require('./array/differenceWith.js'); +const drop = require('./array/drop.js'); +const dropRight = require('./array/dropRight.js'); +const dropRightWhile = require('./array/dropRightWhile.js'); +const dropWhile = require('./array/dropWhile.js'); +const forEach = require('./array/forEach.js'); +const forEachRight = require('./array/forEachRight.js'); +const every = require('./array/every.js'); +const fill = require('./array/fill.js'); +const filter = require('./array/filter.js'); +const find = require('./array/find.js'); +const findIndex = require('./array/findIndex.js'); +const findLast = require('./array/findLast.js'); +const findLastIndex = require('./array/findLastIndex.js'); +const head = require('./array/head.js'); +const flatMap = require('./array/flatMap.js'); +const flatMapDeep = require('./array/flatMapDeep.js'); +const flatMapDepth = require('./array/flatMapDepth.js'); +const flatten = require('./array/flatten.js'); +const flattenDeep = require('./array/flattenDeep.js'); +const flattenDepth = require('./array/flattenDepth.js'); +const groupBy = require('./array/groupBy.js'); +const includes = require('./array/includes.js'); +const indexOf = require('./array/indexOf.js'); +const initial = require('./array/initial.js'); +const intersection = require('./array/intersection.js'); +const intersectionBy = require('./array/intersectionBy.js'); +const intersectionWith = require('./array/intersectionWith.js'); +const invokeMap = require('./array/invokeMap.js'); +const join = require('./array/join.js'); +const keyBy = require('./array/keyBy.js'); +const last = require('./array/last.js'); +const lastIndexOf = require('./array/lastIndexOf.js'); +const map = require('./array/map.js'); +const nth = require('./array/nth.js'); +const orderBy = require('./array/orderBy.js'); +const partition = require('./array/partition.js'); +const pull = require('./array/pull.js'); +const pullAll = require('./array/pullAll.js'); +const pullAllBy = require('./array/pullAllBy.js'); +const pullAllWith = require('./array/pullAllWith.js'); +const pullAt = require('./array/pullAt.js'); +const reduce = require('./array/reduce.js'); +const reduceRight = require('./array/reduceRight.js'); +const reject = require('./array/reject.js'); +const remove = require('./array/remove.js'); +const reverse = require('./array/reverse.js'); +const sample = require('./array/sample.js'); +const sampleSize = require('./array/sampleSize.js'); +const shuffle = require('./array/shuffle.js'); +const size = require('./array/size.js'); +const slice = require('./array/slice.js'); +const some = require('./array/some.js'); +const sortBy = require('./array/sortBy.js'); +const sortedIndex = require('./array/sortedIndex.js'); +const sortedIndexBy = require('./array/sortedIndexBy.js'); +const sortedIndexOf = require('./array/sortedIndexOf.js'); +const sortedLastIndex = require('./array/sortedLastIndex.js'); +const sortedLastIndexBy = require('./array/sortedLastIndexBy.js'); +const sortedLastIndexOf = require('./array/sortedLastIndexOf.js'); +const tail = require('./array/tail.js'); +const take = require('./array/take.js'); +const takeRight = require('./array/takeRight.js'); +const takeRightWhile = require('./array/takeRightWhile.js'); +const takeWhile = require('./array/takeWhile.js'); +const union = require('./array/union.js'); +const unionBy = require('./array/unionBy.js'); +const unionWith = require('./array/unionWith.js'); +const uniq = require('./array/uniq.js'); +const uniqBy = require('./array/uniqBy.js'); +const uniqWith = require('./array/uniqWith.js'); +const unzip = require('./array/unzip.js'); +const unzipWith = require('./array/unzipWith.js'); +const without = require('./array/without.js'); +const xor = require('./array/xor.js'); +const xorBy = require('./array/xorBy.js'); +const xorWith = require('./array/xorWith.js'); +const zip = require('./array/zip.js'); +const zipObject = require('./array/zipObject.js'); +const zipObjectDeep = require('./array/zipObjectDeep.js'); +const zipWith = require('./array/zipWith.js'); +const after = require('./function/after.js'); +const ary = require('./function/ary.js'); +const attempt = require('./function/attempt.js'); +const before = require('./function/before.js'); +const bind = require('./function/bind.js'); +const bindKey = require('./function/bindKey.js'); +const curry = require('./function/curry.js'); +const curryRight = require('./function/curryRight.js'); +const debounce = require('./function/debounce.js'); +const defer = require('./function/defer.js'); +const delay = require('./function/delay.js'); +const flip = require('./function/flip.js'); +const flow = require('./function/flow.js'); +const flowRight = require('./function/flowRight.js'); +const memoize = require('./function/memoize.js'); +const negate = require('./function/negate.js'); +const nthArg = require('./function/nthArg.js'); +const once = require('./function/once.js'); +const overArgs = require('./function/overArgs.js'); +const partial = require('./function/partial.js'); +const partialRight = require('./function/partialRight.js'); +const rearg = require('./function/rearg.js'); +const rest = require('./function/rest.js'); +const spread = require('./function/spread.js'); +const throttle = require('./function/throttle.js'); +const unary = require('./function/unary.js'); +const wrap = require('./function/wrap.js'); +const add = require('./math/add.js'); +const ceil = require('./math/ceil.js'); +const clamp = require('./math/clamp.js'); +const divide = require('./math/divide.js'); +const floor = require('./math/floor.js'); +const inRange = require('./math/inRange.js'); +const max = require('./math/max.js'); +const maxBy = require('./math/maxBy.js'); +const mean = require('./math/mean.js'); +const meanBy = require('./math/meanBy.js'); +const min = require('./math/min.js'); +const minBy = require('./math/minBy.js'); +const multiply = require('./math/multiply.js'); +const parseInt = require('./math/parseInt.js'); +const random = require('./math/random.js'); +const range = require('./math/range.js'); +const rangeRight = require('./math/rangeRight.js'); +const round = require('./math/round.js'); +const subtract = require('./math/subtract.js'); +const sum = require('./math/sum.js'); +const sumBy = require('./math/sumBy.js'); +const isEqual = require('../predicate/isEqual.js'); +const identity = require('./function/identity.js'); +const noop = require('./function/noop.js'); +const assign = require('./object/assign.js'); +const assignIn = require('./object/assignIn.js'); +const assignInWith = require('./object/assignInWith.js'); +const assignWith = require('./object/assignWith.js'); +const at = require('./object/at.js'); +const clone = require('./object/clone.js'); +const cloneDeep = require('./object/cloneDeep.js'); +const cloneDeepWith = require('./object/cloneDeepWith.js'); +const cloneWith = require('./object/cloneWith.js'); +const create = require('./object/create.js'); +const defaults = require('./object/defaults.js'); +const defaultsDeep = require('./object/defaultsDeep.js'); +const findKey = require('./object/findKey.js'); +const findLastKey = require('./object/findLastKey.js'); +const forIn = require('./object/forIn.js'); +const forInRight = require('./object/forInRight.js'); +const forOwn = require('./object/forOwn.js'); +const forOwnRight = require('./object/forOwnRight.js'); +const fromPairs = require('./object/fromPairs.js'); +const functions = require('./object/functions.js'); +const functionsIn = require('./object/functionsIn.js'); +const get = require('./object/get.js'); +const has = require('./object/has.js'); +const hasIn = require('./object/hasIn.js'); +const invert = require('./object/invert.js'); +const invertBy = require('./object/invertBy.js'); +const keys = require('./object/keys.js'); +const keysIn = require('./object/keysIn.js'); +const mapKeys = require('./object/mapKeys.js'); +const mapValues = require('./object/mapValues.js'); +const merge = require('./object/merge.js'); +const mergeWith = require('./object/mergeWith.js'); +const omit = require('./object/omit.js'); +const omitBy = require('./object/omitBy.js'); +const pick = require('./object/pick.js'); +const pickBy = require('./object/pickBy.js'); +const property = require('./object/property.js'); +const propertyOf = require('./object/propertyOf.js'); +const result = require('./object/result.js'); +const set = require('./object/set.js'); +const setWith = require('./object/setWith.js'); +const toDefaulted = require('./object/toDefaulted.js'); +const toPairs = require('./object/toPairs.js'); +const toPairsIn = require('./object/toPairsIn.js'); +const transform = require('./object/transform.js'); +const unset = require('./object/unset.js'); +const update = require('./object/update.js'); +const updateWith = require('./object/updateWith.js'); +const values = require('./object/values.js'); +const valuesIn = require('./object/valuesIn.js'); +const isFunction = require('./predicate/isFunction.js'); +const isLength = require('./predicate/isLength.js'); +const isMatchWith = require('./predicate/isMatchWith.js'); +const isNative = require('./predicate/isNative.js'); +const isNull = require('./predicate/isNull.js'); +const isUndefined = require('./predicate/isUndefined.js'); +const conforms = require('./predicate/conforms.js'); +const conformsTo = require('./predicate/conformsTo.js'); +const isArguments = require('./predicate/isArguments.js'); +const isArray = require('./predicate/isArray.js'); +const isArrayBuffer = require('./predicate/isArrayBuffer.js'); +const isArrayLike = require('./predicate/isArrayLike.js'); +const isArrayLikeObject = require('./predicate/isArrayLikeObject.js'); +const isBoolean = require('./predicate/isBoolean.js'); +const isBuffer = require('./predicate/isBuffer.js'); +const isDate = require('./predicate/isDate.js'); +const isElement = require('./predicate/isElement.js'); +const isEmpty = require('./predicate/isEmpty.js'); +const isEqualWith = require('./predicate/isEqualWith.js'); +const isError = require('./predicate/isError.js'); +const isFinite = require('./predicate/isFinite.js'); +const isInteger = require('./predicate/isInteger.js'); +const isMap = require('./predicate/isMap.js'); +const isMatch = require('./predicate/isMatch.js'); +const isNaN = require('./predicate/isNaN.js'); +const isNil = require('./predicate/isNil.js'); +const isNumber = require('./predicate/isNumber.js'); +const isObject = require('./predicate/isObject.js'); +const isObjectLike = require('./predicate/isObjectLike.js'); +const isPlainObject = require('./predicate/isPlainObject.js'); +const isRegExp = require('./predicate/isRegExp.js'); +const isSafeInteger = require('./predicate/isSafeInteger.js'); +const isSet = require('./predicate/isSet.js'); +const isString = require('./predicate/isString.js'); +const isSymbol = require('./predicate/isSymbol.js'); +const isTypedArray = require('./predicate/isTypedArray.js'); +const isWeakMap = require('./predicate/isWeakMap.js'); +const isWeakSet = require('./predicate/isWeakSet.js'); +const matches = require('./predicate/matches.js'); +const matchesProperty = require('./predicate/matchesProperty.js'); +const capitalize = require('./string/capitalize.js'); +const bindAll = require('./util/bindAll.js'); +const camelCase = require('./string/camelCase.js'); +const deburr = require('./string/deburr.js'); +const endsWith = require('./string/endsWith.js'); +const escape = require('./string/escape.js'); +const escapeRegExp = require('./string/escapeRegExp.js'); +const kebabCase = require('./string/kebabCase.js'); +const lowerCase = require('./string/lowerCase.js'); +const lowerFirst = require('./string/lowerFirst.js'); +const pad = require('./string/pad.js'); +const padEnd = require('./string/padEnd.js'); +const padStart = require('./string/padStart.js'); +const repeat = require('./string/repeat.js'); +const replace = require('./string/replace.js'); +const snakeCase = require('./string/snakeCase.js'); +const split = require('./string/split.js'); +const startCase = require('./string/startCase.js'); +const startsWith = require('./string/startsWith.js'); +const template = require('./string/template.js'); +const toLower = require('./string/toLower.js'); +const toUpper = require('./string/toUpper.js'); +const trim = require('./string/trim.js'); +const trimEnd = require('./string/trimEnd.js'); +const trimStart = require('./string/trimStart.js'); +const truncate = require('./string/truncate.js'); +const unescape = require('./string/unescape.js'); +const upperCase = require('./string/upperCase.js'); +const upperFirst = require('./string/upperFirst.js'); +const words = require('./string/words.js'); +const cond = require('./util/cond.js'); +const constant = require('./util/constant.js'); +const defaultTo = require('./util/defaultTo.js'); +const isEqualsSameValueZero = require('../_internal/isEqualsSameValueZero.js'); +const gt = require('./util/gt.js'); +const gte = require('./util/gte.js'); +const invoke = require('./util/invoke.js'); +const iteratee = require('./util/iteratee.js'); +const lt = require('./util/lt.js'); +const lte = require('./util/lte.js'); +const method = require('./util/method.js'); +const methodOf = require('./util/methodOf.js'); +const now = require('./util/now.js'); +const over = require('./util/over.js'); +const overEvery = require('./util/overEvery.js'); +const overSome = require('./util/overSome.js'); +const stubArray = require('./util/stubArray.js'); +const stubFalse = require('./util/stubFalse.js'); +const stubObject = require('./util/stubObject.js'); +const stubString = require('./util/stubString.js'); +const stubTrue = require('./util/stubTrue.js'); +const times = require('./util/times.js'); +const toArray = require('./util/toArray.js'); +const toFinite = require('./util/toFinite.js'); +const toInteger = require('./util/toInteger.js'); +const toLength = require('./util/toLength.js'); +const toNumber = require('./util/toNumber.js'); +const toPath = require('./util/toPath.js'); +const toPlainObject = require('./util/toPlainObject.js'); +const toSafeInteger = require('./util/toSafeInteger.js'); +const toString = require('./util/toString.js'); +const uniqueId = require('./util/uniqueId.js'); + + + +exports.castArray = castArray.castArray; +exports.chunk = chunk.chunk; +exports.compact = compact.compact; +exports.concat = concat.concat; +exports.countBy = countBy.countBy; +exports.difference = difference.difference; +exports.differenceBy = differenceBy.differenceBy; +exports.differenceWith = differenceWith.differenceWith; +exports.drop = drop.drop; +exports.dropRight = dropRight.dropRight; +exports.dropRightWhile = dropRightWhile.dropRightWhile; +exports.dropWhile = dropWhile.dropWhile; +exports.each = forEach.forEach; +exports.forEach = forEach.forEach; +exports.eachRight = forEachRight.forEachRight; +exports.forEachRight = forEachRight.forEachRight; +exports.every = every.every; +exports.fill = fill.fill; +exports.filter = filter.filter; +exports.find = find.find; +exports.findIndex = findIndex.findIndex; +exports.findLast = findLast.findLast; +exports.findLastIndex = findLastIndex.findLastIndex; +exports.first = head.head; +exports.head = head.head; +exports.flatMap = flatMap.flatMap; +exports.flatMapDeep = flatMapDeep.flatMapDeep; +exports.flatMapDepth = flatMapDepth.flatMapDepth; +exports.flatten = flatten.flatten; +exports.flattenDeep = flattenDeep.flattenDeep; +exports.flattenDepth = flattenDepth.flattenDepth; +exports.groupBy = groupBy.groupBy; +exports.includes = includes.includes; +exports.indexOf = indexOf.indexOf; +exports.initial = initial.initial; +exports.intersection = intersection.intersection; +exports.intersectionBy = intersectionBy.intersectionBy; +exports.intersectionWith = intersectionWith.intersectionWith; +exports.invokeMap = invokeMap.invokeMap; +exports.join = join.join; +exports.keyBy = keyBy.keyBy; +exports.last = last.last; +exports.lastIndexOf = lastIndexOf.lastIndexOf; +exports.map = map.map; +exports.nth = nth.nth; +exports.orderBy = orderBy.orderBy; +exports.partition = partition.partition; +exports.pull = pull.pull; +exports.pullAll = pullAll.pullAll; +exports.pullAllBy = pullAllBy.pullAllBy; +exports.pullAllWith = pullAllWith.pullAllWith; +exports.pullAt = pullAt.pullAt; +exports.reduce = reduce.reduce; +exports.reduceRight = reduceRight.reduceRight; +exports.reject = reject.reject; +exports.remove = remove.remove; +exports.reverse = reverse.reverse; +exports.sample = sample.sample; +exports.sampleSize = sampleSize.sampleSize; +exports.shuffle = shuffle.shuffle; +exports.size = size.size; +exports.slice = slice.slice; +exports.some = some.some; +exports.sortBy = sortBy.sortBy; +exports.sortedIndex = sortedIndex.sortedIndex; +exports.sortedIndexBy = sortedIndexBy.sortedIndexBy; +exports.sortedIndexOf = sortedIndexOf.sortedIndexOf; +exports.sortedLastIndex = sortedLastIndex.sortedLastIndex; +exports.sortedLastIndexBy = sortedLastIndexBy.sortedLastIndexBy; +exports.sortedLastIndexOf = sortedLastIndexOf.sortedLastIndexOf; +exports.tail = tail.tail; +exports.take = take.take; +exports.takeRight = takeRight.takeRight; +exports.takeRightWhile = takeRightWhile.takeRightWhile; +exports.takeWhile = takeWhile.takeWhile; +exports.union = union.union; +exports.unionBy = unionBy.unionBy; +exports.unionWith = unionWith.unionWith; +exports.uniq = uniq.uniq; +exports.uniqBy = uniqBy.uniqBy; +exports.uniqWith = uniqWith.uniqWith; +exports.unzip = unzip.unzip; +exports.unzipWith = unzipWith.unzipWith; +exports.without = without.without; +exports.xor = xor.xor; +exports.xorBy = xorBy.xorBy; +exports.xorWith = xorWith.xorWith; +exports.zip = zip.zip; +exports.zipObject = zipObject.zipObject; +exports.zipObjectDeep = zipObjectDeep.zipObjectDeep; +exports.zipWith = zipWith.zipWith; +exports.after = after.after; +exports.ary = ary.ary; +exports.attempt = attempt.attempt; +exports.before = before.before; +exports.bind = bind.bind; +exports.bindKey = bindKey.bindKey; +exports.curry = curry.curry; +exports.curryRight = curryRight.curryRight; +exports.debounce = debounce.debounce; +exports.defer = defer.defer; +exports.delay = delay.delay; +exports.flip = flip.flip; +exports.flow = flow.flow; +exports.flowRight = flowRight.flowRight; +exports.memoize = memoize.memoize; +exports.negate = negate.negate; +exports.nthArg = nthArg.nthArg; +exports.once = once.once; +exports.overArgs = overArgs.overArgs; +exports.partial = partial.partial; +exports.partialRight = partialRight.partialRight; +exports.rearg = rearg.rearg; +exports.rest = rest.rest; +exports.spread = spread.spread; +exports.throttle = throttle.throttle; +exports.unary = unary.unary; +exports.wrap = wrap.wrap; +exports.add = add.add; +exports.ceil = ceil.ceil; +exports.clamp = clamp.clamp; +exports.divide = divide.divide; +exports.floor = floor.floor; +exports.inRange = inRange.inRange; +exports.max = max.max; +exports.maxBy = maxBy.maxBy; +exports.mean = mean.mean; +exports.meanBy = meanBy.meanBy; +exports.min = min.min; +exports.minBy = minBy.minBy; +exports.multiply = multiply.multiply; +exports.parseInt = parseInt.parseInt; +exports.random = random.random; +exports.range = range.range; +exports.rangeRight = rangeRight.rangeRight; +exports.round = round.round; +exports.subtract = subtract.subtract; +exports.sum = sum.sum; +exports.sumBy = sumBy.sumBy; +exports.isEqual = isEqual.isEqual; +exports.identity = identity.identity; +exports.noop = noop.noop; +exports.assign = assign.assign; +exports.assignIn = assignIn.assignIn; +exports.extend = assignIn.assignIn; +exports.assignInWith = assignInWith.assignInWith; +exports.extendWith = assignInWith.assignInWith; +exports.assignWith = assignWith.assignWith; +exports.at = at.at; +exports.clone = clone.clone; +exports.cloneDeep = cloneDeep.cloneDeep; +exports.cloneDeepWith = cloneDeepWith.cloneDeepWith; +exports.cloneWith = cloneWith.cloneWith; +exports.create = create.create; +exports.defaults = defaults.defaults; +exports.defaultsDeep = defaultsDeep.defaultsDeep; +exports.findKey = findKey.findKey; +exports.findLastKey = findLastKey.findLastKey; +exports.forIn = forIn.forIn; +exports.forInRight = forInRight.forInRight; +exports.forOwn = forOwn.forOwn; +exports.forOwnRight = forOwnRight.forOwnRight; +exports.fromPairs = fromPairs.fromPairs; +exports.functions = functions.functions; +exports.functionsIn = functionsIn.functionsIn; +exports.get = get.get; +exports.has = has.has; +exports.hasIn = hasIn.hasIn; +exports.invert = invert.invert; +exports.invertBy = invertBy.invertBy; +exports.keys = keys.keys; +exports.keysIn = keysIn.keysIn; +exports.mapKeys = mapKeys.mapKeys; +exports.mapValues = mapValues.mapValues; +exports.merge = merge.merge; +exports.mergeWith = mergeWith.mergeWith; +exports.omit = omit.omit; +exports.omitBy = omitBy.omitBy; +exports.pick = pick.pick; +exports.pickBy = pickBy.pickBy; +exports.property = property.property; +exports.propertyOf = propertyOf.propertyOf; +exports.result = result.result; +exports.set = set.set; +exports.setWith = setWith.setWith; +exports.toDefaulted = toDefaulted.toDefaulted; +exports.toPairs = toPairs.toPairs; +exports.toPairsIn = toPairsIn.toPairsIn; +exports.transform = transform.transform; +exports.unset = unset.unset; +exports.update = update.update; +exports.updateWith = updateWith.updateWith; +exports.values = values.values; +exports.valuesIn = valuesIn.valuesIn; +exports.isFunction = isFunction.isFunction; +exports.isLength = isLength.isLength; +exports.isMatchWith = isMatchWith.isMatchWith; +exports.isNative = isNative.isNative; +exports.isNull = isNull.isNull; +exports.isUndefined = isUndefined.isUndefined; +exports.conforms = conforms.conforms; +exports.conformsTo = conformsTo.conformsTo; +exports.isArguments = isArguments.isArguments; +exports.isArray = isArray.isArray; +exports.isArrayBuffer = isArrayBuffer.isArrayBuffer; +exports.isArrayLike = isArrayLike.isArrayLike; +exports.isArrayLikeObject = isArrayLikeObject.isArrayLikeObject; +exports.isBoolean = isBoolean.isBoolean; +exports.isBuffer = isBuffer.isBuffer; +exports.isDate = isDate.isDate; +exports.isElement = isElement.isElement; +exports.isEmpty = isEmpty.isEmpty; +exports.isEqualWith = isEqualWith.isEqualWith; +exports.isError = isError.isError; +exports.isFinite = isFinite.isFinite; +exports.isInteger = isInteger.isInteger; +exports.isMap = isMap.isMap; +exports.isMatch = isMatch.isMatch; +exports.isNaN = isNaN.isNaN; +exports.isNil = isNil.isNil; +exports.isNumber = isNumber.isNumber; +exports.isObject = isObject.isObject; +exports.isObjectLike = isObjectLike.isObjectLike; +exports.isPlainObject = isPlainObject.isPlainObject; +exports.isRegExp = isRegExp.isRegExp; +exports.isSafeInteger = isSafeInteger.isSafeInteger; +exports.isSet = isSet.isSet; +exports.isString = isString.isString; +exports.isSymbol = isSymbol.isSymbol; +exports.isTypedArray = isTypedArray.isTypedArray; +exports.isWeakMap = isWeakMap.isWeakMap; +exports.isWeakSet = isWeakSet.isWeakSet; +exports.matches = matches.matches; +exports.matchesProperty = matchesProperty.matchesProperty; +exports.capitalize = capitalize.capitalize; +exports.bindAll = bindAll.bindAll; +exports.camelCase = camelCase.camelCase; +exports.deburr = deburr.deburr; +exports.endsWith = endsWith.endsWith; +exports.escape = escape.escape; +exports.escapeRegExp = escapeRegExp.escapeRegExp; +exports.kebabCase = kebabCase.kebabCase; +exports.lowerCase = lowerCase.lowerCase; +exports.lowerFirst = lowerFirst.lowerFirst; +exports.pad = pad.pad; +exports.padEnd = padEnd.padEnd; +exports.padStart = padStart.padStart; +exports.repeat = repeat.repeat; +exports.replace = replace.replace; +exports.snakeCase = snakeCase.snakeCase; +exports.split = split.split; +exports.startCase = startCase.startCase; +exports.startsWith = startsWith.startsWith; +exports.template = template.template; +exports.templateSettings = template.templateSettings; +exports.toLower = toLower.toLower; +exports.toUpper = toUpper.toUpper; +exports.trim = trim.trim; +exports.trimEnd = trimEnd.trimEnd; +exports.trimStart = trimStart.trimStart; +exports.truncate = truncate.truncate; +exports.unescape = unescape.unescape; +exports.upperCase = upperCase.upperCase; +exports.upperFirst = upperFirst.upperFirst; +exports.words = words.words; +exports.cond = cond.cond; +exports.constant = constant.constant; +exports.defaultTo = defaultTo.defaultTo; +exports.eq = isEqualsSameValueZero.isEqualsSameValueZero; +exports.gt = gt.gt; +exports.gte = gte.gte; +exports.invoke = invoke.invoke; +exports.iteratee = iteratee.iteratee; +exports.lt = lt.lt; +exports.lte = lte.lte; +exports.method = method.method; +exports.methodOf = methodOf.methodOf; +exports.now = now.now; +exports.over = over.over; +exports.overEvery = overEvery.overEvery; +exports.overSome = overSome.overSome; +exports.stubArray = stubArray.stubArray; +exports.stubFalse = stubFalse.stubFalse; +exports.stubObject = stubObject.stubObject; +exports.stubString = stubString.stubString; +exports.stubTrue = stubTrue.stubTrue; +exports.times = times.times; +exports.toArray = toArray.toArray; +exports.toFinite = toFinite.toFinite; +exports.toInteger = toInteger.toInteger; +exports.toLength = toLength.toLength; +exports.toNumber = toNumber.toNumber; +exports.toPath = toPath.toPath; +exports.toPlainObject = toPlainObject.toPlainObject; +exports.toSafeInteger = toSafeInteger.toSafeInteger; +exports.toString = toString.toString; +exports.uniqueId = uniqueId.uniqueId; diff --git a/node_modules/es-toolkit/dist/compat/compat.mjs b/node_modules/es-toolkit/dist/compat/compat.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3c85efe30111c1ebf0ea162dfb9ab02a6f9833ef --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/compat.mjs @@ -0,0 +1,291 @@ +export { castArray } from './array/castArray.mjs'; +export { chunk } from './array/chunk.mjs'; +export { compact } from './array/compact.mjs'; +export { concat } from './array/concat.mjs'; +export { countBy } from './array/countBy.mjs'; +export { difference } from './array/difference.mjs'; +export { differenceBy } from './array/differenceBy.mjs'; +export { differenceWith } from './array/differenceWith.mjs'; +export { drop } from './array/drop.mjs'; +export { dropRight } from './array/dropRight.mjs'; +export { dropRightWhile } from './array/dropRightWhile.mjs'; +export { dropWhile } from './array/dropWhile.mjs'; +export { forEach as each, forEach } from './array/forEach.mjs'; +export { forEachRight as eachRight, forEachRight } from './array/forEachRight.mjs'; +export { every } from './array/every.mjs'; +export { fill } from './array/fill.mjs'; +export { filter } from './array/filter.mjs'; +export { find } from './array/find.mjs'; +export { findIndex } from './array/findIndex.mjs'; +export { findLast } from './array/findLast.mjs'; +export { findLastIndex } from './array/findLastIndex.mjs'; +export { head as first, head } from './array/head.mjs'; +export { flatMap } from './array/flatMap.mjs'; +export { flatMapDeep } from './array/flatMapDeep.mjs'; +export { flatMapDepth } from './array/flatMapDepth.mjs'; +export { flatten } from './array/flatten.mjs'; +export { flattenDeep } from './array/flattenDeep.mjs'; +export { flattenDepth } from './array/flattenDepth.mjs'; +export { groupBy } from './array/groupBy.mjs'; +export { includes } from './array/includes.mjs'; +export { indexOf } from './array/indexOf.mjs'; +export { initial } from './array/initial.mjs'; +export { intersection } from './array/intersection.mjs'; +export { intersectionBy } from './array/intersectionBy.mjs'; +export { intersectionWith } from './array/intersectionWith.mjs'; +export { invokeMap } from './array/invokeMap.mjs'; +export { join } from './array/join.mjs'; +export { keyBy } from './array/keyBy.mjs'; +export { last } from './array/last.mjs'; +export { lastIndexOf } from './array/lastIndexOf.mjs'; +export { map } from './array/map.mjs'; +export { nth } from './array/nth.mjs'; +export { orderBy } from './array/orderBy.mjs'; +export { partition } from './array/partition.mjs'; +export { pull } from './array/pull.mjs'; +export { pullAll } from './array/pullAll.mjs'; +export { pullAllBy } from './array/pullAllBy.mjs'; +export { pullAllWith } from './array/pullAllWith.mjs'; +export { pullAt } from './array/pullAt.mjs'; +export { reduce } from './array/reduce.mjs'; +export { reduceRight } from './array/reduceRight.mjs'; +export { reject } from './array/reject.mjs'; +export { remove } from './array/remove.mjs'; +export { reverse } from './array/reverse.mjs'; +export { sample } from './array/sample.mjs'; +export { sampleSize } from './array/sampleSize.mjs'; +export { shuffle } from './array/shuffle.mjs'; +export { size } from './array/size.mjs'; +export { slice } from './array/slice.mjs'; +export { some } from './array/some.mjs'; +export { sortBy } from './array/sortBy.mjs'; +export { sortedIndex } from './array/sortedIndex.mjs'; +export { sortedIndexBy } from './array/sortedIndexBy.mjs'; +export { sortedIndexOf } from './array/sortedIndexOf.mjs'; +export { sortedLastIndex } from './array/sortedLastIndex.mjs'; +export { sortedLastIndexBy } from './array/sortedLastIndexBy.mjs'; +export { sortedLastIndexOf } from './array/sortedLastIndexOf.mjs'; +export { tail } from './array/tail.mjs'; +export { take } from './array/take.mjs'; +export { takeRight } from './array/takeRight.mjs'; +export { takeRightWhile } from './array/takeRightWhile.mjs'; +export { takeWhile } from './array/takeWhile.mjs'; +export { union } from './array/union.mjs'; +export { unionBy } from './array/unionBy.mjs'; +export { unionWith } from './array/unionWith.mjs'; +export { uniq } from './array/uniq.mjs'; +export { uniqBy } from './array/uniqBy.mjs'; +export { uniqWith } from './array/uniqWith.mjs'; +export { unzip } from './array/unzip.mjs'; +export { unzipWith } from './array/unzipWith.mjs'; +export { without } from './array/without.mjs'; +export { xor } from './array/xor.mjs'; +export { xorBy } from './array/xorBy.mjs'; +export { xorWith } from './array/xorWith.mjs'; +export { zip } from './array/zip.mjs'; +export { zipObject } from './array/zipObject.mjs'; +export { zipObjectDeep } from './array/zipObjectDeep.mjs'; +export { zipWith } from './array/zipWith.mjs'; +export { after } from './function/after.mjs'; +export { ary } from './function/ary.mjs'; +export { attempt } from './function/attempt.mjs'; +export { before } from './function/before.mjs'; +export { bind } from './function/bind.mjs'; +export { bindKey } from './function/bindKey.mjs'; +export { curry } from './function/curry.mjs'; +export { curryRight } from './function/curryRight.mjs'; +export { debounce } from './function/debounce.mjs'; +export { defer } from './function/defer.mjs'; +export { delay } from './function/delay.mjs'; +export { flip } from './function/flip.mjs'; +export { flow } from './function/flow.mjs'; +export { flowRight } from './function/flowRight.mjs'; +export { memoize } from './function/memoize.mjs'; +export { negate } from './function/negate.mjs'; +export { nthArg } from './function/nthArg.mjs'; +export { once } from './function/once.mjs'; +export { overArgs } from './function/overArgs.mjs'; +export { partial } from './function/partial.mjs'; +export { partialRight } from './function/partialRight.mjs'; +export { rearg } from './function/rearg.mjs'; +export { rest } from './function/rest.mjs'; +export { spread } from './function/spread.mjs'; +export { throttle } from './function/throttle.mjs'; +export { unary } from './function/unary.mjs'; +export { wrap } from './function/wrap.mjs'; +export { add } from './math/add.mjs'; +export { ceil } from './math/ceil.mjs'; +export { clamp } from './math/clamp.mjs'; +export { divide } from './math/divide.mjs'; +export { floor } from './math/floor.mjs'; +export { inRange } from './math/inRange.mjs'; +export { max } from './math/max.mjs'; +export { maxBy } from './math/maxBy.mjs'; +export { mean } from './math/mean.mjs'; +export { meanBy } from './math/meanBy.mjs'; +export { min } from './math/min.mjs'; +export { minBy } from './math/minBy.mjs'; +export { multiply } from './math/multiply.mjs'; +export { parseInt } from './math/parseInt.mjs'; +export { random } from './math/random.mjs'; +export { range } from './math/range.mjs'; +export { rangeRight } from './math/rangeRight.mjs'; +export { round } from './math/round.mjs'; +export { subtract } from './math/subtract.mjs'; +export { sum } from './math/sum.mjs'; +export { sumBy } from './math/sumBy.mjs'; +export { isEqual } from '../predicate/isEqual.mjs'; +export { identity } from './function/identity.mjs'; +export { noop } from './function/noop.mjs'; +export { assign } from './object/assign.mjs'; +export { assignIn, assignIn as extend } from './object/assignIn.mjs'; +export { assignInWith, assignInWith as extendWith } from './object/assignInWith.mjs'; +export { assignWith } from './object/assignWith.mjs'; +export { at } from './object/at.mjs'; +export { clone } from './object/clone.mjs'; +export { cloneDeep } from './object/cloneDeep.mjs'; +export { cloneDeepWith } from './object/cloneDeepWith.mjs'; +export { cloneWith } from './object/cloneWith.mjs'; +export { create } from './object/create.mjs'; +export { defaults } from './object/defaults.mjs'; +export { defaultsDeep } from './object/defaultsDeep.mjs'; +export { findKey } from './object/findKey.mjs'; +export { findLastKey } from './object/findLastKey.mjs'; +export { forIn } from './object/forIn.mjs'; +export { forInRight } from './object/forInRight.mjs'; +export { forOwn } from './object/forOwn.mjs'; +export { forOwnRight } from './object/forOwnRight.mjs'; +export { fromPairs } from './object/fromPairs.mjs'; +export { functions } from './object/functions.mjs'; +export { functionsIn } from './object/functionsIn.mjs'; +export { get } from './object/get.mjs'; +export { has } from './object/has.mjs'; +export { hasIn } from './object/hasIn.mjs'; +export { invert } from './object/invert.mjs'; +export { invertBy } from './object/invertBy.mjs'; +export { keys } from './object/keys.mjs'; +export { keysIn } from './object/keysIn.mjs'; +export { mapKeys } from './object/mapKeys.mjs'; +export { mapValues } from './object/mapValues.mjs'; +export { merge } from './object/merge.mjs'; +export { mergeWith } from './object/mergeWith.mjs'; +export { omit } from './object/omit.mjs'; +export { omitBy } from './object/omitBy.mjs'; +export { pick } from './object/pick.mjs'; +export { pickBy } from './object/pickBy.mjs'; +export { property } from './object/property.mjs'; +export { propertyOf } from './object/propertyOf.mjs'; +export { result } from './object/result.mjs'; +export { set } from './object/set.mjs'; +export { setWith } from './object/setWith.mjs'; +export { toDefaulted } from './object/toDefaulted.mjs'; +export { toPairs } from './object/toPairs.mjs'; +export { toPairsIn } from './object/toPairsIn.mjs'; +export { transform } from './object/transform.mjs'; +export { unset } from './object/unset.mjs'; +export { update } from './object/update.mjs'; +export { updateWith } from './object/updateWith.mjs'; +export { values } from './object/values.mjs'; +export { valuesIn } from './object/valuesIn.mjs'; +export { isFunction } from './predicate/isFunction.mjs'; +export { isLength } from './predicate/isLength.mjs'; +export { isMatchWith } from './predicate/isMatchWith.mjs'; +export { isNative } from './predicate/isNative.mjs'; +export { isNull } from './predicate/isNull.mjs'; +export { isUndefined } from './predicate/isUndefined.mjs'; +export { conforms } from './predicate/conforms.mjs'; +export { conformsTo } from './predicate/conformsTo.mjs'; +export { isArguments } from './predicate/isArguments.mjs'; +export { isArray } from './predicate/isArray.mjs'; +export { isArrayBuffer } from './predicate/isArrayBuffer.mjs'; +export { isArrayLike } from './predicate/isArrayLike.mjs'; +export { isArrayLikeObject } from './predicate/isArrayLikeObject.mjs'; +export { isBoolean } from './predicate/isBoolean.mjs'; +export { isBuffer } from './predicate/isBuffer.mjs'; +export { isDate } from './predicate/isDate.mjs'; +export { isElement } from './predicate/isElement.mjs'; +export { isEmpty } from './predicate/isEmpty.mjs'; +export { isEqualWith } from './predicate/isEqualWith.mjs'; +export { isError } from './predicate/isError.mjs'; +export { isFinite } from './predicate/isFinite.mjs'; +export { isInteger } from './predicate/isInteger.mjs'; +export { isMap } from './predicate/isMap.mjs'; +export { isMatch } from './predicate/isMatch.mjs'; +export { isNaN } from './predicate/isNaN.mjs'; +export { isNil } from './predicate/isNil.mjs'; +export { isNumber } from './predicate/isNumber.mjs'; +export { isObject } from './predicate/isObject.mjs'; +export { isObjectLike } from './predicate/isObjectLike.mjs'; +export { isPlainObject } from './predicate/isPlainObject.mjs'; +export { isRegExp } from './predicate/isRegExp.mjs'; +export { isSafeInteger } from './predicate/isSafeInteger.mjs'; +export { isSet } from './predicate/isSet.mjs'; +export { isString } from './predicate/isString.mjs'; +export { isSymbol } from './predicate/isSymbol.mjs'; +export { isTypedArray } from './predicate/isTypedArray.mjs'; +export { isWeakMap } from './predicate/isWeakMap.mjs'; +export { isWeakSet } from './predicate/isWeakSet.mjs'; +export { matches } from './predicate/matches.mjs'; +export { matchesProperty } from './predicate/matchesProperty.mjs'; +export { capitalize } from './string/capitalize.mjs'; +export { bindAll } from './util/bindAll.mjs'; +export { camelCase } from './string/camelCase.mjs'; +export { deburr } from './string/deburr.mjs'; +export { endsWith } from './string/endsWith.mjs'; +export { escape } from './string/escape.mjs'; +export { escapeRegExp } from './string/escapeRegExp.mjs'; +export { kebabCase } from './string/kebabCase.mjs'; +export { lowerCase } from './string/lowerCase.mjs'; +export { lowerFirst } from './string/lowerFirst.mjs'; +export { pad } from './string/pad.mjs'; +export { padEnd } from './string/padEnd.mjs'; +export { padStart } from './string/padStart.mjs'; +export { repeat } from './string/repeat.mjs'; +export { replace } from './string/replace.mjs'; +export { snakeCase } from './string/snakeCase.mjs'; +export { split } from './string/split.mjs'; +export { startCase } from './string/startCase.mjs'; +export { startsWith } from './string/startsWith.mjs'; +export { template, templateSettings } from './string/template.mjs'; +export { toLower } from './string/toLower.mjs'; +export { toUpper } from './string/toUpper.mjs'; +export { trim } from './string/trim.mjs'; +export { trimEnd } from './string/trimEnd.mjs'; +export { trimStart } from './string/trimStart.mjs'; +export { truncate } from './string/truncate.mjs'; +export { unescape } from './string/unescape.mjs'; +export { upperCase } from './string/upperCase.mjs'; +export { upperFirst } from './string/upperFirst.mjs'; +export { words } from './string/words.mjs'; +export { cond } from './util/cond.mjs'; +export { constant } from './util/constant.mjs'; +export { defaultTo } from './util/defaultTo.mjs'; +export { isEqualsSameValueZero as eq } from '../_internal/isEqualsSameValueZero.mjs'; +export { gt } from './util/gt.mjs'; +export { gte } from './util/gte.mjs'; +export { invoke } from './util/invoke.mjs'; +export { iteratee } from './util/iteratee.mjs'; +export { lt } from './util/lt.mjs'; +export { lte } from './util/lte.mjs'; +export { method } from './util/method.mjs'; +export { methodOf } from './util/methodOf.mjs'; +export { now } from './util/now.mjs'; +export { over } from './util/over.mjs'; +export { overEvery } from './util/overEvery.mjs'; +export { overSome } from './util/overSome.mjs'; +export { stubArray } from './util/stubArray.mjs'; +export { stubFalse } from './util/stubFalse.mjs'; +export { stubObject } from './util/stubObject.mjs'; +export { stubString } from './util/stubString.mjs'; +export { stubTrue } from './util/stubTrue.mjs'; +export { times } from './util/times.mjs'; +export { toArray } from './util/toArray.mjs'; +export { toFinite } from './util/toFinite.mjs'; +export { toInteger } from './util/toInteger.mjs'; +export { toLength } from './util/toLength.mjs'; +export { toNumber } from './util/toNumber.mjs'; +export { toPath } from './util/toPath.mjs'; +export { toPlainObject } from './util/toPlainObject.mjs'; +export { toSafeInteger } from './util/toSafeInteger.mjs'; +export { toString } from './util/toString.mjs'; +export { uniqueId } from './util/uniqueId.mjs'; diff --git a/node_modules/es-toolkit/dist/compat/function/after.d.mts b/node_modules/es-toolkit/dist/compat/function/after.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..97ff596052c9541c20905f09a593bde93cde8a2e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/after.d.mts @@ -0,0 +1,24 @@ +/** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @template TFunc - The type of the function to be invoked. + * @param {number} n - The number of calls before `func` is invoked. + * @param {TFunc} func - The function to restrict. + * @returns {TFunc} Returns the new restricted function. + * @throws {TypeError} - If `func` is not a function. + * + * @example + * const saves = ['profile', 'settings']; + * const done = after(saves.length, () => { + * console.log('done saving!'); + * }); + * + * saves.forEach(type => { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ +declare function after any>(n: number, func: TFunc): TFunc; + +export { after }; diff --git a/node_modules/es-toolkit/dist/compat/function/after.d.ts b/node_modules/es-toolkit/dist/compat/function/after.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..97ff596052c9541c20905f09a593bde93cde8a2e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/after.d.ts @@ -0,0 +1,24 @@ +/** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @template TFunc - The type of the function to be invoked. + * @param {number} n - The number of calls before `func` is invoked. + * @param {TFunc} func - The function to restrict. + * @returns {TFunc} Returns the new restricted function. + * @throws {TypeError} - If `func` is not a function. + * + * @example + * const saves = ['profile', 'settings']; + * const done = after(saves.length, () => { + * console.log('done saving!'); + * }); + * + * saves.forEach(type => { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ +declare function after any>(n: number, func: TFunc): TFunc; + +export { after }; diff --git a/node_modules/es-toolkit/dist/compat/function/after.js b/node_modules/es-toolkit/dist/compat/function/after.js new file mode 100644 index 0000000000000000000000000000000000000000..3e22b85926aff466876d2a41e18d81305e03ce57 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/after.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const toInteger = require('../util/toInteger.js'); + +function after(n, func) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + n = toInteger.toInteger(n); + return function (...args) { + if (--n < 1) { + return func.apply(this, args); + } + }; +} + +exports.after = after; diff --git a/node_modules/es-toolkit/dist/compat/function/after.mjs b/node_modules/es-toolkit/dist/compat/function/after.mjs new file mode 100644 index 0000000000000000000000000000000000000000..99c727b5f283a5ead2d3a8496e25699526c12085 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/after.mjs @@ -0,0 +1,15 @@ +import { toInteger } from '../util/toInteger.mjs'; + +function after(n, func) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + n = toInteger(n); + return function (...args) { + if (--n < 1) { + return func.apply(this, args); + } + }; +} + +export { after }; diff --git a/node_modules/es-toolkit/dist/compat/function/ary.d.mts b/node_modules/es-toolkit/dist/compat/function/ary.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f2b0e0952f2a801c3309b5728ab61d12077f108e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/ary.d.mts @@ -0,0 +1,24 @@ +/** + * Creates a function that invokes func, with up to `n` arguments, ignoring any additional arguments. + * If `n` is not provided, it defaults to the function's length. + * + * @param {Function} func - The function to cap arguments for. + * @param {number} [n] - The arity cap. Defaults to func.length. + * @returns {Function} Returns the new capped function. + * + * @example + * function fn(a: number, b: number, c: number) { + * return Array.from(arguments); + * } + * + * // Cap at 2 arguments + * const capped = ary(fn, 2); + * capped(1, 2, 3); // [1, 2] + * + * // Default to function length + * const defaultCap = ary(fn); + * defaultCap(1, 2, 3); // [1, 2, 3] + */ +declare function ary(func: (...args: any[]) => any, n?: number): (...args: any[]) => any; + +export { ary }; diff --git a/node_modules/es-toolkit/dist/compat/function/ary.d.ts b/node_modules/es-toolkit/dist/compat/function/ary.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f2b0e0952f2a801c3309b5728ab61d12077f108e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/ary.d.ts @@ -0,0 +1,24 @@ +/** + * Creates a function that invokes func, with up to `n` arguments, ignoring any additional arguments. + * If `n` is not provided, it defaults to the function's length. + * + * @param {Function} func - The function to cap arguments for. + * @param {number} [n] - The arity cap. Defaults to func.length. + * @returns {Function} Returns the new capped function. + * + * @example + * function fn(a: number, b: number, c: number) { + * return Array.from(arguments); + * } + * + * // Cap at 2 arguments + * const capped = ary(fn, 2); + * capped(1, 2, 3); // [1, 2] + * + * // Default to function length + * const defaultCap = ary(fn); + * defaultCap(1, 2, 3); // [1, 2, 3] + */ +declare function ary(func: (...args: any[]) => any, n?: number): (...args: any[]) => any; + +export { ary }; diff --git a/node_modules/es-toolkit/dist/compat/function/ary.js b/node_modules/es-toolkit/dist/compat/function/ary.js new file mode 100644 index 0000000000000000000000000000000000000000..872a929bd2d329502fd01d9b30c88777e770b7f1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/ary.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const ary$1 = require('../../function/ary.js'); + +function ary(func, n = func.length, guard) { + if (guard) { + n = func.length; + } + if (Number.isNaN(n) || n < 0) { + n = 0; + } + return ary$1.ary(func, n); +} + +exports.ary = ary; diff --git a/node_modules/es-toolkit/dist/compat/function/ary.mjs b/node_modules/es-toolkit/dist/compat/function/ary.mjs new file mode 100644 index 0000000000000000000000000000000000000000..063dd15991eb29bb186278a02de0a30bdf916204 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/ary.mjs @@ -0,0 +1,13 @@ +import { ary as ary$1 } from '../../function/ary.mjs'; + +function ary(func, n = func.length, guard) { + if (guard) { + n = func.length; + } + if (Number.isNaN(n) || n < 0) { + n = 0; + } + return ary$1(func, n); +} + +export { ary }; diff --git a/node_modules/es-toolkit/dist/compat/function/attempt.d.mts b/node_modules/es-toolkit/dist/compat/function/attempt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a9241763a8c77e1411563ba78748e66ff719e3bc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/attempt.d.mts @@ -0,0 +1,33 @@ +/** + * Attempts to execute a function with the provided arguments. + * If the function throws an error, it catches the error and returns it. + * If the caught error is not an instance of Error, it wraps it in a new Error. + * + * @param {(...args: any[]) => R} func - The function to be executed. + * @param {...any[]} args - The arguments to pass to the function. + * @returns {R | Error} The return value of the function if successful, or an Error if an exception is thrown. + * + * @template R - The type of the function return value. + * + * @example + * // Example 1: Successful execution + * const result = attempt((x, y) => x + y, 2, 3); + * console.log(result); // Output: 5 + * + * @example + * // Example 2: Function throws an error + * const errorResult = attempt(() => { + * throw new Error("Something went wrong"); + * }); + * console.log(errorResult); // Output: Error: Something went wrong + * + * @example + * // Example 3: Non-Error thrown + * const nonErrorResult = attempt(() => { + * throw "This is a string error"; + * }); + * console.log(nonErrorResult); // Output: Error: This is a string error + */ +declare function attempt(func: (...args: any[]) => R, ...args: any[]): R | Error; + +export { attempt }; diff --git a/node_modules/es-toolkit/dist/compat/function/attempt.d.ts b/node_modules/es-toolkit/dist/compat/function/attempt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9241763a8c77e1411563ba78748e66ff719e3bc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/attempt.d.ts @@ -0,0 +1,33 @@ +/** + * Attempts to execute a function with the provided arguments. + * If the function throws an error, it catches the error and returns it. + * If the caught error is not an instance of Error, it wraps it in a new Error. + * + * @param {(...args: any[]) => R} func - The function to be executed. + * @param {...any[]} args - The arguments to pass to the function. + * @returns {R | Error} The return value of the function if successful, or an Error if an exception is thrown. + * + * @template R - The type of the function return value. + * + * @example + * // Example 1: Successful execution + * const result = attempt((x, y) => x + y, 2, 3); + * console.log(result); // Output: 5 + * + * @example + * // Example 2: Function throws an error + * const errorResult = attempt(() => { + * throw new Error("Something went wrong"); + * }); + * console.log(errorResult); // Output: Error: Something went wrong + * + * @example + * // Example 3: Non-Error thrown + * const nonErrorResult = attempt(() => { + * throw "This is a string error"; + * }); + * console.log(nonErrorResult); // Output: Error: This is a string error + */ +declare function attempt(func: (...args: any[]) => R, ...args: any[]): R | Error; + +export { attempt }; diff --git a/node_modules/es-toolkit/dist/compat/function/attempt.js b/node_modules/es-toolkit/dist/compat/function/attempt.js new file mode 100644 index 0000000000000000000000000000000000000000..2305479781156a93296d57cc15b92cdf708aaed1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/attempt.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function attempt(func, ...args) { + try { + return func(...args); + } + catch (e) { + return e instanceof Error ? e : new Error(e); + } +} + +exports.attempt = attempt; diff --git a/node_modules/es-toolkit/dist/compat/function/attempt.mjs b/node_modules/es-toolkit/dist/compat/function/attempt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..20d1a1d179c951aeae084652b9d23897caa9ae5a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/attempt.mjs @@ -0,0 +1,10 @@ +function attempt(func, ...args) { + try { + return func(...args); + } + catch (e) { + return e instanceof Error ? e : new Error(e); + } +} + +export { attempt }; diff --git a/node_modules/es-toolkit/dist/compat/function/before.d.mts b/node_modules/es-toolkit/dist/compat/function/before.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..144569f89673067025f7ef24d533a7cab2929545 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/before.d.mts @@ -0,0 +1,26 @@ +/** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @template F - The type of the function to be invoked. + * @param {number} n - The number of times the returned function is allowed to call `func` before stopping. + * - If `n` is 0, `func` will never be called. + * - If `n` is a positive integer, `func` will be called up to `n-1` times. + * @param {F} func - The function to be called with the limit applied. + * @returns {(...args: Parameters) => ReturnType } - A new function that: + * - Tracks the number of calls. + * - Invokes `func` until the `n-1`-th call. + * - Returns last result of `func`, if `n` is reached. + * @throws {TypeError} - If `func` is not a function. + * @example + * let count = 0; + * const before3 = before(3, () => ++count); + * + * before3(); // => 1 + * before3(); // => 2 + * before3(); // => 2 + */ +declare function before any>(n: number, func: F): F; + +export { before }; diff --git a/node_modules/es-toolkit/dist/compat/function/before.d.ts b/node_modules/es-toolkit/dist/compat/function/before.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..144569f89673067025f7ef24d533a7cab2929545 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/before.d.ts @@ -0,0 +1,26 @@ +/** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @template F - The type of the function to be invoked. + * @param {number} n - The number of times the returned function is allowed to call `func` before stopping. + * - If `n` is 0, `func` will never be called. + * - If `n` is a positive integer, `func` will be called up to `n-1` times. + * @param {F} func - The function to be called with the limit applied. + * @returns {(...args: Parameters) => ReturnType } - A new function that: + * - Tracks the number of calls. + * - Invokes `func` until the `n-1`-th call. + * - Returns last result of `func`, if `n` is reached. + * @throws {TypeError} - If `func` is not a function. + * @example + * let count = 0; + * const before3 = before(3, () => ++count); + * + * before3(); // => 1 + * before3(); // => 2 + * before3(); // => 2 + */ +declare function before any>(n: number, func: F): F; + +export { before }; diff --git a/node_modules/es-toolkit/dist/compat/function/before.js b/node_modules/es-toolkit/dist/compat/function/before.js new file mode 100644 index 0000000000000000000000000000000000000000..eccedfd6d378ad524ef17e823515a8b7d09479ff --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/before.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const toInteger = require('../util/toInteger.js'); + +function before(n, func) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + let result; + n = toInteger.toInteger(n); + return function (...args) { + if (--n > 0) { + result = func.apply(this, args); + } + if (n <= 1 && func) { + func = undefined; + } + return result; + }; +} + +exports.before = before; diff --git a/node_modules/es-toolkit/dist/compat/function/before.mjs b/node_modules/es-toolkit/dist/compat/function/before.mjs new file mode 100644 index 0000000000000000000000000000000000000000..54790159536716d4e01e631c8dfd49b8f271db27 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/before.mjs @@ -0,0 +1,20 @@ +import { toInteger } from '../util/toInteger.mjs'; + +function before(n, func) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + let result; + n = toInteger(n); + return function (...args) { + if (--n > 0) { + result = func.apply(this, args); + } + if (n <= 1 && func) { + func = undefined; + } + return result; + }; +} + +export { before }; diff --git a/node_modules/es-toolkit/dist/compat/function/bind.d.mts b/node_modules/es-toolkit/dist/compat/function/bind.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..42b076fd869ef052e7de3d75d4a0f5dd6ca88403 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bind.d.mts @@ -0,0 +1,32 @@ +/** + * Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. + * + * The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions. + * + * @param {(...args: any[]) => any} func - The function to bind. + * @param {any} thisObj - The `this` binding of `func`. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {(...args: any[]) => any} - Returns the new bound function. + * + * @example + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * const object = { user: 'fred' }; + * let bound = bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * bound = bind(greet, object, bind.placeholder, '!'); + * bound('hi'); + * // => 'hi fred!' + */ +declare function bind(func: (...args: any[]) => any, thisObj: any, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bind { + var placeholder: typeof bindPlaceholder; +} +declare const bindPlaceholder: unique symbol; + +export { bind }; diff --git a/node_modules/es-toolkit/dist/compat/function/bind.d.ts b/node_modules/es-toolkit/dist/compat/function/bind.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..42b076fd869ef052e7de3d75d4a0f5dd6ca88403 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bind.d.ts @@ -0,0 +1,32 @@ +/** + * Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. + * + * The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions. + * + * @param {(...args: any[]) => any} func - The function to bind. + * @param {any} thisObj - The `this` binding of `func`. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {(...args: any[]) => any} - Returns the new bound function. + * + * @example + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * const object = { user: 'fred' }; + * let bound = bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * bound = bind(greet, object, bind.placeholder, '!'); + * bound('hi'); + * // => 'hi fred!' + */ +declare function bind(func: (...args: any[]) => any, thisObj: any, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bind { + var placeholder: typeof bindPlaceholder; +} +declare const bindPlaceholder: unique symbol; + +export { bind }; diff --git a/node_modules/es-toolkit/dist/compat/function/bind.js b/node_modules/es-toolkit/dist/compat/function/bind.js new file mode 100644 index 0000000000000000000000000000000000000000..e2cce97114497896e1519eb435d0659aaa7ef25b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bind.js @@ -0,0 +1,31 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function bind(func, thisObj, ...partialArgs) { + const bound = function (...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bind.placeholder) { + args.push(providedArgs[startIndex++]); + } + else { + args.push(arg); + } + } + for (let i = startIndex; i < providedArgs.length; i++) { + args.push(providedArgs[i]); + } + if (this instanceof bound) { + return new func(...args); + } + return func.apply(thisObj, args); + }; + return bound; +} +const bindPlaceholder = Symbol('bind.placeholder'); +bind.placeholder = bindPlaceholder; + +exports.bind = bind; diff --git a/node_modules/es-toolkit/dist/compat/function/bind.mjs b/node_modules/es-toolkit/dist/compat/function/bind.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4889a57c4a33b5c8b12cdd4d2acf4b3ba17dac80 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bind.mjs @@ -0,0 +1,27 @@ +function bind(func, thisObj, ...partialArgs) { + const bound = function (...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bind.placeholder) { + args.push(providedArgs[startIndex++]); + } + else { + args.push(arg); + } + } + for (let i = startIndex; i < providedArgs.length; i++) { + args.push(providedArgs[i]); + } + if (this instanceof bound) { + return new func(...args); + } + return func.apply(thisObj, args); + }; + return bound; +} +const bindPlaceholder = Symbol('bind.placeholder'); +bind.placeholder = bindPlaceholder; + +export { bind }; diff --git a/node_modules/es-toolkit/dist/compat/function/bindKey.d.mts b/node_modules/es-toolkit/dist/compat/function/bindKey.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..437fe2c9c70d4eba290853525586f25fbdd3e019 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bindKey.d.mts @@ -0,0 +1,45 @@ +/** + * Creates a function that invokes the method at `object[key]` with `partialArgs` prepended to the arguments it receives. + * + * This method differs from `bind` by allowing bound functions to reference methods that may be redefined or don't yet exist. + * + * The `bindKey.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * @template T - The type of the object to bind. + * @template K - The type of the key to bind. + * @param {T} object - The object to invoke the method on. + * @param {K} key - The key of the method. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {T[K] extends (...args: any[]) => any ? (...args: any[]) => ReturnType : never} - Returns the new bound function. + * + * @example + * const object = { + * user: 'fred', + * greet: function (greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * }, + * }; + * + * let bound = bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function (greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * bound = bindKey(object, 'greet', bindKey.placeholder, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ +declare function bindKey(object: object, key: string, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bindKey { + var placeholder: typeof bindKeyPlaceholder; +} +declare const bindKeyPlaceholder: unique symbol; + +export { bindKey }; diff --git a/node_modules/es-toolkit/dist/compat/function/bindKey.d.ts b/node_modules/es-toolkit/dist/compat/function/bindKey.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..437fe2c9c70d4eba290853525586f25fbdd3e019 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bindKey.d.ts @@ -0,0 +1,45 @@ +/** + * Creates a function that invokes the method at `object[key]` with `partialArgs` prepended to the arguments it receives. + * + * This method differs from `bind` by allowing bound functions to reference methods that may be redefined or don't yet exist. + * + * The `bindKey.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * @template T - The type of the object to bind. + * @template K - The type of the key to bind. + * @param {T} object - The object to invoke the method on. + * @param {K} key - The key of the method. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {T[K] extends (...args: any[]) => any ? (...args: any[]) => ReturnType : never} - Returns the new bound function. + * + * @example + * const object = { + * user: 'fred', + * greet: function (greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * }, + * }; + * + * let bound = bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function (greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * bound = bindKey(object, 'greet', bindKey.placeholder, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ +declare function bindKey(object: object, key: string, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bindKey { + var placeholder: typeof bindKeyPlaceholder; +} +declare const bindKeyPlaceholder: unique symbol; + +export { bindKey }; diff --git a/node_modules/es-toolkit/dist/compat/function/bindKey.js b/node_modules/es-toolkit/dist/compat/function/bindKey.js new file mode 100644 index 0000000000000000000000000000000000000000..4836e7ef478a18022c461ac6b912b360fa991e4a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bindKey.js @@ -0,0 +1,31 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function bindKey(object, key, ...partialArgs) { + const bound = function (...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bindKey.placeholder) { + args.push(providedArgs[startIndex++]); + } + else { + args.push(arg); + } + } + for (let i = startIndex; i < providedArgs.length; i++) { + args.push(providedArgs[i]); + } + if (this instanceof bound) { + return new object[key](...args); + } + return object[key].apply(object, args); + }; + return bound; +} +const bindKeyPlaceholder = Symbol('bindKey.placeholder'); +bindKey.placeholder = bindKeyPlaceholder; + +exports.bindKey = bindKey; diff --git a/node_modules/es-toolkit/dist/compat/function/bindKey.mjs b/node_modules/es-toolkit/dist/compat/function/bindKey.mjs new file mode 100644 index 0000000000000000000000000000000000000000..034755f06a69449939c1eb1251f6a3d9f58cffe4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/bindKey.mjs @@ -0,0 +1,27 @@ +function bindKey(object, key, ...partialArgs) { + const bound = function (...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bindKey.placeholder) { + args.push(providedArgs[startIndex++]); + } + else { + args.push(arg); + } + } + for (let i = startIndex; i < providedArgs.length; i++) { + args.push(providedArgs[i]); + } + if (this instanceof bound) { + return new object[key](...args); + } + return object[key].apply(object, args); + }; + return bound; +} +const bindKeyPlaceholder = Symbol('bindKey.placeholder'); +bindKey.placeholder = bindKeyPlaceholder; + +export { bindKey }; diff --git a/node_modules/es-toolkit/dist/compat/function/curry.d.mts b/node_modules/es-toolkit/dist/compat/function/curry.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5338f2cc885194e9d9ccc8beadd6d33ea275005b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curry.d.mts @@ -0,0 +1,154 @@ +type __ = typeof curryPlaceholder; +interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; +} +interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: __, t2: T2): CurriedFunction1; + (t1: T1, t2: T2): R; +} +interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: __, t2: T2): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: T1, t2: __, t3: T3): CurriedFunction1; + (t1: __, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: __, t2: T2): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: __, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: __, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: __, t2: T2): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction4; + (t1: T1, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: T2, t3: T3): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: __, t5: T5): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +/** + * Creates a curried function that accepts a single argument. + * @param {(t1: T1) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction1} - Returns the new curried function. + * @example + * const greet = (name: string) => `Hello ${name}`; + * const curriedGreet = curry(greet); + * curriedGreet('John'); // => 'Hello John' + */ +declare function curry(func: (t1: T1) => R, arity?: number): CurriedFunction1; +/** + * Creates a curried function that accepts two arguments. + * @param {(t1: T1, t2: T2) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction2} - Returns the new curried function. + * @example + * const add = (a: number, b: number) => a + b; + * const curriedAdd = curry(add); + * curriedAdd(1)(2); // => 3 + * curriedAdd(1, 2); // => 3 + */ +declare function curry(func: (t1: T1, t2: T2) => R, arity?: number): CurriedFunction2; +/** + * Creates a curried function that accepts three arguments. + * @param {(t1: T1, t2: T2, t3: T3) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction3} - Returns the new curried function. + * @example + * const volume = (l: number, w: number, h: number) => l * w * h; + * const curriedVolume = curry(volume); + * curriedVolume(2)(3)(4); // => 24 + * curriedVolume(2, 3)(4); // => 24 + * curriedVolume(2, 3, 4); // => 24 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): CurriedFunction3; +/** + * Creates a curried function that accepts four arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction4} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number) => a + b + c + d; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4); // => 10 + * curriedFn(1, 2)(3, 4); // => 10 + * curriedFn(1, 2, 3, 4); // => 10 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): CurriedFunction4; +/** + * Creates a curried function that accepts five arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction5} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number, e: number) => a + b + c + d + e; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4)(5); // => 15 + * curriedFn(1, 2)(3, 4)(5); // => 15 + * curriedFn(1, 2, 3, 4, 5); // => 15 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): CurriedFunction5; +/** + * Creates a curried function that accepts any number of arguments. + * @param {(...args: any[]) => any} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {(...args: any[]) => any} - Returns the new curried function. + * @example + * const sum = (...args: number[]) => args.reduce((a, b) => a + b, 0); + * const curriedSum = curry(sum); + * curriedSum(1, 2, 3); // => 6 + * curriedSum(1)(2, 3); // => 6 + * curriedSum(1)(2)(3); // => 6 + */ +declare function curry(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curry { + var placeholder: typeof curryPlaceholder; +} +declare const curryPlaceholder: unique symbol; + +export { curry }; diff --git a/node_modules/es-toolkit/dist/compat/function/curry.d.ts b/node_modules/es-toolkit/dist/compat/function/curry.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5338f2cc885194e9d9ccc8beadd6d33ea275005b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curry.d.ts @@ -0,0 +1,154 @@ +type __ = typeof curryPlaceholder; +interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; +} +interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: __, t2: T2): CurriedFunction1; + (t1: T1, t2: T2): R; +} +interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: __, t2: T2): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: T1, t2: __, t3: T3): CurriedFunction1; + (t1: __, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: __, t2: T2): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: __, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: __, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: __, t2: T2): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction4; + (t1: T1, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: T2, t3: T3): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: __, t5: T5): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +/** + * Creates a curried function that accepts a single argument. + * @param {(t1: T1) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction1} - Returns the new curried function. + * @example + * const greet = (name: string) => `Hello ${name}`; + * const curriedGreet = curry(greet); + * curriedGreet('John'); // => 'Hello John' + */ +declare function curry(func: (t1: T1) => R, arity?: number): CurriedFunction1; +/** + * Creates a curried function that accepts two arguments. + * @param {(t1: T1, t2: T2) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction2} - Returns the new curried function. + * @example + * const add = (a: number, b: number) => a + b; + * const curriedAdd = curry(add); + * curriedAdd(1)(2); // => 3 + * curriedAdd(1, 2); // => 3 + */ +declare function curry(func: (t1: T1, t2: T2) => R, arity?: number): CurriedFunction2; +/** + * Creates a curried function that accepts three arguments. + * @param {(t1: T1, t2: T2, t3: T3) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction3} - Returns the new curried function. + * @example + * const volume = (l: number, w: number, h: number) => l * w * h; + * const curriedVolume = curry(volume); + * curriedVolume(2)(3)(4); // => 24 + * curriedVolume(2, 3)(4); // => 24 + * curriedVolume(2, 3, 4); // => 24 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): CurriedFunction3; +/** + * Creates a curried function that accepts four arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction4} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number) => a + b + c + d; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4); // => 10 + * curriedFn(1, 2)(3, 4); // => 10 + * curriedFn(1, 2, 3, 4); // => 10 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): CurriedFunction4; +/** + * Creates a curried function that accepts five arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction5} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number, e: number) => a + b + c + d + e; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4)(5); // => 15 + * curriedFn(1, 2)(3, 4)(5); // => 15 + * curriedFn(1, 2, 3, 4, 5); // => 15 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): CurriedFunction5; +/** + * Creates a curried function that accepts any number of arguments. + * @param {(...args: any[]) => any} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {(...args: any[]) => any} - Returns the new curried function. + * @example + * const sum = (...args: number[]) => args.reduce((a, b) => a + b, 0); + * const curriedSum = curry(sum); + * curriedSum(1, 2, 3); // => 6 + * curriedSum(1)(2, 3); // => 6 + * curriedSum(1)(2)(3); // => 6 + */ +declare function curry(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curry { + var placeholder: typeof curryPlaceholder; +} +declare const curryPlaceholder: unique symbol; + +export { curry }; diff --git a/node_modules/es-toolkit/dist/compat/function/curry.js b/node_modules/es-toolkit/dist/compat/function/curry.js new file mode 100644 index 0000000000000000000000000000000000000000..faf4febb8eec65de2d6ce2965afc62d6813085aa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curry.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function curry(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) { + arity = 0; + } + const wrapper = function (...partialArgs) { + const holders = partialArgs.filter(item => item === curry.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) { + return makeCurry(func, arity - length, partialArgs); + } + if (this instanceof wrapper) { + return new func(...partialArgs); + } + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function makeCurry(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter(item => item === curry.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) { + return makeCurry(func, arity - length, providedArgs); + } + if (this instanceof wrapper) { + return new func(...providedArgs); + } + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curry.placeholder && startIndex < providedArgs.length) { + args.push(providedArgs[startIndex++]); + } + else { + args.push(arg); + } + } + for (let i = startIndex; i < providedArgs.length; i++) { + args.push(providedArgs[i]); + } + return args; +} +const curryPlaceholder = Symbol('curry.placeholder'); +curry.placeholder = curryPlaceholder; + +exports.curry = curry; diff --git a/node_modules/es-toolkit/dist/compat/function/curry.mjs b/node_modules/es-toolkit/dist/compat/function/curry.mjs new file mode 100644 index 0000000000000000000000000000000000000000..140700f084fe561b35cbad75ed473c746690b516 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curry.mjs @@ -0,0 +1,57 @@ +function curry(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) { + arity = 0; + } + const wrapper = function (...partialArgs) { + const holders = partialArgs.filter(item => item === curry.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) { + return makeCurry(func, arity - length, partialArgs); + } + if (this instanceof wrapper) { + return new func(...partialArgs); + } + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function makeCurry(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter(item => item === curry.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) { + return makeCurry(func, arity - length, providedArgs); + } + if (this instanceof wrapper) { + return new func(...providedArgs); + } + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curry.placeholder && startIndex < providedArgs.length) { + args.push(providedArgs[startIndex++]); + } + else { + args.push(arg); + } + } + for (let i = startIndex; i < providedArgs.length; i++) { + args.push(providedArgs[i]); + } + return args; +} +const curryPlaceholder = Symbol('curry.placeholder'); +curry.placeholder = curryPlaceholder; + +export { curry }; diff --git a/node_modules/es-toolkit/dist/compat/function/curryRight.d.mts b/node_modules/es-toolkit/dist/compat/function/curryRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d5ddb119dc9d7964af4f435cbabc804eb86050fa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curryRight.d.mts @@ -0,0 +1,85 @@ +type __ = typeof curryRightPlaceholder; +interface RightCurriedFunction1 { + (): RightCurriedFunction1; + (t1: T1): R; +} +interface RightCurriedFunction2 { + (): RightCurriedFunction2; + (t2: T2): RightCurriedFunction1; + (t1: T1, t2: __): RightCurriedFunction1; + (t1: T1, t2: T2): R; +} +interface RightCurriedFunction3 { + (): RightCurriedFunction3; + (t3: T3): RightCurriedFunction2; + (t2: T2, t3: __): RightCurriedFunction2; + (t2: T2, t3: T3): RightCurriedFunction1; + (t1: T1, t2: __, t3: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface RightCurriedFunction4 { + (): RightCurriedFunction4; + (t4: T4): RightCurriedFunction3; + (t3: T3, t4: __): RightCurriedFunction3; + (t3: T3, t4: T4): RightCurriedFunction2; + (t2: T2, t3: __, t4: __): RightCurriedFunction3; + (t2: T2, t3: T3, t4: __): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __): RightCurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface RightCurriedFunction5 { + (): RightCurriedFunction5; + (t5: T5): RightCurriedFunction4; + (t4: T4, t5: __): RightCurriedFunction4; + (t4: T4, t5: T5): RightCurriedFunction3; + (t3: T3, t4: __, t5: __): RightCurriedFunction4; + (t3: T3, t4: T4, t5: __): RightCurriedFunction3; + (t3: T3, t4: __, t5: T5): RightCurriedFunction3; + (t3: T3, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t1: T1, t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t1: T1, t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +declare function curryRight(func: (t1: T1) => R, arity?: number): RightCurriedFunction1; +declare function curryRight(func: (t1: T1, t2: T2) => R, arity?: number): RightCurriedFunction2; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): RightCurriedFunction3; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): RightCurriedFunction4; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): RightCurriedFunction5; +declare function curryRight(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curryRight { + var placeholder: typeof curryRightPlaceholder; +} +declare const curryRightPlaceholder: unique symbol; + +export { curryRight }; diff --git a/node_modules/es-toolkit/dist/compat/function/curryRight.d.ts b/node_modules/es-toolkit/dist/compat/function/curryRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d5ddb119dc9d7964af4f435cbabc804eb86050fa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curryRight.d.ts @@ -0,0 +1,85 @@ +type __ = typeof curryRightPlaceholder; +interface RightCurriedFunction1 { + (): RightCurriedFunction1; + (t1: T1): R; +} +interface RightCurriedFunction2 { + (): RightCurriedFunction2; + (t2: T2): RightCurriedFunction1; + (t1: T1, t2: __): RightCurriedFunction1; + (t1: T1, t2: T2): R; +} +interface RightCurriedFunction3 { + (): RightCurriedFunction3; + (t3: T3): RightCurriedFunction2; + (t2: T2, t3: __): RightCurriedFunction2; + (t2: T2, t3: T3): RightCurriedFunction1; + (t1: T1, t2: __, t3: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface RightCurriedFunction4 { + (): RightCurriedFunction4; + (t4: T4): RightCurriedFunction3; + (t3: T3, t4: __): RightCurriedFunction3; + (t3: T3, t4: T4): RightCurriedFunction2; + (t2: T2, t3: __, t4: __): RightCurriedFunction3; + (t2: T2, t3: T3, t4: __): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __): RightCurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface RightCurriedFunction5 { + (): RightCurriedFunction5; + (t5: T5): RightCurriedFunction4; + (t4: T4, t5: __): RightCurriedFunction4; + (t4: T4, t5: T5): RightCurriedFunction3; + (t3: T3, t4: __, t5: __): RightCurriedFunction4; + (t3: T3, t4: T4, t5: __): RightCurriedFunction3; + (t3: T3, t4: __, t5: T5): RightCurriedFunction3; + (t3: T3, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t1: T1, t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t1: T1, t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +declare function curryRight(func: (t1: T1) => R, arity?: number): RightCurriedFunction1; +declare function curryRight(func: (t1: T1, t2: T2) => R, arity?: number): RightCurriedFunction2; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): RightCurriedFunction3; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): RightCurriedFunction4; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): RightCurriedFunction5; +declare function curryRight(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curryRight { + var placeholder: typeof curryRightPlaceholder; +} +declare const curryRightPlaceholder: unique symbol; + +export { curryRight }; diff --git a/node_modules/es-toolkit/dist/compat/function/curryRight.js b/node_modules/es-toolkit/dist/compat/function/curryRight.js new file mode 100644 index 0000000000000000000000000000000000000000..c7268a5d9bc3ebefc996bca1fab3823236791bb5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curryRight.js @@ -0,0 +1,68 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function curryRight(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) { + arity = 0; + } + const wrapper = function (...partialArgs) { + const holders = partialArgs.filter(item => item === curryRight.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) { + return makeCurryRight(func, arity - length, partialArgs); + } + if (this instanceof wrapper) { + return new func(...partialArgs); + } + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function makeCurryRight(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter(item => item === curryRight.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) { + return makeCurryRight(func, arity - length, providedArgs); + } + if (this instanceof wrapper) { + return new func(...providedArgs); + } + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const placeholderLength = partialArgs.filter(arg => arg === curryRight.placeholder).length; + const rangeLength = Math.max(providedArgs.length - placeholderLength, 0); + const args = []; + let providedIndex = 0; + for (let i = 0; i < rangeLength; i++) { + args.push(providedArgs[providedIndex++]); + } + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curryRight.placeholder) { + if (providedIndex < providedArgs.length) { + args.push(providedArgs[providedIndex++]); + } + else { + args.push(arg); + } + } + else { + args.push(arg); + } + } + return args; +} +const curryRightPlaceholder = Symbol('curryRight.placeholder'); +curryRight.placeholder = curryRightPlaceholder; + +exports.curryRight = curryRight; diff --git a/node_modules/es-toolkit/dist/compat/function/curryRight.mjs b/node_modules/es-toolkit/dist/compat/function/curryRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8cba122eca2d0fe6267c084aab379c0e02f602a1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/curryRight.mjs @@ -0,0 +1,64 @@ +function curryRight(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) { + arity = 0; + } + const wrapper = function (...partialArgs) { + const holders = partialArgs.filter(item => item === curryRight.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) { + return makeCurryRight(func, arity - length, partialArgs); + } + if (this instanceof wrapper) { + return new func(...partialArgs); + } + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function makeCurryRight(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter(item => item === curryRight.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) { + return makeCurryRight(func, arity - length, providedArgs); + } + if (this instanceof wrapper) { + return new func(...providedArgs); + } + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const placeholderLength = partialArgs.filter(arg => arg === curryRight.placeholder).length; + const rangeLength = Math.max(providedArgs.length - placeholderLength, 0); + const args = []; + let providedIndex = 0; + for (let i = 0; i < rangeLength; i++) { + args.push(providedArgs[providedIndex++]); + } + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curryRight.placeholder) { + if (providedIndex < providedArgs.length) { + args.push(providedArgs[providedIndex++]); + } + else { + args.push(arg); + } + } + else { + args.push(arg); + } + } + return args; +} +const curryRightPlaceholder = Symbol('curryRight.placeholder'); +curryRight.placeholder = curryRightPlaceholder; + +export { curryRight }; diff --git a/node_modules/es-toolkit/dist/compat/function/debounce.d.mts b/node_modules/es-toolkit/dist/compat/function/debounce.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1d5cf6be8b01ece207b346806809c2639c77ba91 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/debounce.d.mts @@ -0,0 +1,144 @@ +interface DebounceSettings { + /** + * If `true`, the function will be invoked on the leading edge of the timeout. + * @default false + */ + leading?: boolean | undefined; + /** + * The maximum time `func` is allowed to be delayed before it's invoked. + * @default Infinity + */ + maxWait?: number | undefined; + /** + * If `true`, the function will be invoked on the trailing edge of the timeout. + * @default true + */ + trailing?: boolean | undefined; +} +interface DebounceSettingsLeading extends DebounceSettings { + leading: true; +} +interface DebouncedFunc any> { + /** + * Call the original function, but applying the debounce rules. + * + * If the debounced function can be run immediately, this calls it and returns its return + * value. + * + * Otherwise, it returns the return value of the last invocation, or undefined if the debounced + * function was not invoked yet. + */ + (...args: Parameters): ReturnType | undefined; + /** + * Throw away any pending invocation of the debounced function. + */ + cancel(): void; + /** + * If there is a pending invocation of the debounced function, invoke it immediately and return + * its return value. + * + * Otherwise, return the value from the last invocation, or undefined if the debounced function + * was never invoked. + */ + flush(): ReturnType | undefined; +} +interface DebouncedFuncLeading any> extends DebouncedFunc { + (...args: Parameters): ReturnType; + flush(): ReturnType; +} +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait: number | undefined, options: DebounceSettingsLeading): DebouncedFuncLeading; +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc; + +export { type DebouncedFunc, type DebouncedFuncLeading, debounce }; diff --git a/node_modules/es-toolkit/dist/compat/function/debounce.d.ts b/node_modules/es-toolkit/dist/compat/function/debounce.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d5cf6be8b01ece207b346806809c2639c77ba91 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/debounce.d.ts @@ -0,0 +1,144 @@ +interface DebounceSettings { + /** + * If `true`, the function will be invoked on the leading edge of the timeout. + * @default false + */ + leading?: boolean | undefined; + /** + * The maximum time `func` is allowed to be delayed before it's invoked. + * @default Infinity + */ + maxWait?: number | undefined; + /** + * If `true`, the function will be invoked on the trailing edge of the timeout. + * @default true + */ + trailing?: boolean | undefined; +} +interface DebounceSettingsLeading extends DebounceSettings { + leading: true; +} +interface DebouncedFunc any> { + /** + * Call the original function, but applying the debounce rules. + * + * If the debounced function can be run immediately, this calls it and returns its return + * value. + * + * Otherwise, it returns the return value of the last invocation, or undefined if the debounced + * function was not invoked yet. + */ + (...args: Parameters): ReturnType | undefined; + /** + * Throw away any pending invocation of the debounced function. + */ + cancel(): void; + /** + * If there is a pending invocation of the debounced function, invoke it immediately and return + * its return value. + * + * Otherwise, return the value from the last invocation, or undefined if the debounced function + * was never invoked. + */ + flush(): ReturnType | undefined; +} +interface DebouncedFuncLeading any> extends DebouncedFunc { + (...args: Parameters): ReturnType; + flush(): ReturnType; +} +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait: number | undefined, options: DebounceSettingsLeading): DebouncedFuncLeading; +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc; + +export { type DebouncedFunc, type DebouncedFuncLeading, debounce }; diff --git a/node_modules/es-toolkit/dist/compat/function/debounce.js b/node_modules/es-toolkit/dist/compat/function/debounce.js new file mode 100644 index 0000000000000000000000000000000000000000..794f828b6827853dedd3161ca9e2268ddbf3940e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/debounce.js @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const debounce$1 = require('../../function/debounce.js'); + +function debounce(func, debounceMs = 0, options = {}) { + if (typeof options !== 'object') { + options = {}; + } + const { leading = false, trailing = true, maxWait } = options; + const edges = Array(2); + if (leading) { + edges[0] = 'leading'; + } + if (trailing) { + edges[1] = 'trailing'; + } + let result = undefined; + let pendingAt = null; + const _debounced = debounce$1.debounce(function (...args) { + result = func.apply(this, args); + pendingAt = null; + }, debounceMs, { edges }); + const debounced = function (...args) { + if (maxWait != null) { + if (pendingAt === null) { + pendingAt = Date.now(); + } + if (Date.now() - pendingAt >= maxWait) { + result = func.apply(this, args); + pendingAt = Date.now(); + _debounced.cancel(); + _debounced.schedule(); + return result; + } + } + _debounced.apply(this, args); + return result; + }; + const flush = () => { + _debounced.flush(); + return result; + }; + debounced.cancel = _debounced.cancel; + debounced.flush = flush; + return debounced; +} + +exports.debounce = debounce; diff --git a/node_modules/es-toolkit/dist/compat/function/debounce.mjs b/node_modules/es-toolkit/dist/compat/function/debounce.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5bb78744a43ea2587523eb7657e6ec6fcf5633a8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/debounce.mjs @@ -0,0 +1,46 @@ +import { debounce as debounce$1 } from '../../function/debounce.mjs'; + +function debounce(func, debounceMs = 0, options = {}) { + if (typeof options !== 'object') { + options = {}; + } + const { leading = false, trailing = true, maxWait } = options; + const edges = Array(2); + if (leading) { + edges[0] = 'leading'; + } + if (trailing) { + edges[1] = 'trailing'; + } + let result = undefined; + let pendingAt = null; + const _debounced = debounce$1(function (...args) { + result = func.apply(this, args); + pendingAt = null; + }, debounceMs, { edges }); + const debounced = function (...args) { + if (maxWait != null) { + if (pendingAt === null) { + pendingAt = Date.now(); + } + if (Date.now() - pendingAt >= maxWait) { + result = func.apply(this, args); + pendingAt = Date.now(); + _debounced.cancel(); + _debounced.schedule(); + return result; + } + } + _debounced.apply(this, args); + return result; + }; + const flush = () => { + _debounced.flush(); + return result; + }; + debounced.cancel = _debounced.cancel; + debounced.flush = flush; + return debounced; +} + +export { debounce }; diff --git a/node_modules/es-toolkit/dist/compat/function/defer.d.mts b/node_modules/es-toolkit/dist/compat/function/defer.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e30472bcacd1bcb42d90dd634ff93d481f206774 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/defer.d.mts @@ -0,0 +1,14 @@ +/** + * Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. + * + * @param {(...args: any[]) => any} func The function to defer. + * @param {...any[]} args The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * + * @example + * defer(console.log, 'deferred'); + * // => Logs 'deferred' after the current call stack has cleared. + */ +declare function defer(func: (...args: any[]) => any, ...args: any[]): number; + +export { defer }; diff --git a/node_modules/es-toolkit/dist/compat/function/defer.d.ts b/node_modules/es-toolkit/dist/compat/function/defer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e30472bcacd1bcb42d90dd634ff93d481f206774 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/defer.d.ts @@ -0,0 +1,14 @@ +/** + * Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. + * + * @param {(...args: any[]) => any} func The function to defer. + * @param {...any[]} args The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * + * @example + * defer(console.log, 'deferred'); + * // => Logs 'deferred' after the current call stack has cleared. + */ +declare function defer(func: (...args: any[]) => any, ...args: any[]): number; + +export { defer }; diff --git a/node_modules/es-toolkit/dist/compat/function/defer.js b/node_modules/es-toolkit/dist/compat/function/defer.js new file mode 100644 index 0000000000000000000000000000000000000000..506deaf5228bb2096e8ebe1ea61b16107b51ba8f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/defer.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function defer(func, ...args) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + return setTimeout(func, 1, ...args); +} + +exports.defer = defer; diff --git a/node_modules/es-toolkit/dist/compat/function/defer.mjs b/node_modules/es-toolkit/dist/compat/function/defer.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfbffb5d60d6c7d4be0fc8b48c477673350ab74e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/defer.mjs @@ -0,0 +1,8 @@ +function defer(func, ...args) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + return setTimeout(func, 1, ...args); +} + +export { defer }; diff --git a/node_modules/es-toolkit/dist/compat/function/delay.d.mts b/node_modules/es-toolkit/dist/compat/function/delay.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b32fb9b0ff14534c5fecc5f45f0293973ca0b45c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/delay.d.mts @@ -0,0 +1,29 @@ +/** + * Invokes the specified function after a delay of the given number of milliseconds. + * Any additional arguments are passed to the function when it is invoked. + * + * @param {(...args: any[]) => any} func - The function to delay. + * @param {number} wait - The number of milliseconds to delay the invocation. + * @param {...any[]} args - The arguments to pass to the function when it is invoked. + * @returns {number} Returns the timer id. + * @throws {TypeError} If the first argument is not a function. + * + * @example + * // Example 1: Delayed function execution + * const timerId = delay( + * (greeting, recipient) => { + * console.log(`${greeting}, ${recipient}!`); + * }, + * 1000, + * 'Hello', + * 'Alice' + * ); + * // => 'Hello, Alice!' will be logged after one second. + * + * // Example 2: Clearing the timeout before execution + * clearTimeout(timerId); + * // The function will not be executed because the timeout was cleared. + */ +declare function delay(func: (...args: any[]) => any, wait: number, ...args: any[]): number; + +export { delay }; diff --git a/node_modules/es-toolkit/dist/compat/function/delay.d.ts b/node_modules/es-toolkit/dist/compat/function/delay.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b32fb9b0ff14534c5fecc5f45f0293973ca0b45c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/delay.d.ts @@ -0,0 +1,29 @@ +/** + * Invokes the specified function after a delay of the given number of milliseconds. + * Any additional arguments are passed to the function when it is invoked. + * + * @param {(...args: any[]) => any} func - The function to delay. + * @param {number} wait - The number of milliseconds to delay the invocation. + * @param {...any[]} args - The arguments to pass to the function when it is invoked. + * @returns {number} Returns the timer id. + * @throws {TypeError} If the first argument is not a function. + * + * @example + * // Example 1: Delayed function execution + * const timerId = delay( + * (greeting, recipient) => { + * console.log(`${greeting}, ${recipient}!`); + * }, + * 1000, + * 'Hello', + * 'Alice' + * ); + * // => 'Hello, Alice!' will be logged after one second. + * + * // Example 2: Clearing the timeout before execution + * clearTimeout(timerId); + * // The function will not be executed because the timeout was cleared. + */ +declare function delay(func: (...args: any[]) => any, wait: number, ...args: any[]): number; + +export { delay }; diff --git a/node_modules/es-toolkit/dist/compat/function/delay.js b/node_modules/es-toolkit/dist/compat/function/delay.js new file mode 100644 index 0000000000000000000000000000000000000000..1a369dc34fb29b0dedda5631c3efc0176c5fba38 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/delay.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const toNumber = require('../util/toNumber.js'); + +function delay(func, wait, ...args) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + return setTimeout(func, toNumber.toNumber(wait) || 0, ...args); +} + +exports.delay = delay; diff --git a/node_modules/es-toolkit/dist/compat/function/delay.mjs b/node_modules/es-toolkit/dist/compat/function/delay.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c36328c1565c3377a59104473e7f17becf9ed473 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/delay.mjs @@ -0,0 +1,10 @@ +import { toNumber } from '../util/toNumber.mjs'; + +function delay(func, wait, ...args) { + if (typeof func !== 'function') { + throw new TypeError('Expected a function'); + } + return setTimeout(func, toNumber(wait) || 0, ...args); +} + +export { delay }; diff --git a/node_modules/es-toolkit/dist/compat/function/flip.d.mts b/node_modules/es-toolkit/dist/compat/function/flip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9319e385edc4ae4fadd43bc666ed78dc10cfc384 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flip.d.mts @@ -0,0 +1,18 @@ +/** + * Reverses the order of arguments for a given function. + * + * @template T - The type of the function being flipped. + * @param {T} func - The function whose arguments will be reversed. + * @returns {T} A new function that takes the reversed arguments and returns the result of calling `func`. + * + * @example + * var flipped = flip(function() { + * return Array.prototype.slice.call(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ +declare function flip any>(func: T): T; + +export { flip }; diff --git a/node_modules/es-toolkit/dist/compat/function/flip.d.ts b/node_modules/es-toolkit/dist/compat/function/flip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9319e385edc4ae4fadd43bc666ed78dc10cfc384 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flip.d.ts @@ -0,0 +1,18 @@ +/** + * Reverses the order of arguments for a given function. + * + * @template T - The type of the function being flipped. + * @param {T} func - The function whose arguments will be reversed. + * @returns {T} A new function that takes the reversed arguments and returns the result of calling `func`. + * + * @example + * var flipped = flip(function() { + * return Array.prototype.slice.call(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ +declare function flip any>(func: T): T; + +export { flip }; diff --git a/node_modules/es-toolkit/dist/compat/function/flip.js b/node_modules/es-toolkit/dist/compat/function/flip.js new file mode 100644 index 0000000000000000000000000000000000000000..6e86cedd18b65ef6baa056a68647b7040f49d5af --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flip.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +function flip(func) { + return function (...args) { + return func.apply(this, args.reverse()); + }; +} + +exports.flip = flip; diff --git a/node_modules/es-toolkit/dist/compat/function/flip.mjs b/node_modules/es-toolkit/dist/compat/function/flip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..100ff7435db3b83b455aef1cfa042811df35c964 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flip.mjs @@ -0,0 +1,7 @@ +function flip(func) { + return function (...args) { + return func.apply(this, args.reverse()); + }; +} + +export { flip }; diff --git a/node_modules/es-toolkit/dist/compat/function/flow.d.mts b/node_modules/es-toolkit/dist/compat/function/flow.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5e6f4baf828d1facc1e8fdd8e5dc74810e7e0172 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flow.d.mts @@ -0,0 +1,119 @@ +import { Many } from '../_internal/Many.mjs'; + +/** + * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flow([add, square]); + * addSquare(1, 2); + * // => 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (...args: A) => R7; +/** + * Creates a new function that executes up to 7 functions in sequence, with additional functions flattened. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => n.toString(); + * + * const combined = flow(add, square, double, toString); + * console.log(combined(1, 2)); // "18" + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...func: Array any>>): (...args: A) => any; +/** + * Creates a new function that executes 6 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const addThenSquare = flow(add, square); + * console.log(addThenSquare(1, 2)); // 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(...func: Array any>>): (...args: any[]) => any; + +export { flow }; diff --git a/node_modules/es-toolkit/dist/compat/function/flow.d.ts b/node_modules/es-toolkit/dist/compat/function/flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..981e693bf68b34625049d3dc452ef4c0e41f77b3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flow.d.ts @@ -0,0 +1,119 @@ +import { Many } from '../_internal/Many.js'; + +/** + * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flow([add, square]); + * addSquare(1, 2); + * // => 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (...args: A) => R7; +/** + * Creates a new function that executes up to 7 functions in sequence, with additional functions flattened. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => n.toString(); + * + * const combined = flow(add, square, double, toString); + * console.log(combined(1, 2)); // "18" + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...func: Array any>>): (...args: A) => any; +/** + * Creates a new function that executes 6 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const addThenSquare = flow(add, square); + * console.log(addThenSquare(1, 2)); // 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(...func: Array any>>): (...args: any[]) => any; + +export { flow }; diff --git a/node_modules/es-toolkit/dist/compat/function/flow.js b/node_modules/es-toolkit/dist/compat/function/flow.js new file mode 100644 index 0000000000000000000000000000000000000000..82adb877bd091e5622262cc4ba3c44c9b2ff7e80 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flow.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('../../array/flatten.js'); +const flow$1 = require('../../function/flow.js'); + +function flow(...funcs) { + const flattenFuncs = flatten.flatten(funcs, 1); + if (flattenFuncs.some(func => typeof func !== 'function')) { + throw new TypeError('Expected a function'); + } + return flow$1.flow(...flattenFuncs); +} + +exports.flow = flow; diff --git a/node_modules/es-toolkit/dist/compat/function/flow.mjs b/node_modules/es-toolkit/dist/compat/function/flow.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6a8cf450ad1190f8a19c3cc57de582a74c3ef74d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flow.mjs @@ -0,0 +1,12 @@ +import { flatten } from '../../array/flatten.mjs'; +import { flow as flow$1 } from '../../function/flow.mjs'; + +function flow(...funcs) { + const flattenFuncs = flatten(funcs, 1); + if (flattenFuncs.some(func => typeof func !== 'function')) { + throw new TypeError('Expected a function'); + } + return flow$1(...flattenFuncs); +} + +export { flow }; diff --git a/node_modules/es-toolkit/dist/compat/function/flowRight.d.mts b/node_modules/es-toolkit/dist/compat/function/flowRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..625ebe1c7a9aeb0c24afab218ec3db35f2142e37 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flowRight.d.mts @@ -0,0 +1,117 @@ +import { Many } from '../_internal/Many.mjs'; + +/** + * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flowRight(square, add); + * addSquare(1, 2); + * // => 9 + */ +declare function flowRight(f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R7; +/** + * Creates a new function that executes 6 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * const length = (s: string) => s.length; + * + * const combined = flowRight(length, append, toString, double, square, add); + * console.log(combined(1, 2)); // 7 + */ +declare function flowRight(f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * + * const combined = flowRight(append, toString, double, square, add); + * console.log(combined(1, 2)); // '18!' + */ +declare function flowRight(f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * const combined = flowRight(toString, double, square, add); + * console.log(combined(1, 2)); // '18' + */ +declare function flowRight(f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flowRight(double, square, add); + * console.log(combined(1, 2)); // 18 + */ +declare function flowRight(f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence from right to left. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const combined = flowRight(square, add); + * console.log(combined(1, 2)); // 9 + */ +declare function flowRight(f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * // Pass functions as separate arguments + * const combined1 = flowRight(toString, double, square, add); + * console.log(combined1(1, 2)); // '18' + * + * // Pass functions as arrays + * const combined2 = flowRight([toString, double], [square, add]); + * console.log(combined2(1, 2)); // '18' + */ +declare function flowRight(...func: Array any>>): (...args: any[]) => any; + +export { flowRight }; diff --git a/node_modules/es-toolkit/dist/compat/function/flowRight.d.ts b/node_modules/es-toolkit/dist/compat/function/flowRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..79bac1b030e20c78f5164fecec33da2cb7cead39 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flowRight.d.ts @@ -0,0 +1,117 @@ +import { Many } from '../_internal/Many.js'; + +/** + * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flowRight(square, add); + * addSquare(1, 2); + * // => 9 + */ +declare function flowRight(f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R7; +/** + * Creates a new function that executes 6 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * const length = (s: string) => s.length; + * + * const combined = flowRight(length, append, toString, double, square, add); + * console.log(combined(1, 2)); // 7 + */ +declare function flowRight(f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * + * const combined = flowRight(append, toString, double, square, add); + * console.log(combined(1, 2)); // '18!' + */ +declare function flowRight(f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * const combined = flowRight(toString, double, square, add); + * console.log(combined(1, 2)); // '18' + */ +declare function flowRight(f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flowRight(double, square, add); + * console.log(combined(1, 2)); // 18 + */ +declare function flowRight(f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence from right to left. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const combined = flowRight(square, add); + * console.log(combined(1, 2)); // 9 + */ +declare function flowRight(f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * // Pass functions as separate arguments + * const combined1 = flowRight(toString, double, square, add); + * console.log(combined1(1, 2)); // '18' + * + * // Pass functions as arrays + * const combined2 = flowRight([toString, double], [square, add]); + * console.log(combined2(1, 2)); // '18' + */ +declare function flowRight(...func: Array any>>): (...args: any[]) => any; + +export { flowRight }; diff --git a/node_modules/es-toolkit/dist/compat/function/flowRight.js b/node_modules/es-toolkit/dist/compat/function/flowRight.js new file mode 100644 index 0000000000000000000000000000000000000000..45d605a9974e73fd05f0242e1e4f5a9f25adc9c2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/function/flowRight.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + +const flatten = require('../../array/flatten.js'); +const flowRight$1 = require('../../function/flowRight.js'); + +function flowRight(...funcs) { + const flattenFuncs = flatten.flatten(funcs, 1); + if (flattenFuncs.some(func => typeof func !== 'function')) { + throw new TypeError('Expected a function'); + } + return flowRight$1.flowRight(...flattenFuncs); +} + +exports.flowRight = flowRight;