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/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/sortedLastIndex.mjs b/node_modules/es-toolkit/compat/sortedLastIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..eff3c706a00664324b0f86d2aa571d3710fa7a1f --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndex.mjs @@ -0,0 +1 @@ +export { sortedLastIndex as default } from '../dist/compat/array/sortedLastIndex.mjs'; diff --git a/node_modules/es-toolkit/compat/sortedLastIndexBy.d.mts b/node_modules/es-toolkit/compat/sortedLastIndexBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f7d119243283d39bfc96b191f35505a4fad2db5f --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexBy.d.mts @@ -0,0 +1 @@ +export { sortedLastIndexBy as default } from '../dist/compat/array/sortedLastIndexBy.mjs'; 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/sortedLastIndexBy.mjs b/node_modules/es-toolkit/compat/sortedLastIndexBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f7d119243283d39bfc96b191f35505a4fad2db5f --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexBy.mjs @@ -0,0 +1 @@ +export { sortedLastIndexBy as default } from '../dist/compat/array/sortedLastIndexBy.mjs'; diff --git a/node_modules/es-toolkit/compat/sortedLastIndexOf.d.mts b/node_modules/es-toolkit/compat/sortedLastIndexOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0038092d2338926ed26cec0f23be114a0ed7d0ee --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexOf.d.mts @@ -0,0 +1 @@ +export { sortedLastIndexOf as default } from '../dist/compat/array/sortedLastIndexOf.mjs'; 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/sortedLastIndexOf.mjs b/node_modules/es-toolkit/compat/sortedLastIndexOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0038092d2338926ed26cec0f23be114a0ed7d0ee --- /dev/null +++ b/node_modules/es-toolkit/compat/sortedLastIndexOf.mjs @@ -0,0 +1 @@ +export { sortedLastIndexOf as default } from '../dist/compat/array/sortedLastIndexOf.mjs'; diff --git a/node_modules/es-toolkit/compat/split.d.mts b/node_modules/es-toolkit/compat/split.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f1b5c2fdb87f567b6b1aab315aa6ab3243fb4cf5 --- /dev/null +++ b/node_modules/es-toolkit/compat/split.d.mts @@ -0,0 +1 @@ +export { split as default } from '../dist/compat/string/split.mjs'; 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/split.mjs b/node_modules/es-toolkit/compat/split.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f1b5c2fdb87f567b6b1aab315aa6ab3243fb4cf5 --- /dev/null +++ b/node_modules/es-toolkit/compat/split.mjs @@ -0,0 +1 @@ +export { split as default } from '../dist/compat/string/split.mjs'; diff --git a/node_modules/es-toolkit/compat/spread.d.mts b/node_modules/es-toolkit/compat/spread.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c50fbf8bf5626f14ad8d11fd5c0e87f8eb795bb3 --- /dev/null +++ b/node_modules/es-toolkit/compat/spread.d.mts @@ -0,0 +1 @@ +export { spread as default } from '../dist/compat/function/spread.mjs'; 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/spread.mjs b/node_modules/es-toolkit/compat/spread.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c50fbf8bf5626f14ad8d11fd5c0e87f8eb795bb3 --- /dev/null +++ b/node_modules/es-toolkit/compat/spread.mjs @@ -0,0 +1 @@ +export { spread as default } from '../dist/compat/function/spread.mjs'; diff --git a/node_modules/es-toolkit/compat/startCase.d.mts b/node_modules/es-toolkit/compat/startCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a4d7fc4f1ce11b9d9f17ac02c6b5f651532ba492 --- /dev/null +++ b/node_modules/es-toolkit/compat/startCase.d.mts @@ -0,0 +1 @@ +export { startCase as default } from '../dist/compat/string/startCase.mjs'; 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/startCase.mjs b/node_modules/es-toolkit/compat/startCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a4d7fc4f1ce11b9d9f17ac02c6b5f651532ba492 --- /dev/null +++ b/node_modules/es-toolkit/compat/startCase.mjs @@ -0,0 +1 @@ +export { startCase as default } from '../dist/compat/string/startCase.mjs'; diff --git a/node_modules/es-toolkit/compat/startsWith.d.mts b/node_modules/es-toolkit/compat/startsWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9edfc27ab437319ff4f31ee62e065a9815a3ae49 --- /dev/null +++ b/node_modules/es-toolkit/compat/startsWith.d.mts @@ -0,0 +1 @@ +export { startsWith as default } from '../dist/compat/string/startsWith.mjs'; 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/startsWith.mjs b/node_modules/es-toolkit/compat/startsWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9edfc27ab437319ff4f31ee62e065a9815a3ae49 --- /dev/null +++ b/node_modules/es-toolkit/compat/startsWith.mjs @@ -0,0 +1 @@ +export { startsWith as default } from '../dist/compat/string/startsWith.mjs'; diff --git a/node_modules/es-toolkit/compat/stubArray.d.mts b/node_modules/es-toolkit/compat/stubArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c6f656b882004486f15f2b80427fd80a74cfd3ae --- /dev/null +++ b/node_modules/es-toolkit/compat/stubArray.d.mts @@ -0,0 +1 @@ +export { stubArray as default } from '../dist/compat/util/stubArray.mjs'; 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/stubArray.mjs b/node_modules/es-toolkit/compat/stubArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c6f656b882004486f15f2b80427fd80a74cfd3ae --- /dev/null +++ b/node_modules/es-toolkit/compat/stubArray.mjs @@ -0,0 +1 @@ +export { stubArray as default } from '../dist/compat/util/stubArray.mjs'; diff --git a/node_modules/es-toolkit/compat/stubFalse.d.mts b/node_modules/es-toolkit/compat/stubFalse.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..60a297b34aaddd90c8e03b9f688ebc30c19c0ff7 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubFalse.d.mts @@ -0,0 +1 @@ +export { stubFalse as default } from '../dist/compat/util/stubFalse.mjs'; 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/stubFalse.mjs b/node_modules/es-toolkit/compat/stubFalse.mjs new file mode 100644 index 0000000000000000000000000000000000000000..60a297b34aaddd90c8e03b9f688ebc30c19c0ff7 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubFalse.mjs @@ -0,0 +1 @@ +export { stubFalse as default } from '../dist/compat/util/stubFalse.mjs'; diff --git a/node_modules/es-toolkit/compat/stubObject.d.mts b/node_modules/es-toolkit/compat/stubObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b6b643ad3d5967e1dcc0be291e83aa6bf407c339 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubObject.d.mts @@ -0,0 +1 @@ +export { stubObject as default } from '../dist/compat/util/stubObject.mjs'; 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/stubObject.mjs b/node_modules/es-toolkit/compat/stubObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b6b643ad3d5967e1dcc0be291e83aa6bf407c339 --- /dev/null +++ b/node_modules/es-toolkit/compat/stubObject.mjs @@ -0,0 +1 @@ +export { stubObject as default } from '../dist/compat/util/stubObject.mjs'; diff --git a/node_modules/es-toolkit/compat/stubString.d.mts b/node_modules/es-toolkit/compat/stubString.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fc1707d251ab359072c992549781a7ca215db13e --- /dev/null +++ b/node_modules/es-toolkit/compat/stubString.d.mts @@ -0,0 +1 @@ +export { stubString as default } from '../dist/compat/util/stubString.mjs'; 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/stubString.mjs b/node_modules/es-toolkit/compat/stubString.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fc1707d251ab359072c992549781a7ca215db13e --- /dev/null +++ b/node_modules/es-toolkit/compat/stubString.mjs @@ -0,0 +1 @@ +export { stubString as default } from '../dist/compat/util/stubString.mjs'; diff --git a/node_modules/es-toolkit/compat/stubTrue.d.mts b/node_modules/es-toolkit/compat/stubTrue.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d970345730618078a2399f73688b5afadfab242b --- /dev/null +++ b/node_modules/es-toolkit/compat/stubTrue.d.mts @@ -0,0 +1 @@ +export { stubTrue as default } from '../dist/compat/util/stubTrue.mjs'; 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/stubTrue.mjs b/node_modules/es-toolkit/compat/stubTrue.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d970345730618078a2399f73688b5afadfab242b --- /dev/null +++ b/node_modules/es-toolkit/compat/stubTrue.mjs @@ -0,0 +1 @@ +export { stubTrue as default } from '../dist/compat/util/stubTrue.mjs'; diff --git a/node_modules/es-toolkit/compat/subtract.d.mts b/node_modules/es-toolkit/compat/subtract.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9f988af1a240a1cb78dc7a5f1463f1dc7b7245b7 --- /dev/null +++ b/node_modules/es-toolkit/compat/subtract.d.mts @@ -0,0 +1 @@ +export { subtract as default } from '../dist/compat/math/subtract.mjs'; 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/subtract.mjs b/node_modules/es-toolkit/compat/subtract.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9f988af1a240a1cb78dc7a5f1463f1dc7b7245b7 --- /dev/null +++ b/node_modules/es-toolkit/compat/subtract.mjs @@ -0,0 +1 @@ +export { subtract as default } from '../dist/compat/math/subtract.mjs'; diff --git a/node_modules/es-toolkit/compat/sum.d.mts b/node_modules/es-toolkit/compat/sum.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b94a74aa7732701d6d948bea173890efb5d8a9e9 --- /dev/null +++ b/node_modules/es-toolkit/compat/sum.d.mts @@ -0,0 +1 @@ +export { sum as default } from '../dist/compat/math/sum.mjs'; 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/sum.mjs b/node_modules/es-toolkit/compat/sum.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b94a74aa7732701d6d948bea173890efb5d8a9e9 --- /dev/null +++ b/node_modules/es-toolkit/compat/sum.mjs @@ -0,0 +1 @@ +export { sum as default } from '../dist/compat/math/sum.mjs'; diff --git a/node_modules/es-toolkit/compat/sumBy.d.mts b/node_modules/es-toolkit/compat/sumBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9deb9385178a945d9e4c4b6d9cedc1b07c4902ad --- /dev/null +++ b/node_modules/es-toolkit/compat/sumBy.d.mts @@ -0,0 +1 @@ +export { sumBy as default } from '../dist/compat/math/sumBy.mjs'; 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/sumBy.mjs b/node_modules/es-toolkit/compat/sumBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9deb9385178a945d9e4c4b6d9cedc1b07c4902ad --- /dev/null +++ b/node_modules/es-toolkit/compat/sumBy.mjs @@ -0,0 +1 @@ +export { sumBy as default } from '../dist/compat/math/sumBy.mjs'; diff --git a/node_modules/es-toolkit/compat/tail.d.mts b/node_modules/es-toolkit/compat/tail.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8b1fc44a31248fb3f2a4158d598dccc1265d58fc --- /dev/null +++ b/node_modules/es-toolkit/compat/tail.d.mts @@ -0,0 +1 @@ +export { tail as default } from '../dist/compat/array/tail.mjs'; 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/tail.mjs b/node_modules/es-toolkit/compat/tail.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8b1fc44a31248fb3f2a4158d598dccc1265d58fc --- /dev/null +++ b/node_modules/es-toolkit/compat/tail.mjs @@ -0,0 +1 @@ +export { tail as default } from '../dist/compat/array/tail.mjs'; diff --git a/node_modules/es-toolkit/compat/take.d.mts b/node_modules/es-toolkit/compat/take.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..41303c972eca5f51ff03ff07f39f6bb2e1c13ad2 --- /dev/null +++ b/node_modules/es-toolkit/compat/take.d.mts @@ -0,0 +1 @@ +export { take as default } from '../dist/compat/array/take.mjs'; 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/take.mjs b/node_modules/es-toolkit/compat/take.mjs new file mode 100644 index 0000000000000000000000000000000000000000..41303c972eca5f51ff03ff07f39f6bb2e1c13ad2 --- /dev/null +++ b/node_modules/es-toolkit/compat/take.mjs @@ -0,0 +1 @@ +export { take as default } from '../dist/compat/array/take.mjs'; diff --git a/node_modules/es-toolkit/compat/takeRight.d.mts b/node_modules/es-toolkit/compat/takeRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f38bd3aad684fa9c0368af63d64aad8390a3bfd4 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRight.d.mts @@ -0,0 +1 @@ +export { takeRight as default } from '../dist/compat/array/takeRight.mjs'; 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/takeRight.mjs b/node_modules/es-toolkit/compat/takeRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f38bd3aad684fa9c0368af63d64aad8390a3bfd4 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRight.mjs @@ -0,0 +1 @@ +export { takeRight as default } from '../dist/compat/array/takeRight.mjs'; diff --git a/node_modules/es-toolkit/compat/takeRightWhile.d.mts b/node_modules/es-toolkit/compat/takeRightWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8fe148204d7e66d1ab96a1c24680362a9e62c4a5 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRightWhile.d.mts @@ -0,0 +1 @@ +export { takeRightWhile as default } from '../dist/compat/array/takeRightWhile.mjs'; 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/takeRightWhile.mjs b/node_modules/es-toolkit/compat/takeRightWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8fe148204d7e66d1ab96a1c24680362a9e62c4a5 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeRightWhile.mjs @@ -0,0 +1 @@ +export { takeRightWhile as default } from '../dist/compat/array/takeRightWhile.mjs'; diff --git a/node_modules/es-toolkit/compat/takeWhile.d.mts b/node_modules/es-toolkit/compat/takeWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..14d1be1b50196160869ae66459810b60bf0631f7 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeWhile.d.mts @@ -0,0 +1 @@ +export { takeWhile as default } from '../dist/compat/array/takeWhile.mjs'; 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/takeWhile.mjs b/node_modules/es-toolkit/compat/takeWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..14d1be1b50196160869ae66459810b60bf0631f7 --- /dev/null +++ b/node_modules/es-toolkit/compat/takeWhile.mjs @@ -0,0 +1 @@ +export { takeWhile as default } from '../dist/compat/array/takeWhile.mjs'; diff --git a/node_modules/es-toolkit/compat/template.d.mts b/node_modules/es-toolkit/compat/template.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9f72f735375cadf0958fe613e3ea9ff2cacdc1ae --- /dev/null +++ b/node_modules/es-toolkit/compat/template.d.mts @@ -0,0 +1 @@ +export { template as default } from '../dist/compat/string/template.mjs'; 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/template.mjs b/node_modules/es-toolkit/compat/template.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9f72f735375cadf0958fe613e3ea9ff2cacdc1ae --- /dev/null +++ b/node_modules/es-toolkit/compat/template.mjs @@ -0,0 +1 @@ +export { template as default } from '../dist/compat/string/template.mjs'; diff --git a/node_modules/es-toolkit/compat/templateSettings.d.mts b/node_modules/es-toolkit/compat/templateSettings.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b68661d6ec6ea869228c4b61c618842668aca482 --- /dev/null +++ b/node_modules/es-toolkit/compat/templateSettings.d.mts @@ -0,0 +1 @@ +export { templateSettings as default } from '../dist/compat/string/templateSettings.mjs'; 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/templateSettings.mjs b/node_modules/es-toolkit/compat/templateSettings.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b68661d6ec6ea869228c4b61c618842668aca482 --- /dev/null +++ b/node_modules/es-toolkit/compat/templateSettings.mjs @@ -0,0 +1 @@ +export { templateSettings as default } from '../dist/compat/string/templateSettings.mjs'; diff --git a/node_modules/es-toolkit/compat/throttle.d.mts b/node_modules/es-toolkit/compat/throttle.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0fbc9b10c6529ec563dc205ca2f3f3d806c8709a --- /dev/null +++ b/node_modules/es-toolkit/compat/throttle.d.mts @@ -0,0 +1 @@ +export { throttle as default } from '../dist/compat/function/throttle.mjs'; 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/throttle.mjs b/node_modules/es-toolkit/compat/throttle.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0fbc9b10c6529ec563dc205ca2f3f3d806c8709a --- /dev/null +++ b/node_modules/es-toolkit/compat/throttle.mjs @@ -0,0 +1 @@ +export { throttle as default } from '../dist/compat/function/throttle.mjs'; diff --git a/node_modules/es-toolkit/compat/times.d.mts b/node_modules/es-toolkit/compat/times.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..287c93ba14485029c8d31b27d8d1847c13efbc7c --- /dev/null +++ b/node_modules/es-toolkit/compat/times.d.mts @@ -0,0 +1 @@ +export { times as default } from '../dist/compat/util/times.mjs'; 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/times.mjs b/node_modules/es-toolkit/compat/times.mjs new file mode 100644 index 0000000000000000000000000000000000000000..287c93ba14485029c8d31b27d8d1847c13efbc7c --- /dev/null +++ b/node_modules/es-toolkit/compat/times.mjs @@ -0,0 +1 @@ +export { times as default } from '../dist/compat/util/times.mjs'; diff --git a/node_modules/es-toolkit/compat/toArray.d.mts b/node_modules/es-toolkit/compat/toArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6fa61b7c6361fa76a3c205919a5320e88a03c79b --- /dev/null +++ b/node_modules/es-toolkit/compat/toArray.d.mts @@ -0,0 +1 @@ +export { toArray as default } from '../dist/compat/util/toArray.mjs'; 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/toArray.mjs b/node_modules/es-toolkit/compat/toArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6fa61b7c6361fa76a3c205919a5320e88a03c79b --- /dev/null +++ b/node_modules/es-toolkit/compat/toArray.mjs @@ -0,0 +1 @@ +export { toArray as default } from '../dist/compat/util/toArray.mjs'; diff --git a/node_modules/es-toolkit/compat/toDefaulted.d.mts b/node_modules/es-toolkit/compat/toDefaulted.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4c5cb3e4111ccf640000853772e1a7eb236e64fb --- /dev/null +++ b/node_modules/es-toolkit/compat/toDefaulted.d.mts @@ -0,0 +1 @@ +export { toDefaulted as default } from '../dist/compat/object/toDefaulted.mjs'; 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/toDefaulted.mjs b/node_modules/es-toolkit/compat/toDefaulted.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4c5cb3e4111ccf640000853772e1a7eb236e64fb --- /dev/null +++ b/node_modules/es-toolkit/compat/toDefaulted.mjs @@ -0,0 +1 @@ +export { toDefaulted as default } from '../dist/compat/object/toDefaulted.mjs'; diff --git a/node_modules/es-toolkit/compat/toFinite.d.mts b/node_modules/es-toolkit/compat/toFinite.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bf87f29a6416efb2c3ea7e264a175bf848652cbe --- /dev/null +++ b/node_modules/es-toolkit/compat/toFinite.d.mts @@ -0,0 +1 @@ +export { toFinite as default } from '../dist/compat/util/toFinite.mjs'; 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/toFinite.mjs b/node_modules/es-toolkit/compat/toFinite.mjs new file mode 100644 index 0000000000000000000000000000000000000000..bf87f29a6416efb2c3ea7e264a175bf848652cbe --- /dev/null +++ b/node_modules/es-toolkit/compat/toFinite.mjs @@ -0,0 +1 @@ +export { toFinite as default } from '../dist/compat/util/toFinite.mjs'; diff --git a/node_modules/es-toolkit/compat/toInteger.d.mts b/node_modules/es-toolkit/compat/toInteger.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..67ecd5a091ee3217eb956bc51f426d4cdf67f29b --- /dev/null +++ b/node_modules/es-toolkit/compat/toInteger.d.mts @@ -0,0 +1 @@ +export { toInteger as default } from '../dist/compat/util/toInteger.mjs'; 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/toInteger.mjs b/node_modules/es-toolkit/compat/toInteger.mjs new file mode 100644 index 0000000000000000000000000000000000000000..67ecd5a091ee3217eb956bc51f426d4cdf67f29b --- /dev/null +++ b/node_modules/es-toolkit/compat/toInteger.mjs @@ -0,0 +1 @@ +export { toInteger as default } from '../dist/compat/util/toInteger.mjs'; diff --git a/node_modules/es-toolkit/compat/toLength.d.mts b/node_modules/es-toolkit/compat/toLength.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..08d55cdef2dbe8698a93787a8778f9baeae1b269 --- /dev/null +++ b/node_modules/es-toolkit/compat/toLength.d.mts @@ -0,0 +1 @@ +export { toLength as default } from '../dist/compat/util/toLength.mjs'; 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/toLength.mjs b/node_modules/es-toolkit/compat/toLength.mjs new file mode 100644 index 0000000000000000000000000000000000000000..08d55cdef2dbe8698a93787a8778f9baeae1b269 --- /dev/null +++ b/node_modules/es-toolkit/compat/toLength.mjs @@ -0,0 +1 @@ +export { toLength as default } from '../dist/compat/util/toLength.mjs'; diff --git a/node_modules/es-toolkit/compat/toLower.d.mts b/node_modules/es-toolkit/compat/toLower.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2fcc8260904a19ada436436d07cc5ede9425a105 --- /dev/null +++ b/node_modules/es-toolkit/compat/toLower.d.mts @@ -0,0 +1 @@ +export { toLower as default } from '../dist/compat/string/toLower.mjs'; 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/toLower.mjs b/node_modules/es-toolkit/compat/toLower.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2fcc8260904a19ada436436d07cc5ede9425a105 --- /dev/null +++ b/node_modules/es-toolkit/compat/toLower.mjs @@ -0,0 +1 @@ +export { toLower as default } from '../dist/compat/string/toLower.mjs'; diff --git a/node_modules/es-toolkit/compat/toNumber.d.mts b/node_modules/es-toolkit/compat/toNumber.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6522114c8a412f731a40402b4e2fadf54204c3d2 --- /dev/null +++ b/node_modules/es-toolkit/compat/toNumber.d.mts @@ -0,0 +1 @@ +export { toNumber as default } from '../dist/compat/util/toNumber.mjs'; 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/toNumber.mjs b/node_modules/es-toolkit/compat/toNumber.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6522114c8a412f731a40402b4e2fadf54204c3d2 --- /dev/null +++ b/node_modules/es-toolkit/compat/toNumber.mjs @@ -0,0 +1 @@ +export { toNumber as default } from '../dist/compat/util/toNumber.mjs'; diff --git a/node_modules/es-toolkit/compat/toPairs.d.mts b/node_modules/es-toolkit/compat/toPairs.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a1688dae98bff07d15f7bc77db39d0c4393e17bd --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairs.d.mts @@ -0,0 +1 @@ +export { toPairs as default } from '../dist/compat/object/toPairs.mjs'; 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/toPairs.mjs b/node_modules/es-toolkit/compat/toPairs.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a1688dae98bff07d15f7bc77db39d0c4393e17bd --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairs.mjs @@ -0,0 +1 @@ +export { toPairs as default } from '../dist/compat/object/toPairs.mjs'; diff --git a/node_modules/es-toolkit/compat/toPairsIn.d.mts b/node_modules/es-toolkit/compat/toPairsIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3d7682b67a16ebf4fa3a6b2d31e72fe8548b2ea1 --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairsIn.d.mts @@ -0,0 +1 @@ +export { toPairsIn as default } from '../dist/compat/object/toPairsIn.mjs'; 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/toPairsIn.mjs b/node_modules/es-toolkit/compat/toPairsIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3d7682b67a16ebf4fa3a6b2d31e72fe8548b2ea1 --- /dev/null +++ b/node_modules/es-toolkit/compat/toPairsIn.mjs @@ -0,0 +1 @@ +export { toPairsIn as default } from '../dist/compat/object/toPairsIn.mjs'; diff --git a/node_modules/es-toolkit/compat/toPath.d.mts b/node_modules/es-toolkit/compat/toPath.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..18ada0920f09a4719c6c67b75d9b96f9af54410b --- /dev/null +++ b/node_modules/es-toolkit/compat/toPath.d.mts @@ -0,0 +1 @@ +export { toPath as default } from '../dist/compat/util/toPath.mjs'; 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/toPath.mjs b/node_modules/es-toolkit/compat/toPath.mjs new file mode 100644 index 0000000000000000000000000000000000000000..18ada0920f09a4719c6c67b75d9b96f9af54410b --- /dev/null +++ b/node_modules/es-toolkit/compat/toPath.mjs @@ -0,0 +1 @@ +export { toPath as default } from '../dist/compat/util/toPath.mjs'; diff --git a/node_modules/es-toolkit/compat/toPlainObject.d.mts b/node_modules/es-toolkit/compat/toPlainObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e8f9fc60060def2ab91df35e1b23d932ce2a27dd --- /dev/null +++ b/node_modules/es-toolkit/compat/toPlainObject.d.mts @@ -0,0 +1 @@ +export { toPlainObject as default } from '../dist/compat/util/toPlainObject.mjs'; 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/toPlainObject.mjs b/node_modules/es-toolkit/compat/toPlainObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e8f9fc60060def2ab91df35e1b23d932ce2a27dd --- /dev/null +++ b/node_modules/es-toolkit/compat/toPlainObject.mjs @@ -0,0 +1 @@ +export { toPlainObject as default } from '../dist/compat/util/toPlainObject.mjs'; diff --git a/node_modules/es-toolkit/compat/toSafeInteger.d.mts b/node_modules/es-toolkit/compat/toSafeInteger.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..035d9742544b1bf1b81b0d287822eb2155478d6e --- /dev/null +++ b/node_modules/es-toolkit/compat/toSafeInteger.d.mts @@ -0,0 +1 @@ +export { toSafeInteger as default } from '../dist/compat/util/toSafeInteger.mjs'; 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/toSafeInteger.mjs b/node_modules/es-toolkit/compat/toSafeInteger.mjs new file mode 100644 index 0000000000000000000000000000000000000000..035d9742544b1bf1b81b0d287822eb2155478d6e --- /dev/null +++ b/node_modules/es-toolkit/compat/toSafeInteger.mjs @@ -0,0 +1 @@ +export { toSafeInteger as default } from '../dist/compat/util/toSafeInteger.mjs'; diff --git a/node_modules/es-toolkit/compat/toString.d.mts b/node_modules/es-toolkit/compat/toString.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..632fa8623f03a23e914d7a97ca79faf8cd15b536 --- /dev/null +++ b/node_modules/es-toolkit/compat/toString.d.mts @@ -0,0 +1 @@ +export { toString as default } from '../dist/compat/util/toString.mjs'; 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/toString.mjs b/node_modules/es-toolkit/compat/toString.mjs new file mode 100644 index 0000000000000000000000000000000000000000..632fa8623f03a23e914d7a97ca79faf8cd15b536 --- /dev/null +++ b/node_modules/es-toolkit/compat/toString.mjs @@ -0,0 +1 @@ +export { toString as default } from '../dist/compat/util/toString.mjs'; diff --git a/node_modules/es-toolkit/compat/toUpper.d.mts b/node_modules/es-toolkit/compat/toUpper.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d3638b2a4559f1da1843ee0a5b13581d564ecf8d --- /dev/null +++ b/node_modules/es-toolkit/compat/toUpper.d.mts @@ -0,0 +1 @@ +export { toUpper as default } from '../dist/compat/string/toUpper.mjs'; 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/toUpper.mjs b/node_modules/es-toolkit/compat/toUpper.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d3638b2a4559f1da1843ee0a5b13581d564ecf8d --- /dev/null +++ b/node_modules/es-toolkit/compat/toUpper.mjs @@ -0,0 +1 @@ +export { toUpper as default } from '../dist/compat/string/toUpper.mjs'; diff --git a/node_modules/es-toolkit/compat/transform.d.mts b/node_modules/es-toolkit/compat/transform.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cb5ded6169fba3351913f16254cc9216098eb3bb --- /dev/null +++ b/node_modules/es-toolkit/compat/transform.d.mts @@ -0,0 +1 @@ +export { transform as default } from '../dist/compat/object/transform.mjs'; 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/transform.mjs b/node_modules/es-toolkit/compat/transform.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cb5ded6169fba3351913f16254cc9216098eb3bb --- /dev/null +++ b/node_modules/es-toolkit/compat/transform.mjs @@ -0,0 +1 @@ +export { transform as default } from '../dist/compat/object/transform.mjs'; diff --git a/node_modules/es-toolkit/compat/trim.d.mts b/node_modules/es-toolkit/compat/trim.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f2e04f3baee11af6a4845e1e840bd77810c2ea2d --- /dev/null +++ b/node_modules/es-toolkit/compat/trim.d.mts @@ -0,0 +1 @@ +export { trim as default } from '../dist/compat/string/trim.mjs'; 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/trim.mjs b/node_modules/es-toolkit/compat/trim.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f2e04f3baee11af6a4845e1e840bd77810c2ea2d --- /dev/null +++ b/node_modules/es-toolkit/compat/trim.mjs @@ -0,0 +1 @@ +export { trim as default } from '../dist/compat/string/trim.mjs'; diff --git a/node_modules/es-toolkit/compat/trimEnd.d.mts b/node_modules/es-toolkit/compat/trimEnd.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..357b50a34eb247b28e204f3ff9ac7ee7c7b51ccd --- /dev/null +++ b/node_modules/es-toolkit/compat/trimEnd.d.mts @@ -0,0 +1 @@ +export { trimEnd as default } from '../dist/compat/string/trimEnd.mjs'; 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/trimEnd.mjs b/node_modules/es-toolkit/compat/trimEnd.mjs new file mode 100644 index 0000000000000000000000000000000000000000..357b50a34eb247b28e204f3ff9ac7ee7c7b51ccd --- /dev/null +++ b/node_modules/es-toolkit/compat/trimEnd.mjs @@ -0,0 +1 @@ +export { trimEnd as default } from '../dist/compat/string/trimEnd.mjs'; diff --git a/node_modules/es-toolkit/compat/trimStart.d.mts b/node_modules/es-toolkit/compat/trimStart.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f2c132c3aec46d949d20414a2423268ce13a9163 --- /dev/null +++ b/node_modules/es-toolkit/compat/trimStart.d.mts @@ -0,0 +1 @@ +export { trimStart as default } from '../dist/compat/string/trimStart.mjs'; 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/trimStart.mjs b/node_modules/es-toolkit/compat/trimStart.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f2c132c3aec46d949d20414a2423268ce13a9163 --- /dev/null +++ b/node_modules/es-toolkit/compat/trimStart.mjs @@ -0,0 +1 @@ +export { trimStart as default } from '../dist/compat/string/trimStart.mjs'; diff --git a/node_modules/es-toolkit/compat/truncate.d.mts b/node_modules/es-toolkit/compat/truncate.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e77cfe65f5e6d156010619e9da88e45fa79928f6 --- /dev/null +++ b/node_modules/es-toolkit/compat/truncate.d.mts @@ -0,0 +1 @@ +export { truncate as default } from '../dist/compat/string/truncate.mjs'; 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/truncate.mjs b/node_modules/es-toolkit/compat/truncate.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e77cfe65f5e6d156010619e9da88e45fa79928f6 --- /dev/null +++ b/node_modules/es-toolkit/compat/truncate.mjs @@ -0,0 +1 @@ +export { truncate as default } from '../dist/compat/string/truncate.mjs'; diff --git a/node_modules/es-toolkit/compat/unary.d.mts b/node_modules/es-toolkit/compat/unary.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c9c9a1abc8459734586cc6d2d0436f304c83dae0 --- /dev/null +++ b/node_modules/es-toolkit/compat/unary.d.mts @@ -0,0 +1 @@ +export { unary as default } from '../dist/function/unary.mjs'; 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/unary.mjs b/node_modules/es-toolkit/compat/unary.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c9c9a1abc8459734586cc6d2d0436f304c83dae0 --- /dev/null +++ b/node_modules/es-toolkit/compat/unary.mjs @@ -0,0 +1 @@ +export { unary as default } from '../dist/function/unary.mjs'; diff --git a/node_modules/es-toolkit/compat/unescape.d.mts b/node_modules/es-toolkit/compat/unescape.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..95379d778e35bf40f2cf0cb8c375f1c900c3d16a --- /dev/null +++ b/node_modules/es-toolkit/compat/unescape.d.mts @@ -0,0 +1 @@ +export { unescape as default } from '../dist/compat/string/unescape.mjs'; 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/unescape.mjs b/node_modules/es-toolkit/compat/unescape.mjs new file mode 100644 index 0000000000000000000000000000000000000000..95379d778e35bf40f2cf0cb8c375f1c900c3d16a --- /dev/null +++ b/node_modules/es-toolkit/compat/unescape.mjs @@ -0,0 +1 @@ +export { unescape as default } from '../dist/compat/string/unescape.mjs'; diff --git a/node_modules/es-toolkit/compat/union.d.mts b/node_modules/es-toolkit/compat/union.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..67c135a44e23247cda25eb6cdc40c5b13c0ed9b6 --- /dev/null +++ b/node_modules/es-toolkit/compat/union.d.mts @@ -0,0 +1 @@ +export { union as default } from '../dist/compat/array/union.mjs'; 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/union.mjs b/node_modules/es-toolkit/compat/union.mjs new file mode 100644 index 0000000000000000000000000000000000000000..67c135a44e23247cda25eb6cdc40c5b13c0ed9b6 --- /dev/null +++ b/node_modules/es-toolkit/compat/union.mjs @@ -0,0 +1 @@ +export { union as default } from '../dist/compat/array/union.mjs'; diff --git a/node_modules/es-toolkit/compat/unionBy.d.mts b/node_modules/es-toolkit/compat/unionBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7503d751a0e4a5805e0ecb611cfb673d0ece4129 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionBy.d.mts @@ -0,0 +1 @@ +export { unionBy as default } from '../dist/compat/array/unionBy.mjs'; 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/unionBy.mjs b/node_modules/es-toolkit/compat/unionBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7503d751a0e4a5805e0ecb611cfb673d0ece4129 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionBy.mjs @@ -0,0 +1 @@ +export { unionBy as default } from '../dist/compat/array/unionBy.mjs'; diff --git a/node_modules/es-toolkit/compat/unionWith.d.mts b/node_modules/es-toolkit/compat/unionWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..73cec610da97e90dba343020a4e57d08ea674431 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionWith.d.mts @@ -0,0 +1 @@ +export { unionWith as default } from '../dist/compat/array/unionWith.mjs'; 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/unionWith.mjs b/node_modules/es-toolkit/compat/unionWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..73cec610da97e90dba343020a4e57d08ea674431 --- /dev/null +++ b/node_modules/es-toolkit/compat/unionWith.mjs @@ -0,0 +1 @@ +export { unionWith as default } from '../dist/compat/array/unionWith.mjs'; diff --git a/node_modules/es-toolkit/compat/uniq.d.mts b/node_modules/es-toolkit/compat/uniq.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..288dd70f0ba79e6b85ab702d2df22623da1b8054 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniq.d.mts @@ -0,0 +1 @@ +export { uniq as default } from '../dist/compat/array/uniq.mjs'; 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/uniq.mjs b/node_modules/es-toolkit/compat/uniq.mjs new file mode 100644 index 0000000000000000000000000000000000000000..288dd70f0ba79e6b85ab702d2df22623da1b8054 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniq.mjs @@ -0,0 +1 @@ +export { uniq as default } from '../dist/compat/array/uniq.mjs'; diff --git a/node_modules/es-toolkit/compat/uniqBy.d.mts b/node_modules/es-toolkit/compat/uniqBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5fd01477a622189b25308f0328d31ee5f5078014 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqBy.d.mts @@ -0,0 +1 @@ +export { uniqBy as default } from '../dist/compat/array/uniqBy.mjs'; 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/uniqBy.mjs b/node_modules/es-toolkit/compat/uniqBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5fd01477a622189b25308f0328d31ee5f5078014 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqBy.mjs @@ -0,0 +1 @@ +export { uniqBy as default } from '../dist/compat/array/uniqBy.mjs'; diff --git a/node_modules/es-toolkit/compat/uniqWith.d.mts b/node_modules/es-toolkit/compat/uniqWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..90e1853525b0fb4b224bc5db2a410d3a93e43c14 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqWith.d.mts @@ -0,0 +1 @@ +export { uniqWith as default } from '../dist/compat/array/uniqWith.mjs'; 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/uniqWith.mjs b/node_modules/es-toolkit/compat/uniqWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..90e1853525b0fb4b224bc5db2a410d3a93e43c14 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqWith.mjs @@ -0,0 +1 @@ +export { uniqWith as default } from '../dist/compat/array/uniqWith.mjs'; diff --git a/node_modules/es-toolkit/compat/uniqueId.d.mts b/node_modules/es-toolkit/compat/uniqueId.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d91403362c9c92f9dea1a8d6b61cee8213520b97 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqueId.d.mts @@ -0,0 +1 @@ +export { uniqueId as default } from '../dist/compat/util/uniqueId.mjs'; 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/uniqueId.mjs b/node_modules/es-toolkit/compat/uniqueId.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d91403362c9c92f9dea1a8d6b61cee8213520b97 --- /dev/null +++ b/node_modules/es-toolkit/compat/uniqueId.mjs @@ -0,0 +1 @@ +export { uniqueId as default } from '../dist/compat/util/uniqueId.mjs'; diff --git a/node_modules/es-toolkit/compat/unset.d.mts b/node_modules/es-toolkit/compat/unset.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a582118b7a845bb4b7e50eb971019bb43f927ce6 --- /dev/null +++ b/node_modules/es-toolkit/compat/unset.d.mts @@ -0,0 +1 @@ +export { unset as default } from '../dist/compat/object/unset.mjs'; 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/unset.mjs b/node_modules/es-toolkit/compat/unset.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a582118b7a845bb4b7e50eb971019bb43f927ce6 --- /dev/null +++ b/node_modules/es-toolkit/compat/unset.mjs @@ -0,0 +1 @@ +export { unset as default } from '../dist/compat/object/unset.mjs'; diff --git a/node_modules/es-toolkit/compat/unzip.d.mts b/node_modules/es-toolkit/compat/unzip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5e17d898e30694362f84363b08a51ac3bdd428ac --- /dev/null +++ b/node_modules/es-toolkit/compat/unzip.d.mts @@ -0,0 +1 @@ +export { unzip as default } from '../dist/compat/array/unzip.mjs'; 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/unzip.mjs b/node_modules/es-toolkit/compat/unzip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5e17d898e30694362f84363b08a51ac3bdd428ac --- /dev/null +++ b/node_modules/es-toolkit/compat/unzip.mjs @@ -0,0 +1 @@ +export { unzip as default } from '../dist/compat/array/unzip.mjs'; diff --git a/node_modules/es-toolkit/compat/unzipWith.d.mts b/node_modules/es-toolkit/compat/unzipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7cc8790df32f6f22bad72dc7fe9dcd15eb8057b7 --- /dev/null +++ b/node_modules/es-toolkit/compat/unzipWith.d.mts @@ -0,0 +1 @@ +export { unzipWith as default } from '../dist/compat/array/unzipWith.mjs'; 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/unzipWith.mjs b/node_modules/es-toolkit/compat/unzipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7cc8790df32f6f22bad72dc7fe9dcd15eb8057b7 --- /dev/null +++ b/node_modules/es-toolkit/compat/unzipWith.mjs @@ -0,0 +1 @@ +export { unzipWith as default } from '../dist/compat/array/unzipWith.mjs'; diff --git a/node_modules/es-toolkit/compat/update.d.mts b/node_modules/es-toolkit/compat/update.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b94f89e3002fe8073cff34b9e4673eb8fa9c96e7 --- /dev/null +++ b/node_modules/es-toolkit/compat/update.d.mts @@ -0,0 +1 @@ +export { update as default } from '../dist/compat/object/update.mjs'; 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/update.mjs b/node_modules/es-toolkit/compat/update.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b94f89e3002fe8073cff34b9e4673eb8fa9c96e7 --- /dev/null +++ b/node_modules/es-toolkit/compat/update.mjs @@ -0,0 +1 @@ +export { update as default } from '../dist/compat/object/update.mjs'; diff --git a/node_modules/es-toolkit/compat/updateWith.d.mts b/node_modules/es-toolkit/compat/updateWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0c733fedb9afcfe5b9e720162aceceafc707ad37 --- /dev/null +++ b/node_modules/es-toolkit/compat/updateWith.d.mts @@ -0,0 +1 @@ +export { updateWith as default } from '../dist/compat/object/updateWith.mjs'; 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/updateWith.mjs b/node_modules/es-toolkit/compat/updateWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0c733fedb9afcfe5b9e720162aceceafc707ad37 --- /dev/null +++ b/node_modules/es-toolkit/compat/updateWith.mjs @@ -0,0 +1 @@ +export { updateWith as default } from '../dist/compat/object/updateWith.mjs'; diff --git a/node_modules/es-toolkit/compat/upperCase.d.mts b/node_modules/es-toolkit/compat/upperCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5436386dc1ce1e0651ad74df3fe77c7715038504 --- /dev/null +++ b/node_modules/es-toolkit/compat/upperCase.d.mts @@ -0,0 +1 @@ +export { upperCase as default } from '../dist/compat/string/upperCase.mjs'; 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/upperCase.mjs b/node_modules/es-toolkit/compat/upperCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5436386dc1ce1e0651ad74df3fe77c7715038504 --- /dev/null +++ b/node_modules/es-toolkit/compat/upperCase.mjs @@ -0,0 +1 @@ +export { upperCase as default } from '../dist/compat/string/upperCase.mjs'; diff --git a/node_modules/es-toolkit/compat/upperFirst.d.mts b/node_modules/es-toolkit/compat/upperFirst.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f6d0f6bb27a66c30694e4b85133118decce5e963 --- /dev/null +++ b/node_modules/es-toolkit/compat/upperFirst.d.mts @@ -0,0 +1 @@ +export { upperFirst as default } from '../dist/compat/string/upperFirst.mjs'; 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/upperFirst.mjs b/node_modules/es-toolkit/compat/upperFirst.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f6d0f6bb27a66c30694e4b85133118decce5e963 --- /dev/null +++ b/node_modules/es-toolkit/compat/upperFirst.mjs @@ -0,0 +1 @@ +export { upperFirst as default } from '../dist/compat/string/upperFirst.mjs'; diff --git a/node_modules/es-toolkit/compat/values.d.mts b/node_modules/es-toolkit/compat/values.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5bc3de9199b23f00bb76b78407997a371071a513 --- /dev/null +++ b/node_modules/es-toolkit/compat/values.d.mts @@ -0,0 +1 @@ +export { values as default } from '../dist/compat/object/values.mjs'; 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/values.mjs b/node_modules/es-toolkit/compat/values.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5bc3de9199b23f00bb76b78407997a371071a513 --- /dev/null +++ b/node_modules/es-toolkit/compat/values.mjs @@ -0,0 +1 @@ +export { values as default } from '../dist/compat/object/values.mjs'; diff --git a/node_modules/es-toolkit/compat/valuesIn.d.mts b/node_modules/es-toolkit/compat/valuesIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d4ba774d6be9e27b9d23f90bfff905678e971b59 --- /dev/null +++ b/node_modules/es-toolkit/compat/valuesIn.d.mts @@ -0,0 +1 @@ +export { valuesIn as default } from '../dist/compat/object/valuesIn.mjs'; 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/valuesIn.mjs b/node_modules/es-toolkit/compat/valuesIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d4ba774d6be9e27b9d23f90bfff905678e971b59 --- /dev/null +++ b/node_modules/es-toolkit/compat/valuesIn.mjs @@ -0,0 +1 @@ +export { valuesIn as default } from '../dist/compat/object/valuesIn.mjs'; diff --git a/node_modules/es-toolkit/compat/without.d.mts b/node_modules/es-toolkit/compat/without.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b65b017e6ccad09a9db20113b37440cc5a4a5785 --- /dev/null +++ b/node_modules/es-toolkit/compat/without.d.mts @@ -0,0 +1 @@ +export { without as default } from '../dist/compat/array/without.mjs'; 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/without.mjs b/node_modules/es-toolkit/compat/without.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b65b017e6ccad09a9db20113b37440cc5a4a5785 --- /dev/null +++ b/node_modules/es-toolkit/compat/without.mjs @@ -0,0 +1 @@ +export { without as default } from '../dist/compat/array/without.mjs'; diff --git a/node_modules/es-toolkit/compat/words.d.mts b/node_modules/es-toolkit/compat/words.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a6b7e5f0e6648852189eb0df218c4f556abe2258 --- /dev/null +++ b/node_modules/es-toolkit/compat/words.d.mts @@ -0,0 +1 @@ +export { words as default } from '../dist/compat/string/words.mjs'; 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/words.mjs b/node_modules/es-toolkit/compat/words.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a6b7e5f0e6648852189eb0df218c4f556abe2258 --- /dev/null +++ b/node_modules/es-toolkit/compat/words.mjs @@ -0,0 +1 @@ +export { words as default } from '../dist/compat/string/words.mjs'; diff --git a/node_modules/es-toolkit/compat/wrap.d.mts b/node_modules/es-toolkit/compat/wrap.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..01d07e3361d2d5dd1e9cc1d1328f8431a5ce8e6a --- /dev/null +++ b/node_modules/es-toolkit/compat/wrap.d.mts @@ -0,0 +1 @@ +export { wrap as default } from '../dist/compat/function/wrap.mjs'; 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/wrap.mjs b/node_modules/es-toolkit/compat/wrap.mjs new file mode 100644 index 0000000000000000000000000000000000000000..01d07e3361d2d5dd1e9cc1d1328f8431a5ce8e6a --- /dev/null +++ b/node_modules/es-toolkit/compat/wrap.mjs @@ -0,0 +1 @@ +export { wrap as default } from '../dist/compat/function/wrap.mjs'; diff --git a/node_modules/es-toolkit/compat/xor.d.mts b/node_modules/es-toolkit/compat/xor.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c720d81f2521a6901d93cf403367152e22be7de5 --- /dev/null +++ b/node_modules/es-toolkit/compat/xor.d.mts @@ -0,0 +1 @@ +export { xor as default } from '../dist/compat/array/xor.mjs'; 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/xor.mjs b/node_modules/es-toolkit/compat/xor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c720d81f2521a6901d93cf403367152e22be7de5 --- /dev/null +++ b/node_modules/es-toolkit/compat/xor.mjs @@ -0,0 +1 @@ +export { xor as default } from '../dist/compat/array/xor.mjs'; diff --git a/node_modules/es-toolkit/compat/xorBy.d.mts b/node_modules/es-toolkit/compat/xorBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e34894ece8a8af56f763b1cb59b429d69e09e2c6 --- /dev/null +++ b/node_modules/es-toolkit/compat/xorBy.d.mts @@ -0,0 +1 @@ +export { xorBy as default } from '../dist/compat/array/xorBy.mjs'; 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/xorBy.mjs b/node_modules/es-toolkit/compat/xorBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e34894ece8a8af56f763b1cb59b429d69e09e2c6 --- /dev/null +++ b/node_modules/es-toolkit/compat/xorBy.mjs @@ -0,0 +1 @@ +export { xorBy as default } from '../dist/compat/array/xorBy.mjs'; diff --git a/node_modules/es-toolkit/compat/xorWith.d.mts b/node_modules/es-toolkit/compat/xorWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b848d2fa841eb2681ee5a3e3f64d82175c335b8b --- /dev/null +++ b/node_modules/es-toolkit/compat/xorWith.d.mts @@ -0,0 +1 @@ +export { xorWith as default } from '../dist/compat/array/xorWith.mjs'; 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/xorWith.mjs b/node_modules/es-toolkit/compat/xorWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b848d2fa841eb2681ee5a3e3f64d82175c335b8b --- /dev/null +++ b/node_modules/es-toolkit/compat/xorWith.mjs @@ -0,0 +1 @@ +export { xorWith as default } from '../dist/compat/array/xorWith.mjs'; diff --git a/node_modules/es-toolkit/compat/zip.d.mts b/node_modules/es-toolkit/compat/zip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..89d1065b72bbad564f1e8fcb0facf9cdd48f1757 --- /dev/null +++ b/node_modules/es-toolkit/compat/zip.d.mts @@ -0,0 +1 @@ +export { zip as default } from '../dist/compat/array/zip.mjs'; 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/zip.mjs b/node_modules/es-toolkit/compat/zip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..89d1065b72bbad564f1e8fcb0facf9cdd48f1757 --- /dev/null +++ b/node_modules/es-toolkit/compat/zip.mjs @@ -0,0 +1 @@ +export { zip as default } from '../dist/compat/array/zip.mjs'; diff --git a/node_modules/es-toolkit/compat/zipObject.d.mts b/node_modules/es-toolkit/compat/zipObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6b5a4a41c07349716a452ccfec9d6717572e1da3 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObject.d.mts @@ -0,0 +1 @@ +export { zipObject as default } from '../dist/compat/array/zipObject.mjs'; 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/zipObject.mjs b/node_modules/es-toolkit/compat/zipObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6b5a4a41c07349716a452ccfec9d6717572e1da3 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObject.mjs @@ -0,0 +1 @@ +export { zipObject as default } from '../dist/compat/array/zipObject.mjs'; diff --git a/node_modules/es-toolkit/compat/zipObjectDeep.d.mts b/node_modules/es-toolkit/compat/zipObjectDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..948cd560fe46c1638c574fb93f835a9f4ecdfe86 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObjectDeep.d.mts @@ -0,0 +1 @@ +export { zipObjectDeep as default } from '../dist/compat/array/zipObjectDeep.mjs'; 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/zipObjectDeep.mjs b/node_modules/es-toolkit/compat/zipObjectDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..948cd560fe46c1638c574fb93f835a9f4ecdfe86 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipObjectDeep.mjs @@ -0,0 +1 @@ +export { zipObjectDeep as default } from '../dist/compat/array/zipObjectDeep.mjs'; diff --git a/node_modules/es-toolkit/compat/zipWith.d.mts b/node_modules/es-toolkit/compat/zipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c4cb71dc7443ef05747038904a1c53a4d504b6d8 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipWith.d.mts @@ -0,0 +1 @@ +export { zipWith as default } from '../dist/compat/array/zipWith.mjs'; 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/compat/zipWith.mjs b/node_modules/es-toolkit/compat/zipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c4cb71dc7443ef05747038904a1c53a4d504b6d8 --- /dev/null +++ b/node_modules/es-toolkit/compat/zipWith.mjs @@ -0,0 +1 @@ +export { zipWith as default } from '../dist/compat/array/zipWith.mjs'; diff --git a/node_modules/es-toolkit/dist/_internal/DOMException.d.mts b/node_modules/es-toolkit/dist/_internal/DOMException.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..aa524046c8f207f887f80297839f1a23426cba4c --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/DOMException.d.mts @@ -0,0 +1,6 @@ +import { globalThis_ } from "./globalThis.mjs"; + +//#region src/_internal/DOMException.d.ts +declare const DOMException: typeof globalThis_.DOMException; +//#endregion +export { DOMException }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/_internal/DOMException.d.ts b/node_modules/es-toolkit/dist/_internal/DOMException.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a0d4b5b6a39c9792595a49c3b97a411e07d939f --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/DOMException.d.ts @@ -0,0 +1,6 @@ +import { globalThis_ } from "./globalThis.js"; + +//#region src/_internal/DOMException.d.ts +declare const DOMException: typeof globalThis_.DOMException; +//#endregion +export { DOMException }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/_internal/DOMException.js b/node_modules/es-toolkit/dist/_internal/DOMException.js new file mode 100644 index 0000000000000000000000000000000000000000..220ae8f1a414924ae4b86360b320ea53e91646b5 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/DOMException.js @@ -0,0 +1,5 @@ +const require_globalThis = require("./globalThis.js"); +//#region src/_internal/DOMException.ts +const DOMException = typeof require_globalThis.globalThis_.DOMException !== "undefined" ? require_globalThis.globalThis_.DOMException : Error; +//#endregion +exports.DOMException = DOMException; diff --git a/node_modules/es-toolkit/dist/_internal/DOMException.mjs b/node_modules/es-toolkit/dist/_internal/DOMException.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2593fcd8c3eb0448ae65147aeb69929b776dd749 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/DOMException.mjs @@ -0,0 +1,5 @@ +import { globalThis_ } from "./globalThis.mjs"; +//#region src/_internal/DOMException.ts +const DOMException = typeof globalThis_.DOMException !== "undefined" ? globalThis_.DOMException : Error; +//#endregion +export { DOMException }; 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..3086d077779c8bf929f1a8b6a14b3ad3863098d6 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/compareValues.js @@ -0,0 +1,21 @@ +//#region src/_internal/compareValues.ts +function nullishRank(value) { + if (value === null) return 1; + if (value === void 0) return 2; + return 0; +} +function compareAscending(a, b) { + const aRank = nullishRank(a); + const bRank = nullishRank(b); + if (aRank < bRank) return -1; + if (aRank > bRank) return 1; + if (aRank !== 0) return 0; + if (a < b) return -1; + if (a > b) return 1; + return 0; +} +function compareValues(a, b, order) { + return order === "asc" ? compareAscending(a, b) : compareAscending(b, a); +} +//#endregion +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..c2ef7844d8a7259f5f61e30451b3c9e07ba80cab --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/compareValues.mjs @@ -0,0 +1,21 @@ +//#region src/_internal/compareValues.ts +function nullishRank(value) { + if (value === null) return 1; + if (value === void 0) return 2; + return 0; +} +function compareAscending(a, b) { + const aRank = nullishRank(a); + const bRank = nullishRank(b); + if (aRank < bRank) return -1; + if (aRank > bRank) return 1; + if (aRank !== 0) return 0; + if (a < b) return -1; + if (a > b) return 1; + return 0; +} +function compareValues(a, b, order) { + return order === "asc" ? compareAscending(a, b) : compareAscending(b, a); +} +//#endregion +export { compareValues }; diff --git a/node_modules/es-toolkit/dist/_internal/globalThis.d.mts b/node_modules/es-toolkit/dist/_internal/globalThis.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b974fc12957113c4759a6bd7398e273734750eef --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/globalThis.d.mts @@ -0,0 +1,4 @@ +//#region src/_internal/globalThis.d.ts +declare const globalThis_: typeof globalThis; +//#endregion +export { globalThis_ }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/_internal/globalThis.d.ts b/node_modules/es-toolkit/dist/_internal/globalThis.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b974fc12957113c4759a6bd7398e273734750eef --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/globalThis.d.ts @@ -0,0 +1,4 @@ +//#region src/_internal/globalThis.d.ts +declare const globalThis_: typeof globalThis; +//#endregion +export { globalThis_ }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/_internal/globalThis.js b/node_modules/es-toolkit/dist/_internal/globalThis.js new file mode 100644 index 0000000000000000000000000000000000000000..9c2ec0d7c44df5019c023ba4332e18d57bbc8047 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/globalThis.js @@ -0,0 +1,6 @@ +//#region src/_internal/globalThis.ts +const globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() { + return this; +})(); +//#endregion +exports.globalThis_ = globalThis_; diff --git a/node_modules/es-toolkit/dist/_internal/globalThis.mjs b/node_modules/es-toolkit/dist/_internal/globalThis.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c7e035a012f87f49d9ce24070d1405fd09299aaf --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/globalThis.mjs @@ -0,0 +1,6 @@ +//#region src/_internal/globalThis.ts +const globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() { + return this; +})(); +//#endregion +export { globalThis_ }; 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..8c0a8ed2a47651734061912566139817806802e8 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js @@ -0,0 +1,16 @@ +//#region src/_internal/isUnsafeProperty.ts +/** +* Checks if a property key is unsafe to modify directly. +* +* This function is used in functions like `merge` to prevent prototype pollution attacks +* by identifying property keys that could modify the object's prototype chain or constructor. +* +* @param key - The property key to check +* @returns `true` if the property is unsafe to modify directly, `false` otherwise +* @internal +*/ +function isUnsafeProperty(key) { + return key === "__proto__"; +} +//#endregion +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..a761df30aef3c299ac91e70e7d7e4507ca510f36 --- /dev/null +++ b/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs @@ -0,0 +1,16 @@ +//#region src/_internal/isUnsafeProperty.ts +/** +* Checks if a property key is unsafe to modify directly. +* +* This function is used in functions like `merge` to prevent prototype pollution attacks +* by identifying property keys that could modify the object's prototype chain or constructor. +* +* @param key - The property key to check +* @returns `true` if the property is unsafe to modify directly, `false` otherwise +* @internal +*/ +function isUnsafeProperty(key) { + return key === "__proto__"; +} +//#endregion +export { isUnsafeProperty }; diff --git a/node_modules/es-toolkit/dist/_virtual/_rolldown/runtime.js b/node_modules/es-toolkit/dist/_virtual/_rolldown/runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..a78d9b85d4e925b0db18432fba8d0de5f9faf760 --- /dev/null +++ b/node_modules/es-toolkit/dist/_virtual/_rolldown/runtime.js @@ -0,0 +1,13 @@ +//#region \0rolldown/runtime.js +var __defProp = Object.defineProperty; +var __exportAll = (all, no_symbols) => { + let target = {}; + for (var name in all) __defProp(target, name, { + get: all[name], + enumerable: true + }); + if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" }); + return target; +}; +//#endregion +exports.__exportAll = __exportAll; diff --git a/node_modules/es-toolkit/dist/_virtual/_rolldown/runtime.mjs b/node_modules/es-toolkit/dist/_virtual/_rolldown/runtime.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d326bb2aaeb936d75a18893ce27b9eaddb8002f9 --- /dev/null +++ b/node_modules/es-toolkit/dist/_virtual/_rolldown/runtime.mjs @@ -0,0 +1,13 @@ +//#region \0rolldown/runtime.js +var __defProp = Object.defineProperty; +var __exportAll = (all, no_symbols) => { + let target = {}; + for (var name in all) __defProp(target, name, { + get: all[name], + enumerable: true + }); + if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" }); + return target; +}; +//#endregion +export { __exportAll }; 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..647a7e11a5b08f10e9de713053df88710f1b1e44 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.d.mts @@ -0,0 +1,19 @@ +//#region src/array/at.d.ts +/** + * 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 arr - The array to retrieve elements from. + * @param indices - An array of indices specifying the positions of elements to retrieve. + * @returns 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[]; +//#endregion +export { at }; \ No newline at end of file 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..647a7e11a5b08f10e9de713053df88710f1b1e44 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.d.ts @@ -0,0 +1,19 @@ +//#region src/array/at.d.ts +/** + * 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 arr - The array to retrieve elements from. + * @param indices - An array of indices specifying the positions of elements to retrieve. + * @returns 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[]; +//#endregion +export { at }; \ No newline at end of file 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..ecbe5aff7b6a54148fe8c5af7cd9194fc254d168 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.js @@ -0,0 +1,29 @@ +//#region src/array/at.ts +/** +* 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 arr - The array to retrieve elements from. +* @param indices - An array of indices specifying the positions of elements to retrieve. +* @returns 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] +*/ +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; +} +//#endregion +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..6b8fd4fabb496fd6c22fd1422b000f55c9f8d32a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/at.mjs @@ -0,0 +1,29 @@ +//#region src/array/at.ts +/** +* 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 arr - The array to retrieve elements from. +* @param indices - An array of indices specifying the positions of elements to retrieve. +* @returns 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] +*/ +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; +} +//#endregion +export { at }; diff --git a/node_modules/es-toolkit/dist/array/cartesianProduct.d.mts b/node_modules/es-toolkit/dist/array/cartesianProduct.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..838f3f8d25b8de1c0da3aea5977f78ead35aa732 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/cartesianProduct.d.mts @@ -0,0 +1,75 @@ +//#region src/array/cartesianProduct.d.ts +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T + * @param arr1 - The array to take the product of. + * @returns An array of single-element tuples. + */ +declare function cartesianProduct(arr1: readonly T[]): Array<[T]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T, U + * @param arr1 - The first array to take the product of. + * @param arr2 - The second array to take the product of. + * @returns An array of tuples representing the Cartesian product. + * + * @example + * cartesianProduct([1, 2], ['a', 'b']); + * // => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + */ +declare function cartesianProduct(arr1: readonly T[], arr2: readonly U[]): Array<[T, U]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T, U, V + * @param arr1 - The first array to take the product of. + * @param arr2 - The second array to take the product of. + * @param arr3 - The third array to take the product of. + * @returns An array of tuples representing the Cartesian product. + */ +declare function cartesianProduct(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[]): Array<[T, U, V]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T, U, V, W + * @param arr1 - The first array to take the product of. + * @param arr2 - The second array to take the product of. + * @param arr3 - The third array to take the product of. + * @param arr4 - The fourth array to take the product of. + * @returns An array of tuples representing the Cartesian product. + */ +declare function cartesianProduct(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[]): Array<[T, U, V, W]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * Returns every possible tuple formed by picking one element from each input array, in lexicographic order. + * The rightmost array advances fastest, like the digits of an odometer. + * + * If no arrays are passed, the result is `[[]]` (a single empty tuple). + * If any input array is empty, the result is `[]`. + * + * @template T + * @param arrs - The arrays to take the product of. + * @returns An array of tuples representing the Cartesian product. + * + * @example + * cartesianProduct([1, 2], ['a', 'b']); + * // => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + * + * @example + * cartesianProduct([0, 1], [0, 1], [0, 1]); + * // => [[0,0,0], [0,0,1], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,0], [1,1,1]] + * + * @example + * cartesianProduct([1, 2, 3], []); + * // => [] + * + * @example + * cartesianProduct(); + * // => [[]] + */ +declare function cartesianProduct(...arrs: Array): T[][]; +//#endregion +export { cartesianProduct }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/array/cartesianProduct.d.ts b/node_modules/es-toolkit/dist/array/cartesianProduct.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..838f3f8d25b8de1c0da3aea5977f78ead35aa732 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/cartesianProduct.d.ts @@ -0,0 +1,75 @@ +//#region src/array/cartesianProduct.d.ts +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T + * @param arr1 - The array to take the product of. + * @returns An array of single-element tuples. + */ +declare function cartesianProduct(arr1: readonly T[]): Array<[T]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T, U + * @param arr1 - The first array to take the product of. + * @param arr2 - The second array to take the product of. + * @returns An array of tuples representing the Cartesian product. + * + * @example + * cartesianProduct([1, 2], ['a', 'b']); + * // => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + */ +declare function cartesianProduct(arr1: readonly T[], arr2: readonly U[]): Array<[T, U]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T, U, V + * @param arr1 - The first array to take the product of. + * @param arr2 - The second array to take the product of. + * @param arr3 - The third array to take the product of. + * @returns An array of tuples representing the Cartesian product. + */ +declare function cartesianProduct(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[]): Array<[T, U, V]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * @template T, U, V, W + * @param arr1 - The first array to take the product of. + * @param arr2 - The second array to take the product of. + * @param arr3 - The third array to take the product of. + * @param arr4 - The fourth array to take the product of. + * @returns An array of tuples representing the Cartesian product. + */ +declare function cartesianProduct(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[]): Array<[T, U, V, W]>; +/** + * Computes the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the input arrays. + * + * Returns every possible tuple formed by picking one element from each input array, in lexicographic order. + * The rightmost array advances fastest, like the digits of an odometer. + * + * If no arrays are passed, the result is `[[]]` (a single empty tuple). + * If any input array is empty, the result is `[]`. + * + * @template T + * @param arrs - The arrays to take the product of. + * @returns An array of tuples representing the Cartesian product. + * + * @example + * cartesianProduct([1, 2], ['a', 'b']); + * // => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + * + * @example + * cartesianProduct([0, 1], [0, 1], [0, 1]); + * // => [[0,0,0], [0,0,1], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,0], [1,1,1]] + * + * @example + * cartesianProduct([1, 2, 3], []); + * // => [] + * + * @example + * cartesianProduct(); + * // => [[]] + */ +declare function cartesianProduct(...arrs: Array): T[][]; +//#endregion +export { cartesianProduct }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/array/cartesianProduct.js b/node_modules/es-toolkit/dist/array/cartesianProduct.js new file mode 100644 index 0000000000000000000000000000000000000000..9c12be0d2aa1a8e8028593386b66a363660273f8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/cartesianProduct.js @@ -0,0 +1,23 @@ +//#region src/array/cartesianProduct.ts +function cartesianProduct(...arrs) { + if (arrs.length === 0) return [[]]; + let total = 1; + for (let i = 0; i < arrs.length; i++) total *= arrs[i].length; + if (total === 0) return []; + const n = arrs.length; + const result = Array(total); + for (let i = 0; i < total; i++) { + const tuple = Array(n); + let idx = i; + for (let j = n - 1; j >= 0; j--) { + const arr = arrs[j]; + const len = arr.length; + tuple[j] = arr[idx % len]; + idx = Math.floor(idx / len); + } + result[i] = tuple; + } + return result; +} +//#endregion +exports.cartesianProduct = cartesianProduct; diff --git a/node_modules/es-toolkit/dist/array/cartesianProduct.mjs b/node_modules/es-toolkit/dist/array/cartesianProduct.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1b4fc6b9a45b88f46c21020a4704cdb1bc97185f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/cartesianProduct.mjs @@ -0,0 +1,23 @@ +//#region src/array/cartesianProduct.ts +function cartesianProduct(...arrs) { + if (arrs.length === 0) return [[]]; + let total = 1; + for (let i = 0; i < arrs.length; i++) total *= arrs[i].length; + if (total === 0) return []; + const n = arrs.length; + const result = Array(total); + for (let i = 0; i < total; i++) { + const tuple = Array(n); + let idx = i; + for (let j = n - 1; j >= 0; j--) { + const arr = arrs[j]; + const len = arr.length; + tuple[j] = arr[idx % len]; + idx = Math.floor(idx / len); + } + result[i] = tuple; + } + return result; +} +//#endregion +export { cartesianProduct }; 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..54cdf45fe6be368453a3c6ef77bd0ad57c2f6815 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.d.mts @@ -0,0 +1,27 @@ +//#region src/array/chunk.d.ts +/** + * 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 arr - The array to be chunked into smaller arrays. + * @param size - The size of each smaller array. Must be a positive integer. + * @returns 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[][]; +//#endregion +export { chunk }; \ No newline at end of file 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..54cdf45fe6be368453a3c6ef77bd0ad57c2f6815 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.d.ts @@ -0,0 +1,27 @@ +//#region src/array/chunk.d.ts +/** + * 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 arr - The array to be chunked into smaller arrays. + * @param size - The size of each smaller array. Must be a positive integer. + * @returns 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[][]; +//#endregion +export { chunk }; \ No newline at end of file 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..ce480486056b46380b18b7272d4dca332bf4933e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.js @@ -0,0 +1,37 @@ +//#region src/array/chunk.ts +/** +* 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 arr - The array to be chunked into smaller arrays. +* @param size - The size of each smaller array. Must be a positive integer. +* @returns 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']] +*/ +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; +} +//#endregion +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..d104a2a3ce3575d9d5de43b2fff15de8ec33d966 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunk.mjs @@ -0,0 +1,37 @@ +//#region src/array/chunk.ts +/** +* 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 arr - The array to be chunked into smaller arrays. +* @param size - The size of each smaller array. Must be a positive integer. +* @returns 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']] +*/ +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; +} +//#endregion +export { chunk }; diff --git a/node_modules/es-toolkit/dist/array/chunkBy.d.mts b/node_modules/es-toolkit/dist/array/chunkBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..791a7fecbc63945099b0d3204a35dd28a41e3204 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunkBy.d.mts @@ -0,0 +1,32 @@ +//#region src/array/chunkBy.d.ts +/** + * Splits an array into chunks of consecutive elements that share the same key. + * + * Walking left to right, each element's key is derived by `iteratee`. Whenever + * the key differs from the previous element's key, a new chunk is started; + * otherwise the element is appended to the current chunk. Keys are compared with + * `!==` (strict inequality), so equal primitives stay together while distinct + * object references always start a new chunk. + * + * Unlike {@link chunk}, which splits by a fixed size, `chunkBy` splits by a + * boundary condition, keeping runs of same-keyed elements together. + * + * @template T - The type of elements in the array. + * @param arr - The array to split into chunks. + * @param iteratee - A function that derives the comparison key for each element. + * @returns A two-dimensional array where each sub-array is a run of consecutive + * elements that produced the same key. + * + * @example + * // Group consecutive equal numbers + * chunkBy([1, 1, 2, 3, 3, 3], value => value); + * // Returns: [[1, 1], [2], [3, 3, 3]] + * + * @example + * // Group consecutive words by their length + * chunkBy(['a', 'b', 'cd', 'ef', 'g'], word => word.length); + * // Returns: [['a', 'b'], ['cd', 'ef'], ['g']] + */ +declare function chunkBy(arr: readonly T[], iteratee: (value: T) => unknown): T[][]; +//#endregion +export { chunkBy }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/array/chunkBy.d.ts b/node_modules/es-toolkit/dist/array/chunkBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..791a7fecbc63945099b0d3204a35dd28a41e3204 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunkBy.d.ts @@ -0,0 +1,32 @@ +//#region src/array/chunkBy.d.ts +/** + * Splits an array into chunks of consecutive elements that share the same key. + * + * Walking left to right, each element's key is derived by `iteratee`. Whenever + * the key differs from the previous element's key, a new chunk is started; + * otherwise the element is appended to the current chunk. Keys are compared with + * `!==` (strict inequality), so equal primitives stay together while distinct + * object references always start a new chunk. + * + * Unlike {@link chunk}, which splits by a fixed size, `chunkBy` splits by a + * boundary condition, keeping runs of same-keyed elements together. + * + * @template T - The type of elements in the array. + * @param arr - The array to split into chunks. + * @param iteratee - A function that derives the comparison key for each element. + * @returns A two-dimensional array where each sub-array is a run of consecutive + * elements that produced the same key. + * + * @example + * // Group consecutive equal numbers + * chunkBy([1, 1, 2, 3, 3, 3], value => value); + * // Returns: [[1, 1], [2], [3, 3, 3]] + * + * @example + * // Group consecutive words by their length + * chunkBy(['a', 'b', 'cd', 'ef', 'g'], word => word.length); + * // Returns: [['a', 'b'], ['cd', 'ef'], ['g']] + */ +declare function chunkBy(arr: readonly T[], iteratee: (value: T) => unknown): T[][]; +//#endregion +export { chunkBy }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/array/chunkBy.js b/node_modules/es-toolkit/dist/array/chunkBy.js new file mode 100644 index 0000000000000000000000000000000000000000..ca8191c998961d9c83af226bc081db367674fda0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunkBy.js @@ -0,0 +1,42 @@ +//#region src/array/chunkBy.ts +/** +* Splits an array into chunks of consecutive elements that share the same key. +* +* Walking left to right, each element's key is derived by `iteratee`. Whenever +* the key differs from the previous element's key, a new chunk is started; +* otherwise the element is appended to the current chunk. Keys are compared with +* `!==` (strict inequality), so equal primitives stay together while distinct +* object references always start a new chunk. +* +* Unlike {@link chunk}, which splits by a fixed size, `chunkBy` splits by a +* boundary condition, keeping runs of same-keyed elements together. +* +* @template T - The type of elements in the array. +* @param arr - The array to split into chunks. +* @param iteratee - A function that derives the comparison key for each element. +* @returns A two-dimensional array where each sub-array is a run of consecutive +* elements that produced the same key. +* +* @example +* // Group consecutive equal numbers +* chunkBy([1, 1, 2, 3, 3, 3], value => value); +* // Returns: [[1, 1], [2], [3, 3, 3]] +* +* @example +* // Group consecutive words by their length +* chunkBy(['a', 'b', 'cd', 'ef', 'g'], word => word.length); +* // Returns: [['a', 'b'], ['cd', 'ef'], ['g']] +*/ +function chunkBy(arr, iteratee) { + const result = []; + let prevKey; + for (let i = 0; i < arr.length; i++) { + const key = iteratee(arr[i]); + if (i === 0 || key !== prevKey) result.push([arr[i]]); + else result[result.length - 1].push(arr[i]); + prevKey = key; + } + return result; +} +//#endregion +exports.chunkBy = chunkBy; diff --git a/node_modules/es-toolkit/dist/array/chunkBy.mjs b/node_modules/es-toolkit/dist/array/chunkBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..937433cab0c3ed246f99b0d9e71adbc74dae8224 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/chunkBy.mjs @@ -0,0 +1,42 @@ +//#region src/array/chunkBy.ts +/** +* Splits an array into chunks of consecutive elements that share the same key. +* +* Walking left to right, each element's key is derived by `iteratee`. Whenever +* the key differs from the previous element's key, a new chunk is started; +* otherwise the element is appended to the current chunk. Keys are compared with +* `!==` (strict inequality), so equal primitives stay together while distinct +* object references always start a new chunk. +* +* Unlike {@link chunk}, which splits by a fixed size, `chunkBy` splits by a +* boundary condition, keeping runs of same-keyed elements together. +* +* @template T - The type of elements in the array. +* @param arr - The array to split into chunks. +* @param iteratee - A function that derives the comparison key for each element. +* @returns A two-dimensional array where each sub-array is a run of consecutive +* elements that produced the same key. +* +* @example +* // Group consecutive equal numbers +* chunkBy([1, 1, 2, 3, 3, 3], value => value); +* // Returns: [[1, 1], [2], [3, 3, 3]] +* +* @example +* // Group consecutive words by their length +* chunkBy(['a', 'b', 'cd', 'ef', 'g'], word => word.length); +* // Returns: [['a', 'b'], ['cd', 'ef'], ['g']] +*/ +function chunkBy(arr, iteratee) { + const result = []; + let prevKey; + for (let i = 0; i < arr.length; i++) { + const key = iteratee(arr[i]); + if (i === 0 || key !== prevKey) result.push([arr[i]]); + else result[result.length - 1].push(arr[i]); + prevKey = key; + } + return result; +} +//#endregion +export { chunkBy }; diff --git a/node_modules/es-toolkit/dist/array/combinations.d.mts b/node_modules/es-toolkit/dist/array/combinations.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..05b850562d5765a213594bf9840e135fab46aef4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/combinations.d.mts @@ -0,0 +1,35 @@ +//#region src/array/combinations.d.ts +/** + * Returns all `r`-length combinations of elements from the input array. + * + * Combinations are emitted in lexicographic order based on the position of elements in the input array. + * Elements are treated as unique by position, not by value, so duplicates in the input may produce + * combinations that look identical. + * + * The number of combinations is `n! / r! / (n - r)!` when `0 <= r <= n`, and zero when `r > n`. + * + * @template T + * @param arr - The input array. + * @param r - The length of each combination. Must be a non-negative integer. + * @returns An array of `r`-length combinations. + * @throws {Error} If `r` is not a non-negative integer. + * + * @example + * combinations(['A', 'B', 'C', 'D'], 2); + * // => [['A','B'], ['A','C'], ['A','D'], ['B','C'], ['B','D'], ['C','D']] + * + * @example + * combinations([1, 2, 3, 4], 3); + * // => [[1,2,3], [1,2,4], [1,3,4], [2,3,4]] + * + * @example + * combinations([1, 2, 3], 0); + * // => [[]] + * + * @example + * combinations([1, 2], 5); + * // => [] + */ +declare function combinations(arr: readonly T[], r: number): T[][]; +//#endregion +export { combinations }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/array/combinations.d.ts b/node_modules/es-toolkit/dist/array/combinations.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..05b850562d5765a213594bf9840e135fab46aef4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/combinations.d.ts @@ -0,0 +1,35 @@ +//#region src/array/combinations.d.ts +/** + * Returns all `r`-length combinations of elements from the input array. + * + * Combinations are emitted in lexicographic order based on the position of elements in the input array. + * Elements are treated as unique by position, not by value, so duplicates in the input may produce + * combinations that look identical. + * + * The number of combinations is `n! / r! / (n - r)!` when `0 <= r <= n`, and zero when `r > n`. + * + * @template T + * @param arr - The input array. + * @param r - The length of each combination. Must be a non-negative integer. + * @returns An array of `r`-length combinations. + * @throws {Error} If `r` is not a non-negative integer. + * + * @example + * combinations(['A', 'B', 'C', 'D'], 2); + * // => [['A','B'], ['A','C'], ['A','D'], ['B','C'], ['B','D'], ['C','D']] + * + * @example + * combinations([1, 2, 3, 4], 3); + * // => [[1,2,3], [1,2,4], [1,3,4], [2,3,4]] + * + * @example + * combinations([1, 2, 3], 0); + * // => [[]] + * + * @example + * combinations([1, 2], 5); + * // => [] + */ +declare function combinations(arr: readonly T[], r: number): T[][]; +//#endregion +export { combinations }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/array/combinations.js b/node_modules/es-toolkit/dist/array/combinations.js new file mode 100644 index 0000000000000000000000000000000000000000..66e975fb027005e1d07e631ee523ba7b9fa67952 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/combinations.js @@ -0,0 +1,53 @@ +//#region src/array/combinations.ts +/** +* Returns all `r`-length combinations of elements from the input array. +* +* Combinations are emitted in lexicographic order based on the position of elements in the input array. +* Elements are treated as unique by position, not by value, so duplicates in the input may produce +* combinations that look identical. +* +* The number of combinations is `n! / r! / (n - r)!` when `0 <= r <= n`, and zero when `r > n`. +* +* @template T +* @param arr - The input array. +* @param r - The length of each combination. Must be a non-negative integer. +* @returns An array of `r`-length combinations. +* @throws {Error} If `r` is not a non-negative integer. +* +* @example +* combinations(['A', 'B', 'C', 'D'], 2); +* // => [['A','B'], ['A','C'], ['A','D'], ['B','C'], ['B','D'], ['C','D']] +* +* @example +* combinations([1, 2, 3, 4], 3); +* // => [[1,2,3], [1,2,4], [1,3,4], [2,3,4]] +* +* @example +* combinations([1, 2, 3], 0); +* // => [[]] +* +* @example +* combinations([1, 2], 5); +* // => [] +*/ +function combinations(arr, r) { + if (!Number.isInteger(r) || r < 0) throw new Error("r must be a non-negative integer."); + const n = arr.length; + if (r > n) return []; + if (r === 0) return [[]]; + const indices = Array(r); + for (let i = 0; i < r; i++) indices[i] = i; + const result = []; + while (true) { + const tuple = Array(r); + for (let i = 0; i < r; i++) tuple[i] = arr[indices[i]]; + result.push(tuple); + let i = r - 1; + while (i >= 0 && indices[i] === i + n - r) i--; + if (i < 0) return result; + indices[i]++; + for (let j = i + 1; j < r; j++) indices[j] = indices[j - 1] + 1; + } +} +//#endregion +exports.combinations = combinations; diff --git a/node_modules/es-toolkit/dist/array/combinations.mjs b/node_modules/es-toolkit/dist/array/combinations.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3e4a1010ac63db98b61d7bfd9f385ebb2a27cde0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/combinations.mjs @@ -0,0 +1,53 @@ +//#region src/array/combinations.ts +/** +* Returns all `r`-length combinations of elements from the input array. +* +* Combinations are emitted in lexicographic order based on the position of elements in the input array. +* Elements are treated as unique by position, not by value, so duplicates in the input may produce +* combinations that look identical. +* +* The number of combinations is `n! / r! / (n - r)!` when `0 <= r <= n`, and zero when `r > n`. +* +* @template T +* @param arr - The input array. +* @param r - The length of each combination. Must be a non-negative integer. +* @returns An array of `r`-length combinations. +* @throws {Error} If `r` is not a non-negative integer. +* +* @example +* combinations(['A', 'B', 'C', 'D'], 2); +* // => [['A','B'], ['A','C'], ['A','D'], ['B','C'], ['B','D'], ['C','D']] +* +* @example +* combinations([1, 2, 3, 4], 3); +* // => [[1,2,3], [1,2,4], [1,3,4], [2,3,4]] +* +* @example +* combinations([1, 2, 3], 0); +* // => [[]] +* +* @example +* combinations([1, 2], 5); +* // => [] +*/ +function combinations(arr, r) { + if (!Number.isInteger(r) || r < 0) throw new Error("r must be a non-negative integer."); + const n = arr.length; + if (r > n) return []; + if (r === 0) return [[]]; + const indices = Array(r); + for (let i = 0; i < r; i++) indices[i] = i; + const result = []; + while (true) { + const tuple = Array(r); + for (let i = 0; i < r; i++) tuple[i] = arr[indices[i]]; + result.push(tuple); + let i = r - 1; + while (i >= 0 && indices[i] === i + n - r) i--; + if (i < 0) return result; + indices[i]++; + for (let j = i + 1; j < r; j++) indices[j] = indices[j - 1] + 1; + } +} +//#endregion +export { combinations }; 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..9c7d36333697b7441994c621eb0c29d40faee521 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.d.mts @@ -0,0 +1,16 @@ +//#region src/array/compact.d.ts +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 arr - The input array to remove falsey values. + * @returns 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>; +//#endregion +export { compact }; \ No newline at end of file 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..9c7d36333697b7441994c621eb0c29d40faee521 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.d.ts @@ -0,0 +1,16 @@ +//#region src/array/compact.d.ts +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 arr - The input array to remove falsey values. + * @returns 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>; +//#endregion +export { compact }; \ No newline at end of file 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..62a26e222b4b47e338f8c9ee5031c3352fbe7657 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.js @@ -0,0 +1,22 @@ +//#region src/array/compact.ts +/** +* Removes falsey values (false, null, 0, -0, 0n, '', undefined, NaN) from an array. +* +* @template T - The type of elements in the array. +* @param arr - The input array to remove falsey values. +* @returns 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] +*/ +function compact(arr) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (item) result.push(item); + } + return result; +} +//#endregion +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..a7a2db407dcd8091ed965d0d52e4a1ee7362888d --- /dev/null +++ b/node_modules/es-toolkit/dist/array/compact.mjs @@ -0,0 +1,22 @@ +//#region src/array/compact.ts +/** +* Removes falsey values (false, null, 0, -0, 0n, '', undefined, NaN) from an array. +* +* @template T - The type of elements in the array. +* @param arr - The input array to remove falsey values. +* @returns 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] +*/ +function compact(arr) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (item) result.push(item); + } + return result; +} +//#endregion +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..019bcb2bbf45c3eb91d199ba20a159be5efc0538 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.d.mts @@ -0,0 +1,37 @@ +//#region src/array/countBy.d.ts +/** + * 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 arr - The input array to count occurrences. + * @param mapper - The transformation function that maps each item, its index, and the array to a key. + * @returns 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; +//#endregion +export { countBy }; \ No newline at end of file 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..019bcb2bbf45c3eb91d199ba20a159be5efc0538 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.d.ts @@ -0,0 +1,37 @@ +//#region src/array/countBy.d.ts +/** + * 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 arr - The input array to count occurrences. + * @param mapper - The transformation function that maps each item, its index, and the array to a key. + * @returns 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; +//#endregion +export { countBy }; \ No newline at end of file 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..75fd1af11485bef34e654be2779e63f062979dfd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.js @@ -0,0 +1,45 @@ +//#region src/array/countBy.ts +/** +* 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 arr - The input array to count occurrences. +* @param mapper - The transformation function that maps each item, its index, and the array to a key. +* @returns 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 } +*/ +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; +} +//#endregion +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..9ba962514060085885dc8281c3ae833d35a55ff4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/countBy.mjs @@ -0,0 +1,45 @@ +//#region src/array/countBy.ts +/** +* 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 arr - The input array to count occurrences. +* @param mapper - The transformation function that maps each item, its index, and the array to a key. +* @returns 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 } +*/ +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; +} +//#endregion +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..d545a8f461144abd6f65d75ccf6315bd20417d74 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.d.mts @@ -0,0 +1,26 @@ +//#region src/array/difference.d.ts +/** + * 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 firstArr - The array from which to derive the difference. This is the primary array + * from which elements will be compared and filtered. + * @param 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 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[]; +//#endregion +export { difference }; \ No newline at end of file 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..d545a8f461144abd6f65d75ccf6315bd20417d74 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.d.ts @@ -0,0 +1,26 @@ +//#region src/array/difference.d.ts +/** + * 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 firstArr - The array from which to derive the difference. This is the primary array + * from which elements will be compared and filtered. + * @param 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 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[]; +//#endregion +export { difference }; \ No newline at end of file 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..e5571c17606137449c3d305743adbcf52d714ba5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.js @@ -0,0 +1,29 @@ +//#region src/array/difference.ts +/** +* 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 firstArr - The array from which to derive the difference. This is the primary array +* from which elements will be compared and filtered. +* @param 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 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. +*/ +function difference(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter((item) => !secondSet.has(item)); +} +//#endregion +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..fe72a4694857d8ccf6ffdefda489d75b0c38008a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/difference.mjs @@ -0,0 +1,29 @@ +//#region src/array/difference.ts +/** +* 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 firstArr - The array from which to derive the difference. This is the primary array +* from which elements will be compared and filtered. +* @param 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 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. +*/ +function difference(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter((item) => !secondSet.has(item)); +} +//#endregion +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..b6743d2b1cfeb26e56643bb26ab2dd8c990ab437 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.d.mts @@ -0,0 +1,36 @@ +//#region src/array/differenceBy.d.ts +/** + * 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 firstArr - The primary array from which to derive the difference. + * @param secondArr - The array containing elements to be excluded from the first array. + * @param 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 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[]; +//#endregion +export { differenceBy }; \ No newline at end of file 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..b6743d2b1cfeb26e56643bb26ab2dd8c990ab437 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.d.ts @@ -0,0 +1,36 @@ +//#region src/array/differenceBy.d.ts +/** + * 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 firstArr - The primary array from which to derive the difference. + * @param secondArr - The array containing elements to be excluded from the first array. + * @param 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 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[]; +//#endregion +export { differenceBy }; \ No newline at end of file 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..eef9d58129915c9125e5f73a144966732829ea10 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.js @@ -0,0 +1,41 @@ +//#region src/array/differenceBy.ts +/** +* 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 firstArr - The primary array from which to derive the difference. +* @param secondArr - The array containing elements to be excluded from the first array. +* @param 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 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. +*/ +function differenceBy(firstArr, secondArr, mapper) { + const mappedSecondSet = new Set(secondArr.map((item) => mapper(item))); + return firstArr.filter((item) => { + return !mappedSecondSet.has(mapper(item)); + }); +} +//#endregion +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..14e5667a8dcec22f21d7e863905827d5b54e980e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceBy.mjs @@ -0,0 +1,41 @@ +//#region src/array/differenceBy.ts +/** +* 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 firstArr - The primary array from which to derive the difference. +* @param secondArr - The array containing elements to be excluded from the first array. +* @param 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 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. +*/ +function differenceBy(firstArr, secondArr, mapper) { + const mappedSecondSet = new Set(secondArr.map((item) => mapper(item))); + return firstArr.filter((item) => { + return !mappedSecondSet.has(mapper(item)); + }); +} +//#endregion +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..5b8a2f73e290f75a684708fa0084a6a7cf9cf071 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.d.mts @@ -0,0 +1,32 @@ +//#region src/array/differenceWith.d.ts +/** + * 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 firstArr - The array from which to get the difference. + * @param secondArr - The array containing elements to exclude from the first array. + * @param areItemsEqual - A function to determine if two items are equal. + * @returns 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[]; +//#endregion +export { differenceWith }; \ No newline at end of file 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..5b8a2f73e290f75a684708fa0084a6a7cf9cf071 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.d.ts @@ -0,0 +1,32 @@ +//#region src/array/differenceWith.d.ts +/** + * 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 firstArr - The array from which to get the difference. + * @param secondArr - The array containing elements to exclude from the first array. + * @param areItemsEqual - A function to determine if two items are equal. + * @returns 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[]; +//#endregion +export { differenceWith }; \ No newline at end of file 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..2889c640bc09af903dfdbff290881430c52c3421 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.js @@ -0,0 +1,38 @@ +//#region src/array/differenceWith.ts +/** +* 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 firstArr - The array from which to get the difference. +* @param secondArr - The array containing elements to exclude from the first array. +* @param areItemsEqual - A function to determine if two items are equal. +* @returns 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. +*/ +function differenceWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter((firstItem) => { + return secondArr.every((secondItem) => { + return !areItemsEqual(firstItem, secondItem); + }); + }); +} +//#endregion +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..5a72cf87dd06c54b7668590ba24524372d278ff7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/differenceWith.mjs @@ -0,0 +1,38 @@ +//#region src/array/differenceWith.ts +/** +* 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 firstArr - The array from which to get the difference. +* @param secondArr - The array containing elements to exclude from the first array. +* @param areItemsEqual - A function to determine if two items are equal. +* @returns 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. +*/ +function differenceWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter((firstItem) => { + return secondArr.every((secondItem) => { + return !areItemsEqual(firstItem, secondItem); + }); + }); +} +//#endregion +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..f677e9cced7ac18930cb906bc111d1bf0081310f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.d.mts @@ -0,0 +1,20 @@ +//#region src/array/drop.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the beginning of the array. + * @returns 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[]; +//#endregion +export { drop }; \ No newline at end of file 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..f677e9cced7ac18930cb906bc111d1bf0081310f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.d.ts @@ -0,0 +1,20 @@ +//#region src/array/drop.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the beginning of the array. + * @returns 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[]; +//#endregion +export { drop }; \ No newline at end of file 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..5bb6ee7a2cf6d04bb977b461db90b906433731b3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.js @@ -0,0 +1,23 @@ +//#region src/array/drop.ts +/** +* 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 arr - The array from which to drop elements. +* @param itemsCount - The number of elements to drop from the beginning of the array. +* @returns 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. +*/ +function drop(arr, itemsCount) { + itemsCount = Math.max(itemsCount, 0); + return arr.slice(itemsCount); +} +//#endregion +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..b2bc5f3a70e2bfb457f253c36467d1da5084d66a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/drop.mjs @@ -0,0 +1,23 @@ +//#region src/array/drop.ts +/** +* 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 arr - The array from which to drop elements. +* @param itemsCount - The number of elements to drop from the beginning of the array. +* @returns 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. +*/ +function drop(arr, itemsCount) { + itemsCount = Math.max(itemsCount, 0); + return arr.slice(itemsCount); +} +//#endregion +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..bc11aef50544b009e7d4f65838c3a4b061419a7b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.d.mts @@ -0,0 +1,20 @@ +//#region src/array/dropRight.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the end of the array. + * @returns 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[]; +//#endregion +export { dropRight }; \ No newline at end of file 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..bc11aef50544b009e7d4f65838c3a4b061419a7b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.d.ts @@ -0,0 +1,20 @@ +//#region src/array/dropRight.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the end of the array. + * @returns 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[]; +//#endregion +export { dropRight }; \ No newline at end of file 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..cc74512542289e0bd3440f9ae62b20fb5030d441 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.js @@ -0,0 +1,24 @@ +//#region src/array/dropRight.ts +/** +* 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 arr - The array from which to drop elements. +* @param itemsCount - The number of elements to drop from the end of the array. +* @returns 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. +*/ +function dropRight(arr, itemsCount) { + itemsCount = Math.min(-itemsCount, 0); + if (itemsCount === 0) return arr.slice(); + return arr.slice(0, itemsCount); +} +//#endregion +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..6f779f3779b93e3ba4b2013f140b1d6fd8f6ab68 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRight.mjs @@ -0,0 +1,24 @@ +//#region src/array/dropRight.ts +/** +* 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 arr - The array from which to drop elements. +* @param itemsCount - The number of elements to drop from the end of the array. +* @returns 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. +*/ +function dropRight(arr, itemsCount) { + itemsCount = Math.min(-itemsCount, 0); + if (itemsCount === 0) return arr.slice(); + return arr.slice(0, itemsCount); +} +//#endregion +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..dc68c16e18b6d574421ec1f93dda8be45e330a27 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.d.mts @@ -0,0 +1,22 @@ +//#region src/array/dropRightWhile.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param 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 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[]; +//#endregion +export { dropRightWhile }; \ No newline at end of file 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..dc68c16e18b6d574421ec1f93dda8be45e330a27 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.d.ts @@ -0,0 +1,22 @@ +//#region src/array/dropRightWhile.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param 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 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[]; +//#endregion +export { dropRightWhile }; \ No newline at end of file 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..1d2e82940f77557a0409c7e2615c1b3d1f57d228 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.js @@ -0,0 +1,25 @@ +//#region src/array/dropRightWhile.ts +/** +* 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 arr - The array from which to drop elements. +* @param 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 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. +*/ +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 []; +} +//#endregion +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..9d947c72912d76ac2ffeb64419c8cc23ba574699 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropRightWhile.mjs @@ -0,0 +1,25 @@ +//#region src/array/dropRightWhile.ts +/** +* 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 arr - The array from which to drop elements. +* @param 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 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. +*/ +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 []; +} +//#endregion +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..2cf9b2b26eeb97215ec943ea9d27fb8295009d19 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.d.mts @@ -0,0 +1,22 @@ +//#region src/array/dropWhile.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param 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 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[]; +//#endregion +export { dropWhile }; \ No newline at end of file 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..2cf9b2b26eeb97215ec943ea9d27fb8295009d19 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.d.ts @@ -0,0 +1,22 @@ +//#region src/array/dropWhile.d.ts +/** + * 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 arr - The array from which to drop elements. + * @param 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 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[]; +//#endregion +export { dropWhile }; \ No newline at end of file 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..bbf9795bbee23ca84d7fc4c68a73eb5194c4cc1b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.js @@ -0,0 +1,26 @@ +//#region src/array/dropWhile.ts +/** +* 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 arr - The array from which to drop elements. +* @param 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 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. +*/ +function dropWhile(arr, canContinueDropping) { + const dropEndIndex = arr.findIndex((item, index, arr) => !canContinueDropping(item, index, arr)); + if (dropEndIndex === -1) return []; + return arr.slice(dropEndIndex); +} +//#endregion +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..20248822bb4218e3d1a3d977f7d9c57ecd357941 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/dropWhile.mjs @@ -0,0 +1,26 @@ +//#region src/array/dropWhile.ts +/** +* 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 arr - The array from which to drop elements. +* @param 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 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. +*/ +function dropWhile(arr, canContinueDropping) { + const dropEndIndex = arr.findIndex((item, index, arr) => !canContinueDropping(item, index, arr)); + if (dropEndIndex === -1) return []; + return arr.slice(dropEndIndex); +} +//#endregion +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..6e861027f0dc30cdde819d6b1b203715b966c104 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.d.mts @@ -0,0 +1,86 @@ +//#region src/array/fill.d.ts +/** + * 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 array - The array to fill. + * @param value - The value to fill the array with. + * @returns The array with the filled values. + * + * @example + * fill([1, 2, 3], 'a'); + * // => ['a', 'a', 'a'] + * + * fill(Array(3), 2); + * // => [2, 2, 2] + * + * fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * fill([1, 2, 3], '*', -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 - The array to fill. + * @param value - The value to fill the array with. + * @param [start=0] - The start position. Defaults to 0. + * @returns The array with the filled values. + * + * @example + * fill([1, 2, 3], 'a'); + * // => ['a', 'a', 'a'] + * + * fill(Array(3), 2); + * // => [2, 2, 2] + * + * fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * fill([1, 2, 3], '*', -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 - The array to fill. + * @param value - The value to fill the array with. + * @param [start=0] - The start position. Defaults to 0. + * @param [end=arr.length] - The end position. Defaults to the array's length. + * @returns The array with the filled values. + * + * @example + * fill([1, 2, 3], 'a'); + * // => ['a', 'a', 'a'] + * + * fill(Array(3), 2); + * // => [2, 2, 2] + * + * fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * fill([1, 2, 3], '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: Array, value: U, start: number, end: number): Array; +//#endregion +export { fill }; \ No newline at end of file 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..6e861027f0dc30cdde819d6b1b203715b966c104 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.d.ts @@ -0,0 +1,86 @@ +//#region src/array/fill.d.ts +/** + * 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 array - The array to fill. + * @param value - The value to fill the array with. + * @returns The array with the filled values. + * + * @example + * fill([1, 2, 3], 'a'); + * // => ['a', 'a', 'a'] + * + * fill(Array(3), 2); + * // => [2, 2, 2] + * + * fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * fill([1, 2, 3], '*', -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 - The array to fill. + * @param value - The value to fill the array with. + * @param [start=0] - The start position. Defaults to 0. + * @returns The array with the filled values. + * + * @example + * fill([1, 2, 3], 'a'); + * // => ['a', 'a', 'a'] + * + * fill(Array(3), 2); + * // => [2, 2, 2] + * + * fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * fill([1, 2, 3], '*', -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 - The array to fill. + * @param value - The value to fill the array with. + * @param [start=0] - The start position. Defaults to 0. + * @param [end=arr.length] - The end position. Defaults to the array's length. + * @returns The array with the filled values. + * + * @example + * fill([1, 2, 3], 'a'); + * // => ['a', 'a', 'a'] + * + * fill(Array(3), 2); + * // => [2, 2, 2] + * + * fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + * + * fill([1, 2, 3], '*', -2, -1); + * // => [1, '*', 3] + */ +declare function fill(array: Array, value: U, start: number, end: number): Array; +//#endregion +export { fill }; \ No newline at end of file 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..50f1be951aac99ae6227d1b56093111717ddb826 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.js @@ -0,0 +1,38 @@ +//#region src/array/fill.ts +/** +* 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 - The array to fill. +* @param value - The value to fill the array with. +* @param [start=0] - The start position. Defaults to 0. +* @param [end=arr.length] - The end position. Defaults to the array's length. +* @returns The array with the filled values. +* +* @example +* fill([1, 2, 3], 'a'); +* // => ['a', 'a', 'a'] +* +* fill(Array(3), 2); +* // => [2, 2, 2] +* +* fill([4, 6, 8, 10], '*', 1, 3); +* // => [4, '*', '*', 10] +* +* fill([1, 2, 3], '*', -2, -1); +* // => [1, '*', 3] +*/ +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; +} +//#endregion +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..bcfdde68abd4f6086c3792da75c08239ae898a09 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/fill.mjs @@ -0,0 +1,38 @@ +//#region src/array/fill.ts +/** +* 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 - The array to fill. +* @param value - The value to fill the array with. +* @param [start=0] - The start position. Defaults to 0. +* @param [end=arr.length] - The end position. Defaults to the array's length. +* @returns The array with the filled values. +* +* @example +* fill([1, 2, 3], 'a'); +* // => ['a', 'a', 'a'] +* +* fill(Array(3), 2); +* // => [2, 2, 2] +* +* fill([4, 6, 8, 10], '*', 1, 3); +* // => [4, '*', '*', 10] +* +* fill([1, 2, 3], '*', -2, -1); +* // => [1, '*', 3] +*/ +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; +} +//#endregion +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..bb271eb86e9dfd73ba2c0c1c9dd31bb50c8e3760 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.d.mts @@ -0,0 +1,36 @@ +//#region src/array/filterAsync.d.ts +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 array The array to filter. + * @param predicate An async function that tests each element. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { filterAsync }; \ No newline at end of file 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..bb271eb86e9dfd73ba2c0c1c9dd31bb50c8e3760 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.d.ts @@ -0,0 +1,36 @@ +//#region src/array/filterAsync.d.ts +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 array The array to filter. + * @param predicate An async function that tests each element. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { filterAsync }; \ No newline at end of file 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..0a993e32d655385b03bbc7815710fd79b57964f6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.js @@ -0,0 +1,38 @@ +const require_limitAsync = require("./limitAsync.js"); +//#region src/array/filterAsync.ts +/** +* 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 array The array to filter. +* @param predicate An async function that tests each element. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +async function filterAsync(array, predicate, options) { + if (options?.concurrency != null) predicate = require_limitAsync.limitAsync(predicate, options.concurrency); + const results = await Promise.all(array.map(predicate)); + return array.filter((_, index) => results[index]); +} +//#endregion +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..0393aa074f92b203440aa4eee00d1db08594b101 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/filterAsync.mjs @@ -0,0 +1,38 @@ +import { limitAsync } from "./limitAsync.mjs"; +//#region src/array/filterAsync.ts +/** +* 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 array The array to filter. +* @param predicate An async function that tests each element. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +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]); +} +//#endregion +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..9f79976b13f38e16201dd0d83f8111e21a1cd565 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.d.mts @@ -0,0 +1,24 @@ +//#region src/array/flatMap.d.ts +/** + * 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 arr - The array to flatten. + * @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns 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>; +//#endregion +export { flatMap }; \ No newline at end of file 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..9f79976b13f38e16201dd0d83f8111e21a1cd565 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.d.ts @@ -0,0 +1,24 @@ +//#region src/array/flatMap.d.ts +/** + * 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 arr - The array to flatten. + * @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns 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>; +//#endregion +export { flatMap }; \ No newline at end of file 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..dbb6a95d9747e8f9a4edaab19a7f38e687b5ec11 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.js @@ -0,0 +1,27 @@ +const require_flatten = require("./flatten.js"); +//#region src/array/flatMap.ts +/** +* 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 arr - The array to flatten. +* @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. +* @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. +* @returns 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] +*/ +function flatMap(arr, iteratee, depth = 1) { + return require_flatten.flatten(arr.map((item, index) => iteratee(item, index, arr)), depth); +} +//#endregion +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..7883a189512f5a7e8516af98880f50f07a52191a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMap.mjs @@ -0,0 +1,27 @@ +import { flatten } from "./flatten.mjs"; +//#region src/array/flatMap.ts +/** +* 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 arr - The array to flatten. +* @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. +* @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. +* @returns 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] +*/ +function flatMap(arr, iteratee, depth = 1) { + return flatten(arr.map((item, index) => iteratee(item, index, arr)), depth); +} +//#endregion +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..d9cfae1c7bff1cf42e9e6c73d610f23f5a79c266 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.d.mts @@ -0,0 +1,38 @@ +//#region src/array/flatMapAsync.d.ts +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 array The array to transform. + * @param callback An async function that transforms each element into an array. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { flatMapAsync }; \ No newline at end of file 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..d9cfae1c7bff1cf42e9e6c73d610f23f5a79c266 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.d.ts @@ -0,0 +1,38 @@ +//#region src/array/flatMapAsync.d.ts +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 array The array to transform. + * @param callback An async function that transforms each element into an array. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { flatMapAsync }; \ No newline at end of file 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..56455cd866b11de616af82f3b2a0dd148e645d11 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.js @@ -0,0 +1,41 @@ +const require_limitAsync = require("./limitAsync.js"); +const require_flatten = require("./flatten.js"); +//#region src/array/flatMapAsync.ts +/** +* 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 array The array to transform. +* @param callback An async function that transforms each element into an array. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +async function flatMapAsync(array, callback, options) { + if (options?.concurrency != null) callback = require_limitAsync.limitAsync(callback, options.concurrency); + const results = await Promise.all(array.map(callback)); + return require_flatten.flatten(results); +} +//#endregion +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..81ab5d51383e7558028bd6833e34d7572e149a12 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapAsync.mjs @@ -0,0 +1,40 @@ +import { limitAsync } from "./limitAsync.mjs"; +import { flatten } from "./flatten.mjs"; +//#region src/array/flatMapAsync.ts +/** +* 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 array The array to transform. +* @param callback An async function that transforms each element into an array. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +async function flatMapAsync(array, callback, options) { + if (options?.concurrency != null) callback = limitAsync(callback, options.concurrency); + return flatten(await Promise.all(array.map(callback))); +} +//#endregion +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..6070b75f1776f5308e9dc011b7479eb4b6cb26b7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.d.mts @@ -0,0 +1,19 @@ +import { ExtractNestedArrayType } from "./flattenDeep.mjs"; + +//#region src/array/flatMapDeep.d.ts +/** + * 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 arr - The array to flatten. + * @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @returns 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>; +//#endregion +export { flatMapDeep }; \ No newline at end of file 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..c16e3b2605cef1aee02a00ac8de59534dd499f0d --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.d.ts @@ -0,0 +1,19 @@ +import { ExtractNestedArrayType } from "./flattenDeep.js"; + +//#region src/array/flatMapDeep.d.ts +/** + * 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 arr - The array to flatten. + * @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. + * @returns 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>; +//#endregion +export { flatMapDeep }; \ No newline at end of file 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..7399386029c1df3358a09aab3eef2d8bc53415de --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.js @@ -0,0 +1,20 @@ +const require_flattenDeep = require("./flattenDeep.js"); +//#region src/array/flatMapDeep.ts +/** +* 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 arr - The array to flatten. +* @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. +* @returns A new array that has been flattened. +* +* @example +* const result = flatMapDeep([1, 2, 3], n => [[n, n]]); +* // [1, 1, 2, 2, 3, 3] +*/ +function flatMapDeep(arr, iteratee) { + return require_flattenDeep.flattenDeep(arr.map((item, index) => iteratee(item, index, arr))); +} +//#endregion +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..e992ded6960808353dbfc2aca163a2352607c84f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatMapDeep.mjs @@ -0,0 +1,20 @@ +import { flattenDeep } from "./flattenDeep.mjs"; +//#region src/array/flatMapDeep.ts +/** +* 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 arr - The array to flatten. +* @param iteratee - The function that produces the new array elements. It receives the element, its index, and the array. +* @returns A new array that has been flattened. +* +* @example +* const result = flatMapDeep([1, 2, 3], n => [[n, n]]); +* // [1, 1, 2, 2, 3, 3] +*/ +function flatMapDeep(arr, iteratee) { + return flattenDeep(arr.map((item, index) => iteratee(item, index, arr))); +} +//#endregion +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..c635ec8fbbcce6af1843df198f6db3377a8cff2b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.d.mts @@ -0,0 +1,20 @@ +//#region src/array/flatten.d.ts +/** + * 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 arr - The array to flatten. + * @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns 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>; +//#endregion +export { flatten }; \ No newline at end of file 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..c635ec8fbbcce6af1843df198f6db3377a8cff2b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.d.ts @@ -0,0 +1,20 @@ +//#region src/array/flatten.d.ts +/** + * 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 arr - The array to flatten. + * @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. + * @returns 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>; +//#endregion +export { flatten }; \ No newline at end of file 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..d021ecfe35e980ce1f20073ddbabac8e1ebe495f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.js @@ -0,0 +1,32 @@ +//#region src/array/flatten.ts +/** +* 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 arr - The array to flatten. +* @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. +* @returns 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] +*/ +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; +} +//#endregion +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..b04d677fc1172a7420dd9d5d747cff90bac1a995 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flatten.mjs @@ -0,0 +1,32 @@ +//#region src/array/flatten.ts +/** +* 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 arr - The array to flatten. +* @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. +* @returns 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] +*/ +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; +} +//#endregion +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..910c7dd3f5341d66c6282456a38689951a10bb5e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.d.mts @@ -0,0 +1,26 @@ +//#region src/array/flattenDeep.d.ts +/** + * 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 arr - The array to flatten. + * @returns 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>; +//#endregion +export { ExtractNestedArrayType, flattenDeep }; \ No newline at end of file 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..910c7dd3f5341d66c6282456a38689951a10bb5e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.d.ts @@ -0,0 +1,26 @@ +//#region src/array/flattenDeep.d.ts +/** + * 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 arr - The array to flatten. + * @returns 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>; +//#endregion +export { ExtractNestedArrayType, flattenDeep }; \ No newline at end of file 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..eced8174004135d57f398acec2f712723728963a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.js @@ -0,0 +1,18 @@ +const require_flatten = require("./flatten.js"); +//#region src/array/flattenDeep.ts +/** +* Flattens all depths of a nested array. +* +* @template T - The type of elements within the array. +* @param arr - The array to flatten. +* @returns A new array that has been flattened. +* +* @example +* const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]); +* // Returns: [1, 2, 3, 4, 5, 6] +*/ +function flattenDeep(arr) { + return require_flatten.flatten(arr, Infinity); +} +//#endregion +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..bf719e421a7124756660dacb9ddb14f094e3ac75 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/flattenDeep.mjs @@ -0,0 +1,18 @@ +import { flatten } from "./flatten.mjs"; +//#region src/array/flattenDeep.ts +/** +* Flattens all depths of a nested array. +* +* @template T - The type of elements within the array. +* @param arr - The array to flatten. +* @returns A new array that has been flattened. +* +* @example +* const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]); +* // Returns: [1, 2, 3, 4, 5, 6] +*/ +function flattenDeep(arr) { + return flatten(arr, Infinity); +} +//#endregion +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..e1f1d3e3504d4decf547a0d270dfeac59fccfe12 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.d.mts @@ -0,0 +1,36 @@ +//#region src/array/forEachAsync.d.ts +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 array The array to iterate over. + * @param callback An async function to execute for each element. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { forEachAsync }; \ No newline at end of file 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..e1f1d3e3504d4decf547a0d270dfeac59fccfe12 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.d.ts @@ -0,0 +1,36 @@ +//#region src/array/forEachAsync.d.ts +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 array The array to iterate over. + * @param callback An async function to execute for each element. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { forEachAsync }; \ No newline at end of file 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..3816318808819ef4f05b3ba3af269624c3aeb95e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.js @@ -0,0 +1,37 @@ +const require_limitAsync = require("./limitAsync.js"); +//#region src/array/forEachAsync.ts +/** +* 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 array The array to iterate over. +* @param callback An async function to execute for each element. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +async function forEachAsync(array, callback, options) { + if (options?.concurrency != null) callback = require_limitAsync.limitAsync(callback, options.concurrency); + await Promise.all(array.map(callback)); +} +//#endregion +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..f1f28914fb436edfba40ee04e95da34adf03c34e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachAsync.mjs @@ -0,0 +1,37 @@ +import { limitAsync } from "./limitAsync.mjs"; +//#region src/array/forEachAsync.ts +/** +* 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 array The array to iterate over. +* @param callback An async function to execute for each element. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +async function forEachAsync(array, callback, options) { + if (options?.concurrency != null) callback = limitAsync(callback, options.concurrency); + await Promise.all(array.map(callback)); +} +//#endregion +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..dc3dec4cd859cb1aed0131000b529dc563e12552 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.d.mts @@ -0,0 +1,49 @@ +//#region src/array/forEachRight.d.ts +/** + * 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 arr - The array to iterate over. + * @param 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 arr - The array to iterate over. + * @param 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; +//#endregion +export { forEachRight }; \ No newline at end of file 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..dc3dec4cd859cb1aed0131000b529dc563e12552 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.d.ts @@ -0,0 +1,49 @@ +//#region src/array/forEachRight.d.ts +/** + * 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 arr - The array to iterate over. + * @param 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 arr - The array to iterate over. + * @param 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; +//#endregion +export { forEachRight }; \ No newline at end of file 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..152de4768b3542755b160f0276bc4d62fd368a12 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.js @@ -0,0 +1,31 @@ +//#region src/array/forEachRight.ts +/** +* 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 arr - The array to iterate over. +* @param 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] +*/ +function forEachRight(arr, callback) { + for (let i = arr.length - 1; i >= 0; i--) { + const element = arr[i]; + callback(element, i, arr); + } +} +//#endregion +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..346e9133a5c8e68bdb1663fadb8f8a86606bd623 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/forEachRight.mjs @@ -0,0 +1,31 @@ +//#region src/array/forEachRight.ts +/** +* 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 arr - The array to iterate over. +* @param 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] +*/ +function forEachRight(arr, callback) { + for (let i = arr.length - 1; i >= 0; i--) { + const element = arr[i]; + callback(element, i, arr); + } +} +//#endregion +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..ba3da7bbc3b1fed01ebf8f749f5b305d5c7688d2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.d.mts @@ -0,0 +1,42 @@ +//#region src/array/groupBy.d.ts +/** + * 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 arr - The array to group. + * @param getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns 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; +//#endregion +export { groupBy }; \ No newline at end of file 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..ba3da7bbc3b1fed01ebf8f749f5b305d5c7688d2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.d.ts @@ -0,0 +1,42 @@ +//#region src/array/groupBy.d.ts +/** + * 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 arr - The array to group. + * @param getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns 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; +//#endregion +export { groupBy }; \ No newline at end of file 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..3d2824c7348fdbf51eb7986013f40f63bb3b754a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.js @@ -0,0 +1,51 @@ +//#region src/array/groupBy.ts +/** +* 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 arr - The array to group. +* @param getKeyFromItem - A function that generates a key from an element, its index, and the array. +* @returns 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'] } +*/ +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; +} +//#endregion +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..e6eb803b97aab44c23bed46543805c6469d11a64 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/groupBy.mjs @@ -0,0 +1,51 @@ +//#region src/array/groupBy.ts +/** +* 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 arr - The array to group. +* @param getKeyFromItem - A function that generates a key from an element, its index, and the array. +* @returns 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'] } +*/ +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; +} +//#endregion +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..3e2dd450c438af746b6ecc1266fc64d597ed2d04 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.d.mts @@ -0,0 +1,35 @@ +//#region src/array/head.d.ts +/** + * 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 arr - A non-empty array from which to get the first element. + * @returns 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 arr - The array from which to get the first element. + * @returns 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; +//#endregion +export { head }; \ No newline at end of file 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..3e2dd450c438af746b6ecc1266fc64d597ed2d04 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.d.ts @@ -0,0 +1,35 @@ +//#region src/array/head.d.ts +/** + * 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 arr - A non-empty array from which to get the first element. + * @returns 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 arr - The array from which to get the first element. + * @returns 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; +//#endregion +export { head }; \ No newline at end of file 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..e1765ab9d51592a9b915fa989ebc1b8eca497895 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.js @@ -0,0 +1,21 @@ +//#region src/array/head.ts +/** +* 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 arr - The array from which to get the first element. +* @returns 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 +*/ +function head(arr) { + return arr[0]; +} +//#endregion +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..cfad4f828b963a36d73b148d4c582cb18b6f1f4c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/head.mjs @@ -0,0 +1,21 @@ +//#region src/array/head.ts +/** +* 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 arr - The array from which to get the first element. +* @returns 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 +*/ +function head(arr) { + return arr[0]; +} +//#endregion +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..c99086e18e2f2b423b1deca9ee0df5bf6339fc1e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.d.mts @@ -0,0 +1,70 @@ +import { at } from "./at.mjs"; +import { cartesianProduct } from "./cartesianProduct.mjs"; +import { chunk } from "./chunk.mjs"; +import { chunkBy } from "./chunkBy.mjs"; +import { combinations } from "./combinations.mjs"; +import { compact } from "./compact.mjs"; +import { countBy } from "./countBy.mjs"; +import { difference } from "./difference.mjs"; +import { differenceBy } from "./differenceBy.mjs"; +import { differenceWith } from "./differenceWith.mjs"; +import { drop } from "./drop.mjs"; +import { dropRight } from "./dropRight.mjs"; +import { dropRightWhile } from "./dropRightWhile.mjs"; +import { dropWhile } from "./dropWhile.mjs"; +import { fill } from "./fill.mjs"; +import { filterAsync } from "./filterAsync.mjs"; +import { flatMap } from "./flatMap.mjs"; +import { flatMapAsync } from "./flatMapAsync.mjs"; +import { flattenDeep } from "./flattenDeep.mjs"; +import { flatMapDeep } from "./flatMapDeep.mjs"; +import { flatten } from "./flatten.mjs"; +import { forEachAsync } from "./forEachAsync.mjs"; +import { forEachRight } from "./forEachRight.mjs"; +import { groupBy } from "./groupBy.mjs"; +import { head } from "./head.mjs"; +import { initial } from "./initial.mjs"; +import { intersection } from "./intersection.mjs"; +import { intersectionBy } from "./intersectionBy.mjs"; +import { intersectionWith } from "./intersectionWith.mjs"; +import { isSubset } from "./isSubset.mjs"; +import { isSubsetWith } from "./isSubsetWith.mjs"; +import { keyBy } from "./keyBy.mjs"; +import { last } from "./last.mjs"; +import { limitAsync } from "./limitAsync.mjs"; +import { mapAsync } from "./mapAsync.mjs"; +import { maxBy } from "./maxBy.mjs"; +import { minBy } from "./minBy.mjs"; +import { orderBy } from "./orderBy.mjs"; +import { partition } from "./partition.mjs"; +import { pull } from "./pull.mjs"; +import { pullAt } from "./pullAt.mjs"; +import { reduceAsync } from "./reduceAsync.mjs"; +import { remove } from "./remove.mjs"; +import { sample } from "./sample.mjs"; +import { sampleSize } from "./sampleSize.mjs"; +import { shuffle } from "./shuffle.mjs"; +import { sortBy } from "./sortBy.mjs"; +import { tail } from "./tail.mjs"; +import { take } from "./take.mjs"; +import { takeRight } from "./takeRight.mjs"; +import { takeRightWhile } from "./takeRightWhile.mjs"; +import { takeWhile } from "./takeWhile.mjs"; +import { toFilled } from "./toFilled.mjs"; +import { union } from "./union.mjs"; +import { unionBy } from "./unionBy.mjs"; +import { unionWith } from "./unionWith.mjs"; +import { uniq } from "./uniq.mjs"; +import { uniqBy } from "./uniqBy.mjs"; +import { uniqWith } from "./uniqWith.mjs"; +import { unzip } from "./unzip.mjs"; +import { unzipWith } from "./unzipWith.mjs"; +import { windowed } from "./windowed.mjs"; +import { without } from "./without.mjs"; +import { xor } from "./xor.mjs"; +import { xorBy } from "./xorBy.mjs"; +import { xorWith } from "./xorWith.mjs"; +import { zip } from "./zip.mjs"; +import { zipObject } from "./zipObject.mjs"; +import { zipWith } from "./zipWith.mjs"; +export { at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last, limitAsync, mapAsync, maxBy, minBy, orderBy, partition, pull, pullAt, reduceAsync, remove, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith }; \ No newline at end of file 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..a58ae446b66bc195ebe059dbed2c31171bd4f157 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.d.ts @@ -0,0 +1,70 @@ +import { at } from "./at.js"; +import { cartesianProduct } from "./cartesianProduct.js"; +import { chunk } from "./chunk.js"; +import { chunkBy } from "./chunkBy.js"; +import { combinations } from "./combinations.js"; +import { compact } from "./compact.js"; +import { countBy } from "./countBy.js"; +import { difference } from "./difference.js"; +import { differenceBy } from "./differenceBy.js"; +import { differenceWith } from "./differenceWith.js"; +import { drop } from "./drop.js"; +import { dropRight } from "./dropRight.js"; +import { dropRightWhile } from "./dropRightWhile.js"; +import { dropWhile } from "./dropWhile.js"; +import { fill } from "./fill.js"; +import { filterAsync } from "./filterAsync.js"; +import { flatMap } from "./flatMap.js"; +import { flatMapAsync } from "./flatMapAsync.js"; +import { flattenDeep } from "./flattenDeep.js"; +import { flatMapDeep } from "./flatMapDeep.js"; +import { flatten } from "./flatten.js"; +import { forEachAsync } from "./forEachAsync.js"; +import { forEachRight } from "./forEachRight.js"; +import { groupBy } from "./groupBy.js"; +import { head } from "./head.js"; +import { initial } from "./initial.js"; +import { intersection } from "./intersection.js"; +import { intersectionBy } from "./intersectionBy.js"; +import { intersectionWith } from "./intersectionWith.js"; +import { isSubset } from "./isSubset.js"; +import { isSubsetWith } from "./isSubsetWith.js"; +import { keyBy } from "./keyBy.js"; +import { last } from "./last.js"; +import { limitAsync } from "./limitAsync.js"; +import { mapAsync } from "./mapAsync.js"; +import { maxBy } from "./maxBy.js"; +import { minBy } from "./minBy.js"; +import { orderBy } from "./orderBy.js"; +import { partition } from "./partition.js"; +import { pull } from "./pull.js"; +import { pullAt } from "./pullAt.js"; +import { reduceAsync } from "./reduceAsync.js"; +import { remove } from "./remove.js"; +import { sample } from "./sample.js"; +import { sampleSize } from "./sampleSize.js"; +import { shuffle } from "./shuffle.js"; +import { sortBy } from "./sortBy.js"; +import { tail } from "./tail.js"; +import { take } from "./take.js"; +import { takeRight } from "./takeRight.js"; +import { takeRightWhile } from "./takeRightWhile.js"; +import { takeWhile } from "./takeWhile.js"; +import { toFilled } from "./toFilled.js"; +import { union } from "./union.js"; +import { unionBy } from "./unionBy.js"; +import { unionWith } from "./unionWith.js"; +import { uniq } from "./uniq.js"; +import { uniqBy } from "./uniqBy.js"; +import { uniqWith } from "./uniqWith.js"; +import { unzip } from "./unzip.js"; +import { unzipWith } from "./unzipWith.js"; +import { windowed } from "./windowed.js"; +import { without } from "./without.js"; +import { xor } from "./xor.js"; +import { xorBy } from "./xorBy.js"; +import { xorWith } from "./xorWith.js"; +import { zip } from "./zip.js"; +import { zipObject } from "./zipObject.js"; +import { zipWith } from "./zipWith.js"; +export { at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last, limitAsync, mapAsync, maxBy, minBy, orderBy, partition, pull, pullAt, reduceAsync, remove, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith }; \ No newline at end of file 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..6b17b35467bb15084ab77bb89f9ef7abe66d645b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.js @@ -0,0 +1,139 @@ +Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); +const require_at = require("./at.js"); +const require_cartesianProduct = require("./cartesianProduct.js"); +const require_chunk = require("./chunk.js"); +const require_chunkBy = require("./chunkBy.js"); +const require_combinations = require("./combinations.js"); +const require_compact = require("./compact.js"); +const require_countBy = require("./countBy.js"); +const require_difference = require("./difference.js"); +const require_differenceBy = require("./differenceBy.js"); +const require_differenceWith = require("./differenceWith.js"); +const require_drop = require("./drop.js"); +const require_dropRight = require("./dropRight.js"); +const require_dropRightWhile = require("./dropRightWhile.js"); +const require_dropWhile = require("./dropWhile.js"); +const require_fill = require("./fill.js"); +const require_limitAsync = require("./limitAsync.js"); +const require_filterAsync = require("./filterAsync.js"); +const require_flatten = require("./flatten.js"); +const require_flatMap = require("./flatMap.js"); +const require_flatMapAsync = require("./flatMapAsync.js"); +const require_flattenDeep = require("./flattenDeep.js"); +const require_flatMapDeep = require("./flatMapDeep.js"); +const require_forEachAsync = require("./forEachAsync.js"); +const require_forEachRight = require("./forEachRight.js"); +const require_groupBy = require("./groupBy.js"); +const require_head = require("./head.js"); +const require_initial = require("./initial.js"); +const require_intersection = require("./intersection.js"); +const require_intersectionBy = require("./intersectionBy.js"); +const require_intersectionWith = require("./intersectionWith.js"); +const require_isSubset = require("./isSubset.js"); +const require_isSubsetWith = require("./isSubsetWith.js"); +const require_keyBy = require("./keyBy.js"); +const require_last = require("./last.js"); +const require_mapAsync = require("./mapAsync.js"); +const require_maxBy = require("./maxBy.js"); +const require_minBy = require("./minBy.js"); +const require_orderBy = require("./orderBy.js"); +const require_partition = require("./partition.js"); +const require_pull = require("./pull.js"); +const require_pullAt = require("./pullAt.js"); +const require_reduceAsync = require("./reduceAsync.js"); +const require_remove = require("./remove.js"); +const require_sample = require("./sample.js"); +const require_sampleSize = require("./sampleSize.js"); +const require_shuffle = require("./shuffle.js"); +const require_sortBy = require("./sortBy.js"); +const require_tail = require("./tail.js"); +const require_take = require("./take.js"); +const require_takeRight = require("./takeRight.js"); +const require_takeRightWhile = require("./takeRightWhile.js"); +const require_takeWhile = require("./takeWhile.js"); +const require_toFilled = require("./toFilled.js"); +const require_uniq = require("./uniq.js"); +const require_union = require("./union.js"); +const require_uniqBy = require("./uniqBy.js"); +const require_unionBy = require("./unionBy.js"); +const require_uniqWith = require("./uniqWith.js"); +const require_unionWith = require("./unionWith.js"); +const require_unzip = require("./unzip.js"); +const require_unzipWith = require("./unzipWith.js"); +const require_windowed = require("./windowed.js"); +const require_without = require("./without.js"); +const require_xor = require("./xor.js"); +const require_xorBy = require("./xorBy.js"); +const require_xorWith = require("./xorWith.js"); +const require_zip = require("./zip.js"); +const require_zipObject = require("./zipObject.js"); +const require_zipWith = require("./zipWith.js"); +exports.at = require_at.at; +exports.cartesianProduct = require_cartesianProduct.cartesianProduct; +exports.chunk = require_chunk.chunk; +exports.chunkBy = require_chunkBy.chunkBy; +exports.combinations = require_combinations.combinations; +exports.compact = require_compact.compact; +exports.countBy = require_countBy.countBy; +exports.difference = require_difference.difference; +exports.differenceBy = require_differenceBy.differenceBy; +exports.differenceWith = require_differenceWith.differenceWith; +exports.drop = require_drop.drop; +exports.dropRight = require_dropRight.dropRight; +exports.dropRightWhile = require_dropRightWhile.dropRightWhile; +exports.dropWhile = require_dropWhile.dropWhile; +exports.fill = require_fill.fill; +exports.filterAsync = require_filterAsync.filterAsync; +exports.flatMap = require_flatMap.flatMap; +exports.flatMapAsync = require_flatMapAsync.flatMapAsync; +exports.flatMapDeep = require_flatMapDeep.flatMapDeep; +exports.flatten = require_flatten.flatten; +exports.flattenDeep = require_flattenDeep.flattenDeep; +exports.forEachAsync = require_forEachAsync.forEachAsync; +exports.forEachRight = require_forEachRight.forEachRight; +exports.groupBy = require_groupBy.groupBy; +exports.head = require_head.head; +exports.initial = require_initial.initial; +exports.intersection = require_intersection.intersection; +exports.intersectionBy = require_intersectionBy.intersectionBy; +exports.intersectionWith = require_intersectionWith.intersectionWith; +exports.isSubset = require_isSubset.isSubset; +exports.isSubsetWith = require_isSubsetWith.isSubsetWith; +exports.keyBy = require_keyBy.keyBy; +exports.last = require_last.last; +exports.limitAsync = require_limitAsync.limitAsync; +exports.mapAsync = require_mapAsync.mapAsync; +exports.maxBy = require_maxBy.maxBy; +exports.minBy = require_minBy.minBy; +exports.orderBy = require_orderBy.orderBy; +exports.partition = require_partition.partition; +exports.pull = require_pull.pull; +exports.pullAt = require_pullAt.pullAt; +exports.reduceAsync = require_reduceAsync.reduceAsync; +exports.remove = require_remove.remove; +exports.sample = require_sample.sample; +exports.sampleSize = require_sampleSize.sampleSize; +exports.shuffle = require_shuffle.shuffle; +exports.sortBy = require_sortBy.sortBy; +exports.tail = require_tail.tail; +exports.take = require_take.take; +exports.takeRight = require_takeRight.takeRight; +exports.takeRightWhile = require_takeRightWhile.takeRightWhile; +exports.takeWhile = require_takeWhile.takeWhile; +exports.toFilled = require_toFilled.toFilled; +exports.union = require_union.union; +exports.unionBy = require_unionBy.unionBy; +exports.unionWith = require_unionWith.unionWith; +exports.uniq = require_uniq.uniq; +exports.uniqBy = require_uniqBy.uniqBy; +exports.uniqWith = require_uniqWith.uniqWith; +exports.unzip = require_unzip.unzip; +exports.unzipWith = require_unzipWith.unzipWith; +exports.windowed = require_windowed.windowed; +exports.without = require_without.without; +exports.xor = require_xor.xor; +exports.xorBy = require_xorBy.xorBy; +exports.xorWith = require_xorWith.xorWith; +exports.zip = require_zip.zip; +exports.zipObject = require_zipObject.zipObject; +exports.zipWith = require_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..156698f83291c5a3520d695cc8546b8748799951 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/index.mjs @@ -0,0 +1,70 @@ +import { at } from "./at.mjs"; +import { cartesianProduct } from "./cartesianProduct.mjs"; +import { chunk } from "./chunk.mjs"; +import { chunkBy } from "./chunkBy.mjs"; +import { combinations } from "./combinations.mjs"; +import { compact } from "./compact.mjs"; +import { countBy } from "./countBy.mjs"; +import { difference } from "./difference.mjs"; +import { differenceBy } from "./differenceBy.mjs"; +import { differenceWith } from "./differenceWith.mjs"; +import { drop } from "./drop.mjs"; +import { dropRight } from "./dropRight.mjs"; +import { dropRightWhile } from "./dropRightWhile.mjs"; +import { dropWhile } from "./dropWhile.mjs"; +import { fill } from "./fill.mjs"; +import { limitAsync } from "./limitAsync.mjs"; +import { filterAsync } from "./filterAsync.mjs"; +import { flatten } from "./flatten.mjs"; +import { flatMap } from "./flatMap.mjs"; +import { flatMapAsync } from "./flatMapAsync.mjs"; +import { flattenDeep } from "./flattenDeep.mjs"; +import { flatMapDeep } from "./flatMapDeep.mjs"; +import { forEachAsync } from "./forEachAsync.mjs"; +import { forEachRight } from "./forEachRight.mjs"; +import { groupBy } from "./groupBy.mjs"; +import { head } from "./head.mjs"; +import { initial } from "./initial.mjs"; +import { intersection } from "./intersection.mjs"; +import { intersectionBy } from "./intersectionBy.mjs"; +import { intersectionWith } from "./intersectionWith.mjs"; +import { isSubset } from "./isSubset.mjs"; +import { isSubsetWith } from "./isSubsetWith.mjs"; +import { keyBy } from "./keyBy.mjs"; +import { last } from "./last.mjs"; +import { mapAsync } from "./mapAsync.mjs"; +import { maxBy } from "./maxBy.mjs"; +import { minBy } from "./minBy.mjs"; +import { orderBy } from "./orderBy.mjs"; +import { partition } from "./partition.mjs"; +import { pull } from "./pull.mjs"; +import { pullAt } from "./pullAt.mjs"; +import { reduceAsync } from "./reduceAsync.mjs"; +import { remove } from "./remove.mjs"; +import { sample } from "./sample.mjs"; +import { sampleSize } from "./sampleSize.mjs"; +import { shuffle } from "./shuffle.mjs"; +import { sortBy } from "./sortBy.mjs"; +import { tail } from "./tail.mjs"; +import { take } from "./take.mjs"; +import { takeRight } from "./takeRight.mjs"; +import { takeRightWhile } from "./takeRightWhile.mjs"; +import { takeWhile } from "./takeWhile.mjs"; +import { toFilled } from "./toFilled.mjs"; +import { uniq } from "./uniq.mjs"; +import { union } from "./union.mjs"; +import { uniqBy } from "./uniqBy.mjs"; +import { unionBy } from "./unionBy.mjs"; +import { uniqWith } from "./uniqWith.mjs"; +import { unionWith } from "./unionWith.mjs"; +import { unzip } from "./unzip.mjs"; +import { unzipWith } from "./unzipWith.mjs"; +import { windowed } from "./windowed.mjs"; +import { without } from "./without.mjs"; +import { xor } from "./xor.mjs"; +import { xorBy } from "./xorBy.mjs"; +import { xorWith } from "./xorWith.mjs"; +import { zip } from "./zip.mjs"; +import { zipObject } from "./zipObject.mjs"; +import { zipWith } from "./zipWith.mjs"; +export { at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last, limitAsync, mapAsync, maxBy, minBy, orderBy, partition, pull, pullAt, reduceAsync, remove, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith }; 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..2e88e91b7fed156be6ead20d74cc540415f1a72c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.d.mts @@ -0,0 +1,55 @@ +//#region src/array/initial.d.ts +/** + * Returns an empty array when the input is a tuple containing exactly one element. + * + * @template T The type of the single element. + * @param 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 arr - A tuple with one or more elements. + * @returns 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 arr - The input array. + * @returns 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[]; +//#endregion +export { initial }; \ No newline at end of file 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..2e88e91b7fed156be6ead20d74cc540415f1a72c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.d.ts @@ -0,0 +1,55 @@ +//#region src/array/initial.d.ts +/** + * Returns an empty array when the input is a tuple containing exactly one element. + * + * @template T The type of the single element. + * @param 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 arr - A tuple with one or more elements. + * @returns 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 arr - The input array. + * @returns 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[]; +//#endregion +export { initial }; \ No newline at end of file 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..11063e72d89a3423f0b763c843ef76c0c4541a84 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.js @@ -0,0 +1,19 @@ +//#region src/array/initial.ts +/** +* 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 arr - The input array. +* @returns 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] +*/ +function initial(arr) { + return arr.slice(0, -1); +} +//#endregion +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..3459dd701585130d1743248cbb322eafb9c84fe5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/initial.mjs @@ -0,0 +1,19 @@ +//#region src/array/initial.ts +/** +* 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 arr - The input array. +* @returns 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] +*/ +function initial(arr) { + return arr.slice(0, -1); +} +//#endregion +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..1d183805a9a5cb4ccae7b146ed8aebbb9ff16279 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.d.mts @@ -0,0 +1,22 @@ +//#region src/array/intersection.d.ts +/** + * 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 firstArr - The first array to compare. + * @param secondArr - The second array to compare. + * @returns 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[]; +//#endregion +export { intersection }; \ No newline at end of file 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..1d183805a9a5cb4ccae7b146ed8aebbb9ff16279 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.d.ts @@ -0,0 +1,22 @@ +//#region src/array/intersection.d.ts +/** + * 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 firstArr - The first array to compare. + * @param secondArr - The second array to compare. + * @returns 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[]; +//#endregion +export { intersection }; \ No newline at end of file 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..a2553a86b4a24a4d41b1c79a5fae3b6950aac55f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.js @@ -0,0 +1,25 @@ +//#region src/array/intersection.ts +/** +* 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 firstArr - The first array to compare. +* @param secondArr - The second array to compare. +* @returns 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. +*/ +function intersection(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter((item) => secondSet.has(item)); +} +//#endregion +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..14f0fb96754ce0686b3c6597308ddf2fd3c049a4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersection.mjs @@ -0,0 +1,25 @@ +//#region src/array/intersection.ts +/** +* 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 firstArr - The first array to compare. +* @param secondArr - The second array to compare. +* @returns 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. +*/ +function intersection(firstArr, secondArr) { + const secondSet = new Set(secondArr); + return firstArr.filter((item) => secondSet.has(item)); +} +//#endregion +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..afe532adf19ae414ccf20578b7075b2b86eabc42 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.d.mts @@ -0,0 +1,37 @@ +//#region src/array/intersectionBy.d.ts +/** + * 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 firstArr - The first array to compare. + * @param secondArr - The second array to compare. + * @param mapper - A function to map the elements of both arrays for comparison. + * @returns 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[]; +//#endregion +export { intersectionBy }; \ No newline at end of file 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..afe532adf19ae414ccf20578b7075b2b86eabc42 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.d.ts @@ -0,0 +1,37 @@ +//#region src/array/intersectionBy.d.ts +/** + * 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 firstArr - The first array to compare. + * @param secondArr - The second array to compare. + * @param mapper - A function to map the elements of both arrays for comparison. + * @returns 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[]; +//#endregion +export { intersectionBy }; \ No newline at end of file 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..dca8fa7bdf4f34c27bf3899b13da2ea611ed6277 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.js @@ -0,0 +1,49 @@ +//#region src/array/intersectionBy.ts +/** +* 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 firstArr - The first array to compare. +* @param secondArr - The second array to compare. +* @param mapper - A function to map the elements of both arrays for comparison. +* @returns 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. +*/ +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; +} +//#endregion +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..f2816fd9d9d4933d0051af8f0dcaae6a5734e9fc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionBy.mjs @@ -0,0 +1,49 @@ +//#region src/array/intersectionBy.ts +/** +* 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 firstArr - The first array to compare. +* @param secondArr - The second array to compare. +* @param mapper - A function to map the elements of both arrays for comparison. +* @returns 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. +*/ +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; +} +//#endregion +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..ade6a3d3d4921e924676a43aafa9dd765b88327b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.d.mts @@ -0,0 +1,38 @@ +//#region src/array/intersectionWith.d.ts +/** + * 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 firstArr - The first array to compare. + * @param secondArr - The second array to compare. + * @param 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 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[]; +//#endregion +export { intersectionWith }; \ No newline at end of file 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..ade6a3d3d4921e924676a43aafa9dd765b88327b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.d.ts @@ -0,0 +1,38 @@ +//#region src/array/intersectionWith.d.ts +/** + * 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 firstArr - The first array to compare. + * @param secondArr - The second array to compare. + * @param 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 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[]; +//#endregion +export { intersectionWith }; \ No newline at end of file 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..cfbedbf3034b22f00cc0b991b5c7b31eaad5c73e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.js @@ -0,0 +1,44 @@ +//#region src/array/intersectionWith.ts +/** +* 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 firstArr - The first array to compare. +* @param secondArr - The second array to compare. +* @param 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 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. +*/ +function intersectionWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter((firstItem) => { + return secondArr.some((secondItem) => { + return areItemsEqual(firstItem, secondItem); + }); + }); +} +//#endregion +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..9ed08a743eb5d9d90c609f7a4261c87bdb0c8cd5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/intersectionWith.mjs @@ -0,0 +1,44 @@ +//#region src/array/intersectionWith.ts +/** +* 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 firstArr - The first array to compare. +* @param secondArr - The second array to compare. +* @param 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 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. +*/ +function intersectionWith(firstArr, secondArr, areItemsEqual) { + return firstArr.filter((firstItem) => { + return secondArr.some((secondItem) => { + return areItemsEqual(firstItem, secondItem); + }); + }); +} +//#endregion +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..e2df609a6ea944bc384b2f90774adb2a3d0cb15f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.d.mts @@ -0,0 +1,27 @@ +//#region src/array/isSubset.d.ts +/** + * Checks if the `subset` array is entirely contained within the `superset` array. + * + * + * @template T - The type of elements contained in the arrays. + * @param superset - The array that may contain all elements of the subset. + * @param subset - The array to check against the superset. + * @returns 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; +//#endregion +export { isSubset }; \ No newline at end of file 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..e2df609a6ea944bc384b2f90774adb2a3d0cb15f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.d.ts @@ -0,0 +1,27 @@ +//#region src/array/isSubset.d.ts +/** + * Checks if the `subset` array is entirely contained within the `superset` array. + * + * + * @template T - The type of elements contained in the arrays. + * @param superset - The array that may contain all elements of the subset. + * @param subset - The array to check against the superset. + * @returns 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; +//#endregion +export { isSubset }; \ No newline at end of file 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..b9fa8053ab27ed6abb6c48248f288c6c2a45f392 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.js @@ -0,0 +1,30 @@ +const require_difference = require("./difference.js"); +//#region src/array/isSubset.ts +/** +* Checks if the `subset` array is entirely contained within the `superset` array. +* +* +* @template T - The type of elements contained in the arrays. +* @param superset - The array that may contain all elements of the subset. +* @param subset - The array to check against the superset. +* @returns 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 +* ``` +*/ +function isSubset(superset, subset) { + return require_difference.difference(subset, superset).length === 0; +} +//#endregion +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..e8b6943dc76b5b7527a8dbbb2ad52da7eaf79af2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubset.mjs @@ -0,0 +1,30 @@ +import { difference } from "./difference.mjs"; +//#region src/array/isSubset.ts +/** +* Checks if the `subset` array is entirely contained within the `superset` array. +* +* +* @template T - The type of elements contained in the arrays. +* @param superset - The array that may contain all elements of the subset. +* @param subset - The array to check against the superset. +* @returns 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 +* ``` +*/ +function isSubset(superset, subset) { + return difference(subset, superset).length === 0; +} +//#endregion +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..1d4c3267b29dd26c1950794fdef8101a8cbc295e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.d.mts @@ -0,0 +1,34 @@ +//#region src/array/isSubsetWith.d.ts +/** + * 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 superset - The array that may contain all elements of the subset. + * @param subset - The array to check against the superset. + * @param areItemsEqual - A function to determine if two items are equal. + * @returns 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; +//#endregion +export { isSubsetWith }; \ No newline at end of file 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..1d4c3267b29dd26c1950794fdef8101a8cbc295e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.d.ts @@ -0,0 +1,34 @@ +//#region src/array/isSubsetWith.d.ts +/** + * 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 superset - The array that may contain all elements of the subset. + * @param subset - The array to check against the superset. + * @param areItemsEqual - A function to determine if two items are equal. + * @returns 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; +//#endregion +export { isSubsetWith }; \ No newline at end of file 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..90437dd0a5e5cf92842cbb5567b6dfb4d59d54fd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.js @@ -0,0 +1,37 @@ +const require_differenceWith = require("./differenceWith.js"); +//#region src/array/isSubsetWith.ts +/** +* 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 superset - The array that may contain all elements of the subset. +* @param subset - The array to check against the superset. +* @param areItemsEqual - A function to determine if two items are equal. +* @returns 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 +* ``` +*/ +function isSubsetWith(superset, subset, areItemsEqual) { + return require_differenceWith.differenceWith(subset, superset, areItemsEqual).length === 0; +} +//#endregion +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..b87e027b2f58bbe6f662e420edbc7962a7684cdc --- /dev/null +++ b/node_modules/es-toolkit/dist/array/isSubsetWith.mjs @@ -0,0 +1,37 @@ +import { differenceWith } from "./differenceWith.mjs"; +//#region src/array/isSubsetWith.ts +/** +* 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 superset - The array that may contain all elements of the subset. +* @param subset - The array to check against the superset. +* @param areItemsEqual - A function to determine if two items are equal. +* @returns 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 +* ``` +*/ +function isSubsetWith(superset, subset, areItemsEqual) { + return differenceWith(subset, superset, areItemsEqual).length === 0; +} +//#endregion +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..18da996c2d300baadb91b830c1f4414e1ed5e6a1 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.d.mts @@ -0,0 +1,37 @@ +//#region src/array/keyBy.d.ts +/** + * 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 arr - The array of elements to be mapped. + * @param getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns 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; +//#endregion +export { keyBy }; \ No newline at end of file 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..18da996c2d300baadb91b830c1f4414e1ed5e6a1 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.d.ts @@ -0,0 +1,37 @@ +//#region src/array/keyBy.d.ts +/** + * 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 arr - The array of elements to be mapped. + * @param getKeyFromItem - A function that generates a key from an element, its index, and the array. + * @returns 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; +//#endregion +export { keyBy }; \ No newline at end of file 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..23683d57c2df2ad9bfc87a38c4e1035db036ba94 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.js @@ -0,0 +1,45 @@ +//#region src/array/keyBy.ts +/** +* 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 arr - The array of elements to be mapped. +* @param getKeyFromItem - A function that generates a key from an element, its index, and the array. +* @returns 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' } +*/ +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; +} +//#endregion +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..50f2f3a49f4e0dae308c94b8c40ec83697e5f351 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/keyBy.mjs @@ -0,0 +1,45 @@ +//#region src/array/keyBy.ts +/** +* 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 arr - The array of elements to be mapped. +* @param getKeyFromItem - A function that generates a key from an element, its index, and the array. +* @returns 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' } +*/ +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; +} +//#endregion +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..833d72c3d62767123a16a9de10d80c344e49eb35 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.d.mts @@ -0,0 +1,49 @@ +//#region src/array/last.d.ts +/** + * 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 arr - The array from which to get the last element. + * @returns 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 arr - The array from which to get the last element. + * @returns 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; +//#endregion +export { last }; \ No newline at end of file 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..833d72c3d62767123a16a9de10d80c344e49eb35 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.d.ts @@ -0,0 +1,49 @@ +//#region src/array/last.d.ts +/** + * 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 arr - The array from which to get the last element. + * @returns 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 arr - The array from which to get the last element. + * @returns 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; +//#endregion +export { last }; \ No newline at end of file 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..ba55267b81e57e2cc7be11cec3151cc3d0d941a9 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.js @@ -0,0 +1,28 @@ +//#region src/array/last.ts +/** +* 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 arr - The array from which to get the last element. +* @returns 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 +*/ +function last(arr) { + return arr[arr.length - 1]; +} +//#endregion +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..2d8d5ba576bbc0f5f943e7a20cc280621d274ae9 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/last.mjs @@ -0,0 +1,28 @@ +//#region src/array/last.ts +/** +* 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 arr - The array from which to get the last element. +* @returns 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 +*/ +function last(arr) { + return arr[arr.length - 1]; +} +//#endregion +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..d9905e3b3ef37b8e9c2fe8ca4781ae66f27082f5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.d.mts @@ -0,0 +1,35 @@ +//#region src/array/limitAsync.d.ts +/** + * 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 callback The async function to wrap with concurrency control. + * @param concurrency Maximum number of concurrent executions allowed. + * @returns 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; +//#endregion +export { limitAsync }; \ No newline at end of file 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..d9905e3b3ef37b8e9c2fe8ca4781ae66f27082f5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.d.ts @@ -0,0 +1,35 @@ +//#region src/array/limitAsync.d.ts +/** + * 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 callback The async function to wrap with concurrency control. + * @param concurrency Maximum number of concurrent executions allowed. + * @returns 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; +//#endregion +export { limitAsync }; \ No newline at end of file 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..6edd73afe9e6df8487b95fe7d5eefe915cc6bf8f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.js @@ -0,0 +1,46 @@ +const require_semaphore = require("../promise/semaphore.js"); +//#region src/array/limitAsync.ts +/** +* 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 callback The async function to wrap with concurrency control. +* @param concurrency Maximum number of concurrent executions allowed. +* @returns 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))); +*/ +function limitAsync(callback, concurrency) { + const semaphore = new require_semaphore.Semaphore(concurrency); + return async function(...args) { + try { + await semaphore.acquire(); + return await callback.apply(this, args); + } finally { + semaphore.release(); + } + }; +} +//#endregion +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..89f12ebb51562fba346eedf11ee75332cb720961 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/limitAsync.mjs @@ -0,0 +1,46 @@ +import { Semaphore } from "../promise/semaphore.mjs"; +//#region src/array/limitAsync.ts +/** +* 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 callback The async function to wrap with concurrency control. +* @param concurrency Maximum number of concurrent executions allowed. +* @returns 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))); +*/ +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(); + } + }; +} +//#endregion +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..370dc58c64abab1fd1d07948c2065e0d035fffd7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.d.mts @@ -0,0 +1,35 @@ +//#region src/array/mapAsync.d.ts +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 array The array to transform. + * @param callback An async function that transforms each element. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { mapAsync }; \ No newline at end of file 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..370dc58c64abab1fd1d07948c2065e0d035fffd7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.d.ts @@ -0,0 +1,35 @@ +//#region src/array/mapAsync.d.ts +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 array The array to transform. + * @param callback An async function that transforms each element. + * @param [options] Optional configuration object. + * @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. + * @returns 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; +//#endregion +export { mapAsync }; \ No newline at end of file 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..74354183839fa22de0fa17b3afe5f95b4ca453eb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.js @@ -0,0 +1,36 @@ +const require_limitAsync = require("./limitAsync.js"); +//#region src/array/mapAsync.ts +/** +* 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 array The array to transform. +* @param callback An async function that transforms each element. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +function mapAsync(array, callback, options) { + if (options?.concurrency != null) callback = require_limitAsync.limitAsync(callback, options.concurrency); + return Promise.all(array.map(callback)); +} +//#endregion +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..59b06d42ac757111273a6c6bd06b9f34569ffe05 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/mapAsync.mjs @@ -0,0 +1,36 @@ +import { limitAsync } from "./limitAsync.mjs"; +//#region src/array/mapAsync.ts +/** +* 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 array The array to transform. +* @param callback An async function that transforms each element. +* @param [options] Optional configuration object. +* @param [options.concurrency] Maximum number of concurrent async operations. If not specified, all operations run concurrently. +* @returns 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 +*/ +function mapAsync(array, callback, options) { + if (options?.concurrency != null) callback = limitAsync(callback, options.concurrency); + return Promise.all(array.map(callback)); +} +//#endregion +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..c654d169763a20c51f3d50e52b1c11d02c169697 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.d.mts @@ -0,0 +1,48 @@ +//#region src/array/maxBy.d.ts +/** + * 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 items The nonempty array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.max) + * 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 items The array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.max) + * 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; +//#endregion +export { maxBy }; \ No newline at end of file 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..c654d169763a20c51f3d50e52b1c11d02c169697 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.d.ts @@ -0,0 +1,48 @@ +//#region src/array/maxBy.d.ts +/** + * 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 items The nonempty array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.max) + * 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 items The array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.max) + * 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; +//#endregion +export { maxBy }; \ No newline at end of file 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..47558ecee62cd214c22c3886d85be529e639a2e0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.js @@ -0,0 +1,40 @@ +//#region src/array/maxBy.ts +/** +* 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 items The array of elements to search. +* @param getValue A function that selects a numeric value from each element. +* @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.max) +* maxBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'john', age: 30 } +*/ +function maxBy(items, getValue) { + if (items.length === 0) return; + let maxElement = items[0]; + let max = -Infinity; + for (let i = 0; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (Number.isNaN(value)) return element; + if (value > max) { + max = value; + maxElement = element; + } + } + return maxElement; +} +//#endregion +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..b7d2018223c1e585fad16f980bc2b7c9b746b287 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/maxBy.mjs @@ -0,0 +1,40 @@ +//#region src/array/maxBy.ts +/** +* 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 items The array of elements to search. +* @param getValue A function that selects a numeric value from each element. +* @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.max) +* maxBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'john', age: 30 } +*/ +function maxBy(items, getValue) { + if (items.length === 0) return; + let maxElement = items[0]; + let max = -Infinity; + for (let i = 0; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (Number.isNaN(value)) return element; + if (value > max) { + max = value; + maxElement = element; + } + } + return maxElement; +} +//#endregion +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..6e3d214ab30df5583341129e66a21923be0dcfda --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.d.mts @@ -0,0 +1,48 @@ +//#region src/array/minBy.d.ts +/** + * 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 items The nonempty array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.min) + * 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 items The array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.min) + * 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; +//#endregion +export { minBy }; \ No newline at end of file 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..6e3d214ab30df5583341129e66a21923be0dcfda --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.d.ts @@ -0,0 +1,48 @@ +//#region src/array/minBy.d.ts +/** + * 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 items The nonempty array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.min) + * 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 items The array of elements to search. + * @param getValue A function that selects a numeric value from each element. + * @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.min) + * 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; +//#endregion +export { minBy }; \ No newline at end of file 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..3ac4f43aaecc3e8c06502634b2ccae39bda65e36 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.js @@ -0,0 +1,40 @@ +//#region src/array/minBy.ts +/** +* 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 items The array of elements to search. +* @param getValue A function that selects a numeric value from each element. +* @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.min) +* minBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'joe', age: 26 } +*/ +function minBy(items, getValue) { + if (items.length === 0) return; + let minElement = items[0]; + let min = Infinity; + for (let i = 0; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (Number.isNaN(value)) return element; + if (value < min) { + min = value; + minElement = element; + } + } + return minElement; +} +//#endregion +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..5d3913e8289cce9cd150e8784f39128017c873d9 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/minBy.mjs @@ -0,0 +1,40 @@ +//#region src/array/minBy.ts +/** +* 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 items The array of elements to search. +* @param getValue A function that selects a numeric value from each element. +* @returns 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([3, NaN, 1], x => x); // Returns: NaN (NaN propagates, matching Math.min) +* minBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'joe', age: 26 } +*/ +function minBy(items, getValue) { + if (items.length === 0) return; + let minElement = items[0]; + let min = Infinity; + for (let i = 0; i < items.length; i++) { + const element = items[i]; + const value = getValue(element, i, items); + if (Number.isNaN(value)) return element; + if (value < min) { + min = value; + minElement = element; + } + } + return minElement; +} +//#endregion +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..47cf71e77792a33be2c4652badc2fead70a25bd3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.d.mts @@ -0,0 +1,38 @@ +//#region src/array/orderBy.d.ts +/** + * 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 arr - The array of objects to be sorted. + * @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @param orders - An array of order directions ('asc' for ascending or 'desc' for descending). + * @returns 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[]; +//#endregion +export { orderBy }; \ No newline at end of file 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..47cf71e77792a33be2c4652badc2fead70a25bd3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.d.ts @@ -0,0 +1,38 @@ +//#region src/array/orderBy.d.ts +/** + * 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 arr - The array of objects to be sorted. + * @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @param orders - An array of order directions ('asc' for ascending or 'desc' for descending). + * @returns 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[]; +//#endregion +export { orderBy }; \ No newline at end of file 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..6f211317ed1f39c56b49b6767108d8ad323b1289 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.js @@ -0,0 +1,53 @@ +const require_compareValues = require("../_internal/compareValues.js"); +//#region src/array/orderBy.ts +/** +* 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 arr - The array of objects to be sorted. +* @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. +* @param orders - An array of order directions ('asc' for ascending or 'desc' for descending). +* @returns 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 }, +* // ] +*/ +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 = require_compareValues.compareValues(valueA, valueB, order); + if (result !== 0) return result; + } + return 0; + }); +} +//#endregion +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..60197b5ca3a733f2779b2718cf3a04dabafe95dd --- /dev/null +++ b/node_modules/es-toolkit/dist/array/orderBy.mjs @@ -0,0 +1,51 @@ +import { compareValues } from "../_internal/compareValues.mjs"; +//#region src/array/orderBy.ts +/** +* 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 arr - The array of objects to be sorted. +* @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. +* @param orders - An array of order directions ('asc' for ascending or 'desc' for descending). +* @returns 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 }, +* // ] +*/ +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 result = compareValues(criterionIsFunction ? criterion(a) : a[criterion], criterionIsFunction ? criterion(b) : b[criterion], order); + if (result !== 0) return result; + } + return 0; + }); +} +//#endregion +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..5edad2bdfce1f77c4dc617db95904050c5dc0e4d --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.d.mts @@ -0,0 +1,51 @@ +//#region src/array/partition.d.ts +/** + * 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 arr - The array to partition. + * @param 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 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 arr - The array to partition. + * @param isInTruthy - A predicate function that determines + * whether an element should be placed in the truthy array. An element is placed in the truthy + * array when the function returns a truthy value. The function is called with each + * element of the array and its index. + * @returns A tuple containing two arrays: the first array contains elements for + * which the predicate returned a truthy value, and the second array contains elements for which the + * predicate returned a falsy value. + * + * @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[]) => unknown): [truthy: T[], falsy: T[]]; +//#endregion +export { partition }; \ No newline at end of file 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..5edad2bdfce1f77c4dc617db95904050c5dc0e4d --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.d.ts @@ -0,0 +1,51 @@ +//#region src/array/partition.d.ts +/** + * 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 arr - The array to partition. + * @param 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 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 arr - The array to partition. + * @param isInTruthy - A predicate function that determines + * whether an element should be placed in the truthy array. An element is placed in the truthy + * array when the function returns a truthy value. The function is called with each + * element of the array and its index. + * @returns A tuple containing two arrays: the first array contains elements for + * which the predicate returned a truthy value, and the second array contains elements for which the + * predicate returned a falsy value. + * + * @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[]) => unknown): [truthy: T[], falsy: T[]]; +//#endregion +export { partition }; \ No newline at end of file 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..62c814094c11a3538f568ab4767081c9b2b94748 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.js @@ -0,0 +1,13 @@ +//#region src/array/partition.ts +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]; +} +//#endregion +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..611687fabbdf5a7d8274310dcd85aa355cb20d71 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/partition.mjs @@ -0,0 +1,13 @@ +//#region src/array/partition.ts +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]; +} +//#endregion +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..67064510f1ba6f3f5f36c2c36993afdaf7a01c97 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.d.mts @@ -0,0 +1,20 @@ +//#region src/array/pull.d.ts +/** + * 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 + * @param arr - The array to modify. + * @param valuesToRemove - The values to remove from the array. + * @returns 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[]; +//#endregion +export { pull }; \ No newline at end of file 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..67064510f1ba6f3f5f36c2c36993afdaf7a01c97 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.d.ts @@ -0,0 +1,20 @@ +//#region src/array/pull.d.ts +/** + * 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 + * @param arr - The array to modify. + * @param valuesToRemove - The values to remove from the array. + * @returns 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[]; +//#endregion +export { pull }; \ No newline at end of file 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..f139282fb4d4a4ebaa493899a8be8303a2e86df2 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.js @@ -0,0 +1,33 @@ +//#region src/array/pull.ts +/** +* 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 +* @param arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @returns 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] +*/ +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; +} +//#endregion +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..a676bab49eb837d0f254146c5e546f26aa1d1515 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pull.mjs @@ -0,0 +1,33 @@ +//#region src/array/pull.ts +/** +* 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 +* @param arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @returns 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] +*/ +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; +} +//#endregion +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..ca3bc18f61cc7e3c180167c97b085009feef16ac --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.d.mts @@ -0,0 +1,20 @@ +//#region src/array/pullAt.d.ts +/** + * 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 arr - The array from which elements will be removed. + * @param indicesToRemove - An array of indices specifying the positions of elements to remove. + * @returns 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[]; +//#endregion +export { pullAt }; \ No newline at end of file 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..ca3bc18f61cc7e3c180167c97b085009feef16ac --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.d.ts @@ -0,0 +1,20 @@ +//#region src/array/pullAt.d.ts +/** + * 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 arr - The array from which elements will be removed. + * @param indicesToRemove - An array of indices specifying the positions of elements to remove. + * @returns 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[]; +//#endregion +export { pullAt }; \ No newline at end of file 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..91330259526acc0d5c3f9660d3588503afe6c341 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.js @@ -0,0 +1,26 @@ +const require_at = require("./at.js"); +//#region src/array/pullAt.ts +/** +* 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 arr - The array from which elements will be removed. +* @param indicesToRemove - An array of indices specifying the positions of elements to remove. +* @returns 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] +*/ +function pullAt(arr, indicesToRemove) { + const removed = require_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; +} +//#endregion +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..33f80316fa223f9e17050cf46ada4b7fae52d612 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/pullAt.mjs @@ -0,0 +1,26 @@ +import { at } from "./at.mjs"; +//#region src/array/pullAt.ts +/** +* 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 arr - The array from which elements will be removed. +* @param indicesToRemove - An array of indices specifying the positions of elements to remove. +* @returns 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] +*/ +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; +} +//#endregion +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..52e9451f816ff81ab7e16b6615232a2c401dbd00 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.d.mts @@ -0,0 +1,72 @@ +//#region src/array/reduceAsync.d.ts +/** + * 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 array The array to reduce. + * @param reducer An async function that processes each element. + * @param initialValue The initial value of the accumulator. + * @returns 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 array The array to reduce. + * @param reducer An async function that processes each element. + * @returns 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; +//#endregion +export { reduceAsync }; \ No newline at end of file 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..52e9451f816ff81ab7e16b6615232a2c401dbd00 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.d.ts @@ -0,0 +1,72 @@ +//#region src/array/reduceAsync.d.ts +/** + * 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 array The array to reduce. + * @param reducer An async function that processes each element. + * @param initialValue The initial value of the accumulator. + * @returns 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 array The array to reduce. + * @param reducer An async function that processes each element. + * @returns 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; +//#endregion +export { reduceAsync }; \ No newline at end of file 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..ae96beee48cd75cff14457a49eb121d5604d473a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.js @@ -0,0 +1,13 @@ +//#region src/array/reduceAsync.ts +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; +} +//#endregion +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..6d0b08e83b399547eb1e3210f72f00b13839fc3c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/reduceAsync.mjs @@ -0,0 +1,13 @@ +//#region src/array/reduceAsync.ts +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; +} +//#endregion +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..f2cc2ecea4a61e5dbab20f4c4ce48e5c4b7be82c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.d.mts @@ -0,0 +1,20 @@ +//#region src/array/remove.d.ts +/** + * 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 arr - The array to modify. + * @param shouldRemoveElement - The function invoked per iteration to determine if an element should be removed. + * @returns 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[]; +//#endregion +export { remove }; \ No newline at end of file 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..f2cc2ecea4a61e5dbab20f4c4ce48e5c4b7be82c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.d.ts @@ -0,0 +1,20 @@ +//#region src/array/remove.d.ts +/** + * 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 arr - The array to modify. + * @param shouldRemoveElement - The function invoked per iteration to determine if an element should be removed. + * @returns 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[]; +//#endregion +export { remove }; \ No newline at end of file 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..d81fb6bcd30522d218423b3df617684ab6cad007 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.js @@ -0,0 +1,37 @@ +//#region src/array/remove.ts +/** +* 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 arr - The array to modify. +* @param shouldRemoveElement - The function invoked per iteration to determine if an element should be removed. +* @returns 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] +*/ +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; +} +//#endregion +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..275d2ebe1a0664b76b448a741613f63b5dff1787 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/remove.mjs @@ -0,0 +1,37 @@ +//#region src/array/remove.ts +/** +* 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 arr - The array to modify. +* @param shouldRemoveElement - The function invoked per iteration to determine if an element should be removed. +* @returns 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] +*/ +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; +} +//#endregion +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..507a35f9a8232b8ab80387942e3109c24a47ceab --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.d.mts @@ -0,0 +1,18 @@ +//#region src/array/sample.d.ts +/** + * 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 arr - The array to sample from. + * @returns 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; +//#endregion +export { sample }; \ No newline at end of file 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..507a35f9a8232b8ab80387942e3109c24a47ceab --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.d.ts @@ -0,0 +1,18 @@ +//#region src/array/sample.d.ts +/** + * 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 arr - The array to sample from. + * @returns 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; +//#endregion +export { sample }; \ No newline at end of file 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..30324242d7c07f2d2e1df784276cedeea64e874c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.js @@ -0,0 +1,20 @@ +//#region src/array/sample.ts +/** +* 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 arr - The array to sample from. +* @returns 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. +*/ +function sample(arr) { + return arr[Math.floor(Math.random() * arr.length)]; +} +//#endregion +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..617a491bbdb010fb118c2fecffc9e93a39f191a9 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sample.mjs @@ -0,0 +1,20 @@ +//#region src/array/sample.ts +/** +* 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 arr - The array to sample from. +* @returns 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. +*/ +function sample(arr) { + return arr[Math.floor(Math.random() * arr.length)]; +} +//#endregion +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..fc1ba693c4b384c1bcc8a20ea55747cfdcb4a10f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.d.mts @@ -0,0 +1,22 @@ +//#region src/array/sampleSize.d.ts +/** + * 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 array - The array to sample from. + * @param size - The size of sample. + * @returns 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[]; +//#endregion +export { sampleSize }; \ No newline at end of file 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..fc1ba693c4b384c1bcc8a20ea55747cfdcb4a10f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.d.ts @@ -0,0 +1,22 @@ +//#region src/array/sampleSize.d.ts +/** + * 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 array - The array to sample from. + * @param size - The size of sample. + * @returns 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[]; +//#endregion +export { sampleSize }; \ No newline at end of file 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..9e39c5445fdb5e082e7c6e452cef1bb914820983 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.js @@ -0,0 +1,34 @@ +const require_randomInt = require("../math/randomInt.js"); +//#region src/array/sampleSize.ts +/** +* 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 array - The array to sample from. +* @param size - The size of sample. +* @returns 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] +*/ +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 = /* @__PURE__ */ new Set(); + for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) { + let index = require_randomInt.randomInt(0, step + 1); + if (selected.has(index)) index = step; + selected.add(index); + result[resultIndex] = array[index]; + } + return result; +} +//#endregion +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..8373c1d977fef0ea76a43b21ba39292918a3a16f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sampleSize.mjs @@ -0,0 +1,34 @@ +import { randomInt } from "../math/randomInt.mjs"; +//#region src/array/sampleSize.ts +/** +* 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 array - The array to sample from. +* @param size - The size of sample. +* @returns 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] +*/ +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 = /* @__PURE__ */ 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; +} +//#endregion +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..54643730444fcf0328376a73c15daad047fc34e3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.d.mts @@ -0,0 +1,18 @@ +//#region src/array/shuffle.d.ts +/** + * 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 arr - The array to shuffle. + * @returns 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[]; +//#endregion +export { shuffle }; \ No newline at end of file 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..54643730444fcf0328376a73c15daad047fc34e3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.d.ts @@ -0,0 +1,18 @@ +//#region src/array/shuffle.d.ts +/** + * 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 arr - The array to shuffle. + * @returns 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[]; +//#endregion +export { shuffle }; \ No newline at end of file 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..7048ea797af92f468f9b61201797f9493e234d1f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.js @@ -0,0 +1,28 @@ +//#region src/array/shuffle.ts +/** +* 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 arr - The array to shuffle. +* @returns 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] +*/ +function shuffle(arr) { + const result = arr.slice(); + /** + * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm + */ + 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; +} +//#endregion +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..8a3c8d84b0c204dac2e76e41def36d3d89edbeca --- /dev/null +++ b/node_modules/es-toolkit/dist/array/shuffle.mjs @@ -0,0 +1,28 @@ +//#region src/array/shuffle.ts +/** +* 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 arr - The array to shuffle. +* @returns 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] +*/ +function shuffle(arr) { + const result = arr.slice(); + /** + * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm + */ + 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; +} +//#endregion +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..4a2f5e0c099917c1a612d545e02130e6ce3eda02 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.d.mts @@ -0,0 +1,36 @@ +//#region src/array/sortBy.d.ts +/** + * 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 arr - The array of objects to be sorted. + * @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @returns 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[]; +//#endregion +export { sortBy }; \ No newline at end of file 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..4a2f5e0c099917c1a612d545e02130e6ce3eda02 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.d.ts @@ -0,0 +1,36 @@ +//#region src/array/sortBy.d.ts +/** + * 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 arr - The array of objects to be sorted. + * @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. + * @returns 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[]; +//#endregion +export { sortBy }; \ No newline at end of file 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..583a5c07542cf3df0f495fae8d6bf49e4b9fa081 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.js @@ -0,0 +1,39 @@ +const require_orderBy = require("./orderBy.js"); +//#region src/array/sortBy.ts +/** +* 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 arr - The array of objects to be sorted. +* @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. +* @returns 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 }, +* // ] +*/ +function sortBy(arr, criteria) { + return require_orderBy.orderBy(arr, criteria, ["asc"]); +} +//#endregion +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..e04c255d5aaa9d3f071d149a7628a404200d5709 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/sortBy.mjs @@ -0,0 +1,39 @@ +import { orderBy } from "./orderBy.mjs"; +//#region src/array/sortBy.ts +/** +* 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 arr - The array of objects to be sorted. +* @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting. +* @returns 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 }, +* // ] +*/ +function sortBy(arr, criteria) { + return orderBy(arr, criteria, ["asc"]); +} +//#endregion +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..85aa8d4f96c358a265d37a4b19bed2199e64804f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.d.mts @@ -0,0 +1,68 @@ +//#region src/array/tail.d.ts +/** + * Returns an empty array when the input is a single-element array. + * + * @template T - The type of the single element in the array. + * @param 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 arr - The tuple array to process. + * @returns 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 arr - The array to get the tail of. + * @returns 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[]; +//#endregion +export { tail }; \ No newline at end of file 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..85aa8d4f96c358a265d37a4b19bed2199e64804f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.d.ts @@ -0,0 +1,68 @@ +//#region src/array/tail.d.ts +/** + * Returns an empty array when the input is a single-element array. + * + * @template T - The type of the single element in the array. + * @param 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 arr - The tuple array to process. + * @returns 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 arr - The array to get the tail of. + * @returns 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[]; +//#endregion +export { tail }; \ No newline at end of file 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..feb120414fbd0277068a0578a3bfe7bfc81bb0db --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.js @@ -0,0 +1,30 @@ +//#region src/array/tail.ts +/** +* 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 arr - The array to get the tail of. +* @returns 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 [] +*/ +function tail(arr) { + return arr.slice(1); +} +//#endregion +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..31dc0abf7872d3e6659a0455391cb2246eb12468 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/tail.mjs @@ -0,0 +1,30 @@ +//#region src/array/tail.ts +/** +* 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 arr - The array to get the tail of. +* @returns 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 [] +*/ +function tail(arr) { + return arr.slice(1); +} +//#endregion +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..d16220486f6c8ad403a152e1602f2b78cf2db03e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.d.mts @@ -0,0 +1,26 @@ +//#region src/array/take.d.ts +/** + * 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 arr - The array to take elements from. + * @param count - The number of elements to take. + * @returns 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); + */ +declare function take(arr: readonly T[], count: number): T[]; +//#endregion +export { take }; \ No newline at end of file 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..d16220486f6c8ad403a152e1602f2b78cf2db03e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.d.ts @@ -0,0 +1,26 @@ +//#region src/array/take.d.ts +/** + * 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 arr - The array to take elements from. + * @param count - The number of elements to take. + * @returns 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); + */ +declare function take(arr: readonly T[], count: number): T[]; +//#endregion +export { take }; \ No newline at end of file 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..568f7480845826243b847e60159d0ab7f020e3bb --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.js @@ -0,0 +1,28 @@ +//#region src/array/take.ts +/** +* 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 arr - The array to take elements from. +* @param count - The number of elements to take. +* @returns 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); +*/ +function take(arr, count) { + return arr.slice(0, count); +} +//#endregion +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..8d16dcae317c142ec5343d3ad330d9603ef34930 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/take.mjs @@ -0,0 +1,28 @@ +//#region src/array/take.ts +/** +* 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 arr - The array to take elements from. +* @param count - The number of elements to take. +* @returns 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); +*/ +function take(arr, count) { + return arr.slice(0, count); +} +//#endregion +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..7fed3218fa905198d5af714264862e2bcda6d251 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.d.mts @@ -0,0 +1,25 @@ +//#region src/array/takeRight.d.ts +/** + * 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 arr - The array to take elements from. + * @param count - The number of elements to take. + * @returns 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): T[]; +//#endregion +export { takeRight }; \ No newline at end of file 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..7fed3218fa905198d5af714264862e2bcda6d251 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.d.ts @@ -0,0 +1,25 @@ +//#region src/array/takeRight.d.ts +/** + * 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 arr - The array to take elements from. + * @param count - The number of elements to take. + * @returns 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): T[]; +//#endregion +export { takeRight }; \ No newline at end of file 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..5323746bfb78c57c3f9843aa5eff0681adf7f642 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.js @@ -0,0 +1,28 @@ +//#region src/array/takeRight.ts +/** +* 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 arr - The array to take elements from. +* @param count - The number of elements to take. +* @returns 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); +*/ +function takeRight(arr, count) { + if (count <= 0 || arr.length === 0) return []; + return arr.slice(-count); +} +//#endregion +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..d9bffb68f6052de446d96c738d76c50d15c5964b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRight.mjs @@ -0,0 +1,28 @@ +//#region src/array/takeRight.ts +/** +* 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 arr - The array to take elements from. +* @param count - The number of elements to take. +* @returns 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); +*/ +function takeRight(arr, count) { + if (count <= 0 || arr.length === 0) return []; + return arr.slice(-count); +} +//#endregion +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..d04a7a9c25f95b5644ce65baafce32ec0208d31a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.d.mts @@ -0,0 +1,26 @@ +//#region src/array/takeRightWhile.d.ts +/** + * Takes elements from the end of the array while the predicate function returns `true`. + * + * @template T - Type of elements in the input array. + * + * @param arr - The array to take elements from. + * @param shouldContinueTaking - The function invoked per element with the item, its index, and the array. + * @returns 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[]; +//#endregion +export { takeRightWhile }; \ No newline at end of file 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..d04a7a9c25f95b5644ce65baafce32ec0208d31a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.d.ts @@ -0,0 +1,26 @@ +//#region src/array/takeRightWhile.d.ts +/** + * Takes elements from the end of the array while the predicate function returns `true`. + * + * @template T - Type of elements in the input array. + * + * @param arr - The array to take elements from. + * @param shouldContinueTaking - The function invoked per element with the item, its index, and the array. + * @returns 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[]; +//#endregion +export { takeRightWhile }; \ No newline at end of file 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..f4d339aa402e5b4e8115a2683d47d5df3c78e722 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.js @@ -0,0 +1,29 @@ +//#region src/array/takeRightWhile.ts +/** +* Takes elements from the end of the array while the predicate function returns `true`. +* +* @template T - Type of elements in the input array. +* +* @param arr - The array to take elements from. +* @param shouldContinueTaking - The function invoked per element with the item, its index, and the array. +* @returns 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] +*/ +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(); +} +//#endregion +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..a792ce82f99e93169c4195b5763e9e55fd0a6e59 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeRightWhile.mjs @@ -0,0 +1,29 @@ +//#region src/array/takeRightWhile.ts +/** +* Takes elements from the end of the array while the predicate function returns `true`. +* +* @template T - Type of elements in the input array. +* +* @param arr - The array to take elements from. +* @param shouldContinueTaking - The function invoked per element with the item, its index, and the array. +* @returns 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] +*/ +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(); +} +//#endregion +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..1c35eb9d2d89a47b444d0ee97093f57f30b04a13 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.d.mts @@ -0,0 +1,27 @@ +//#region src/array/takeWhile.d.ts +/** + * 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 arr - The array to process. + * @param 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 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[]; +//#endregion +export { takeWhile }; \ No newline at end of file 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..1c35eb9d2d89a47b444d0ee97093f57f30b04a13 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.d.ts @@ -0,0 +1,27 @@ +//#region src/array/takeWhile.d.ts +/** + * 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 arr - The array to process. + * @param 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 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[]; +//#endregion +export { takeWhile }; \ No newline at end of file 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..700decceba658bf6a29da6f3d2be7d4deefa7b09 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.js @@ -0,0 +1,35 @@ +//#region src/array/takeWhile.ts +/** +* 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 arr - The array to process. +* @param 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 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] +*/ +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; +} +//#endregion +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..8d95e77da44daa2e0bc1554b16aeef086fee8478 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/takeWhile.mjs @@ -0,0 +1,35 @@ +//#region src/array/takeWhile.ts +/** +* 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 arr - The array to process. +* @param 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 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] +*/ +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; +} +//#endregion +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..c840df0fbb263901bed3dd31908feb8fe029c500 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.d.mts @@ -0,0 +1,93 @@ +//#region src/array/toFilled.d.ts +/** + * 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 arr - The array to base the new array on. + * @param value - The value to fill the new array with. + * @returns 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 arr - The array to base the new array on. + * @param value - The value to fill the new array with. + * @param [start=0] - The start position. Defaults to 0. + * @returns 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 arr - The array to base the new array on. + * @param value - The value to fill the new array with. + * @param [start=0] - The start position. Defaults to 0. + * @param [end=arr.length] - The end position. Defaults to the array's length. + * @returns 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; +//#endregion +export { toFilled }; \ No newline at end of file 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..c840df0fbb263901bed3dd31908feb8fe029c500 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.d.ts @@ -0,0 +1,93 @@ +//#region src/array/toFilled.d.ts +/** + * 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 arr - The array to base the new array on. + * @param value - The value to fill the new array with. + * @returns 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 arr - The array to base the new array on. + * @param value - The value to fill the new array with. + * @param [start=0] - The start position. Defaults to 0. + * @returns 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 arr - The array to base the new array on. + * @param value - The value to fill the new array with. + * @param [start=0] - The start position. Defaults to 0. + * @param [end=arr.length] - The end position. Defaults to the array's length. + * @returns 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; +//#endregion +export { toFilled }; \ No newline at end of file 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..0e8c3166abaaeaec5967ad7e8032630a0dc24603 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.js @@ -0,0 +1,23 @@ +//#region src/array/toFilled.ts +/** +* 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 arr - The array to base the new array on. +* @param value - The value to fill the new array with. +* @param [start=0] - The start position. Defaults to 0. +* @param [end=arr.length] - The end position. Defaults to the array's length. +* @returns The new array with the filled values. +*/ +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; +} +//#endregion +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..0883f4a207efb0eba1c022368cbc46259088c832 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/toFilled.mjs @@ -0,0 +1,23 @@ +//#region src/array/toFilled.ts +/** +* 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 arr - The array to base the new array on. +* @param value - The value to fill the new array with. +* @param [start=0] - The start position. Defaults to 0. +* @param [end=arr.length] - The end position. Defaults to the array's length. +* @returns The new array with the filled values. +*/ +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; +} +//#endregion +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..a26b69a54afb4e79e6765fd1ae9867e272077f1e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.d.mts @@ -0,0 +1,21 @@ +//#region src/array/union.d.ts +/** + * 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 arr1 - The first array to merge and filter for unique values. + * @param arr2 - The second array to merge and filter for unique values. + * @returns 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[]; +//#endregion +export { union }; \ No newline at end of file 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..a26b69a54afb4e79e6765fd1ae9867e272077f1e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.d.ts @@ -0,0 +1,21 @@ +//#region src/array/union.d.ts +/** + * 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 arr1 - The first array to merge and filter for unique values. + * @param arr2 - The second array to merge and filter for unique values. + * @returns 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[]; +//#endregion +export { union }; \ No newline at end of file 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..c4ded9dbe1aeae5d8a41ce53e1ed4cb7963ed3a8 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.js @@ -0,0 +1,24 @@ +const require_uniq = require("./uniq.js"); +//#region src/array/union.ts +/** +* 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 arr1 - The first array to merge and filter for unique values. +* @param arr2 - The second array to merge and filter for unique values. +* @returns 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] +*/ +function union(arr1, arr2) { + return require_uniq.uniq(arr1.concat(arr2)); +} +//#endregion +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..3afc700eccd365fafcba2b7974a712d38709e1b5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/union.mjs @@ -0,0 +1,24 @@ +import { uniq } from "./uniq.mjs"; +//#region src/array/union.ts +/** +* 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 arr1 - The first array to merge and filter for unique values. +* @param arr2 - The second array to merge and filter for unique values. +* @returns 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] +*/ +function union(arr1, arr2) { + return uniq(arr1.concat(arr2)); +} +//#endregion +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..43082d89143b477010b00cc20a3cbe558f30fe40 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.d.mts @@ -0,0 +1,26 @@ +//#region src/array/unionBy.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @param mapper - The function to map array elements to comparison values. + * @returns 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[]; +//#endregion +export { unionBy }; \ No newline at end of file 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..43082d89143b477010b00cc20a3cbe558f30fe40 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.d.ts @@ -0,0 +1,26 @@ +//#region src/array/unionBy.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @param mapper - The function to map array elements to comparison values. + * @returns 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[]; +//#endregion +export { unionBy }; \ No newline at end of file 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..540ab3d257b1a7efe9b9f5d3921d5dee9493dcff --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.js @@ -0,0 +1,29 @@ +const require_uniqBy = require("./uniqBy.js"); +//#region src/array/unionBy.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @param mapper - The function to map array elements to comparison values. +* @returns 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 }] +*/ +function unionBy(arr1, arr2, mapper) { + return require_uniqBy.uniqBy(arr1.concat(arr2), mapper); +} +//#endregion +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..65d9294f55fd2afbc1166ea4045cec993c1c4a3e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionBy.mjs @@ -0,0 +1,29 @@ +import { uniqBy } from "./uniqBy.mjs"; +//#region src/array/unionBy.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @param mapper - The function to map array elements to comparison values. +* @returns 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 }] +*/ +function unionBy(arr1, arr2, mapper) { + return uniqBy(arr1.concat(arr2), mapper); +} +//#endregion +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..dc91aca979df077d9dada376bc48fbcdbb1fd488 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.d.mts @@ -0,0 +1,24 @@ +//#region src/array/unionWith.d.ts +/** + * 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 arr1 - The first array to merge and filter for unique values. + * @param arr2 - The second array to merge and filter for unique values. + * @param 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 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[]; +//#endregion +export { unionWith }; \ No newline at end of file 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..dc91aca979df077d9dada376bc48fbcdbb1fd488 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.d.ts @@ -0,0 +1,24 @@ +//#region src/array/unionWith.d.ts +/** + * 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 arr1 - The first array to merge and filter for unique values. + * @param arr2 - The second array to merge and filter for unique values. + * @param 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 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[]; +//#endregion +export { unionWith }; \ No newline at end of file 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..5503f410491ce5153de478880ed2ff691e8c7759 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.js @@ -0,0 +1,27 @@ +const require_uniqWith = require("./uniqWith.js"); +//#region src/array/unionWith.ts +/** +* 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 arr1 - The first array to merge and filter for unique values. +* @param arr2 - The second array to merge and filter for unique values. +* @param 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 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 +*/ +function unionWith(arr1, arr2, areItemsEqual) { + return require_uniqWith.uniqWith(arr1.concat(arr2), areItemsEqual); +} +//#endregion +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..31270af1fb7019f9ecb297fda1fa41679fb7dc4a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unionWith.mjs @@ -0,0 +1,27 @@ +import { uniqWith } from "./uniqWith.mjs"; +//#region src/array/unionWith.ts +/** +* 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 arr1 - The first array to merge and filter for unique values. +* @param arr2 - The second array to merge and filter for unique values. +* @param 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 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 +*/ +function unionWith(arr1, arr2, areItemsEqual) { + return uniqWith(arr1.concat(arr2), areItemsEqual); +} +//#endregion +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..e2ee31048f69d4ed2179aa2c25b0b174e35d223c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.d.mts @@ -0,0 +1,19 @@ +//#region src/array/uniq.d.ts +/** + * 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 arr - The array to process. + * @returns 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[]; +//#endregion +export { uniq }; \ No newline at end of file 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..e2ee31048f69d4ed2179aa2c25b0b174e35d223c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.d.ts @@ -0,0 +1,19 @@ +//#region src/array/uniq.d.ts +/** + * 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 arr - The array to process. + * @returns 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[]; +//#endregion +export { uniq }; \ No newline at end of file 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..467782bb1fbc08ab7cafc0aaee9027b86424707f --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.js @@ -0,0 +1,21 @@ +//#region src/array/uniq.ts +/** +* 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 arr - The array to process. +* @returns 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] +*/ +function uniq(arr) { + return [...new Set(arr)]; +} +//#endregion +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..5d901a7696fee950867ed30d94fdec2e8cff8801 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniq.mjs @@ -0,0 +1,21 @@ +//#region src/array/uniq.ts +/** +* 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 arr - The array to process. +* @returns 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] +*/ +function uniq(arr) { + return [...new Set(arr)]; +} +//#endregion +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..1505e5a46422844b20967346230ece2d47bb4391 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.d.mts @@ -0,0 +1,32 @@ +//#region src/array/uniqBy.d.ts +/** + * 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 arr - The array to process. + * @param mapper - The function used to convert the array elements. + * @returns 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[]; +//#endregion +export { uniqBy }; \ No newline at end of file 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..1505e5a46422844b20967346230ece2d47bb4391 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.d.ts @@ -0,0 +1,32 @@ +//#region src/array/uniqBy.d.ts +/** + * 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 arr - The array to process. + * @param mapper - The function used to convert the array elements. + * @returns 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[]; +//#endregion +export { uniqBy }; \ No newline at end of file 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..759b247a03b60972eaacf0a234f3eaacba6bf8f3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.js @@ -0,0 +1,40 @@ +//#region src/array/uniqBy.ts +/** +* 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 arr - The array to process. +* @param mapper - The function used to convert the array elements. +* @returns 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 +* ``` +*/ +function uniqBy(arr, mapper) { + const map = /* @__PURE__ */ 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()); +} +//#endregion +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..897fe04517428b8cecc5c6797c7ed89acad421d1 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqBy.mjs @@ -0,0 +1,40 @@ +//#region src/array/uniqBy.ts +/** +* 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 arr - The array to process. +* @param mapper - The function used to convert the array elements. +* @returns 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 +* ``` +*/ +function uniqBy(arr, mapper) { + const map = /* @__PURE__ */ 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()); +} +//#endregion +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..a83ca4d3e0da75e7e8a4d1b84f4eb9f07bf5f066 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.d.mts @@ -0,0 +1,19 @@ +//#region src/array/uniqWith.d.ts +/** + * 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 arr - The array to process. + * @param areItemsEqual - The function used to compare the array elements. + * @returns 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[]; +//#endregion +export { uniqWith }; \ No newline at end of file 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..a83ca4d3e0da75e7e8a4d1b84f4eb9f07bf5f066 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.d.ts @@ -0,0 +1,19 @@ +//#region src/array/uniqWith.d.ts +/** + * 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 arr - The array to process. + * @param areItemsEqual - The function used to compare the array elements. + * @returns 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[]; +//#endregion +export { uniqWith }; \ No newline at end of file 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..a4e6678eae4890a03a6b285626f8e895384e2860 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.js @@ -0,0 +1,26 @@ +//#region src/array/uniqWith.ts +/** +* 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 arr - The array to process. +* @param areItemsEqual - The function used to compare the array elements. +* @returns 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] +* ``` +*/ +function uniqWith(arr, areItemsEqual) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (result.every((v) => !areItemsEqual(v, item))) result.push(item); + } + return result; +} +//#endregion +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..02bb914fa8347ada8b57179275715937e67f6297 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/uniqWith.mjs @@ -0,0 +1,26 @@ +//#region src/array/uniqWith.ts +/** +* 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 arr - The array to process. +* @param areItemsEqual - The function used to compare the array elements. +* @returns 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] +* ``` +*/ +function uniqWith(arr, areItemsEqual) { + const result = []; + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (result.every((v) => !areItemsEqual(v, item))) result.push(item); + } + return result; +} +//#endregion +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..446b92fcb877bcb2d4063819152d39fd392ffa7b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.d.mts @@ -0,0 +1,18 @@ +//#region src/array/unzip.d.ts +/** + * 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 zipped - The nested array to unzip. + * @returns 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 }; +//#endregion +export { unzip }; \ No newline at end of file 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..446b92fcb877bcb2d4063819152d39fd392ffa7b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.d.ts @@ -0,0 +1,18 @@ +//#region src/array/unzip.d.ts +/** + * 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 zipped - The nested array to unzip. + * @returns 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 }; +//#endregion +export { unzip }; \ No newline at end of file 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..b59cd92d5cd48c67e27e5e86109af20e3499bbf6 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.js @@ -0,0 +1,26 @@ +//#region src/array/unzip.ts +/** +* 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 zipped - The nested array to unzip. +* @returns 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]] +*/ +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; +} +//#endregion +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..0e9e87960cf99ffa89f8097cbeabfb051df7c3ae --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzip.mjs @@ -0,0 +1,26 @@ +//#region src/array/unzip.ts +/** +* 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 zipped - The nested array to unzip. +* @returns 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]] +*/ +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; +} +//#endregion +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..df88ee6474c556170781295190d0d2a2ce85264a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.d.mts @@ -0,0 +1,18 @@ +//#region src/array/unzipWith.d.ts +/** + * Unzips an array of arrays, applying an `iteratee` function to regrouped elements. + * + * @template T, R + * @param target - The nested array to unzip. This is an array of arrays, + * where each inner array contains elements to be unzipped. + * @param iteratee - A function to transform the unzipped elements. + * @returns 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[]; +//#endregion +export { unzipWith }; \ No newline at end of file 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..df88ee6474c556170781295190d0d2a2ce85264a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.d.ts @@ -0,0 +1,18 @@ +//#region src/array/unzipWith.d.ts +/** + * Unzips an array of arrays, applying an `iteratee` function to regrouped elements. + * + * @template T, R + * @param target - The nested array to unzip. This is an array of arrays, + * where each inner array contains elements to be unzipped. + * @param iteratee - A function to transform the unzipped elements. + * @returns 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[]; +//#endregion +export { unzipWith }; \ No newline at end of file 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..f66af0b3e74f3b0ad85bc2ba976767ed7223e1b4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.js @@ -0,0 +1,27 @@ +//#region src/array/unzipWith.ts +/** +* Unzips an array of arrays, applying an `iteratee` function to regrouped elements. +* +* @template T, R +* @param target - The nested array to unzip. This is an array of arrays, +* where each inner array contains elements to be unzipped. +* @param iteratee - A function to transform the unzipped elements. +* @returns 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] +*/ +function unzipWith(target, iteratee) { + const maxLength = Math.max(0, ...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; +} +//#endregion +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..cbd48b0d71cc2b06b7835c923dbda207b1b4a884 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/unzipWith.mjs @@ -0,0 +1,27 @@ +//#region src/array/unzipWith.ts +/** +* Unzips an array of arrays, applying an `iteratee` function to regrouped elements. +* +* @template T, R +* @param target - The nested array to unzip. This is an array of arrays, +* where each inner array contains elements to be unzipped. +* @param iteratee - A function to transform the unzipped elements. +* @returns 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] +*/ +function unzipWith(target, iteratee) { + const maxLength = Math.max(0, ...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; +} +//#endregion +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..1736b92225eca20420ddfa5a95b99643c41c2577 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.d.mts @@ -0,0 +1,53 @@ +//#region src/array/windowed.d.ts +/** + * 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 arr - The input array to create windows from. + * @param size - The size of each window. Must be a positive integer. + * @param [step=1] - The step size between the start of each window. Must be a positive integer. + * @param [options={}] - Options object to configure the behavior of the function. + * @param [options.partialWindows=false] - Whether to include partial windows at the end of the array. + * @returns 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[][]; +//#endregion +export { WindowedOptions, windowed }; \ No newline at end of file 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..1736b92225eca20420ddfa5a95b99643c41c2577 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.d.ts @@ -0,0 +1,53 @@ +//#region src/array/windowed.d.ts +/** + * 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 arr - The input array to create windows from. + * @param size - The size of each window. Must be a positive integer. + * @param [step=1] - The step size between the start of each window. Must be a positive integer. + * @param [options={}] - Options object to configure the behavior of the function. + * @param [options.partialWindows=false] - Whether to include partial windows at the end of the array. + * @returns 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[][]; +//#endregion +export { WindowedOptions, windowed }; \ No newline at end of file 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..74c05689b8d3244f7a86ec4da47233e1fdda24ca --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.js @@ -0,0 +1,41 @@ +//#region src/array/windowed.ts +/** +* 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 arr - The input array to create windows from. +* @param size - The size of each window. Must be a positive integer. +* @param [step=1] - The step size between the start of each window. Must be a positive integer. +* @param [options={}] - Options object to configure the behavior of the function. +* @param [options.partialWindows=false] - Whether to include partial windows at the end of the array. +* @returns 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]] +*/ +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; +} +//#endregion +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..4e8d8b203dc4cd16f14a0518bc147dbaa1592d15 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/windowed.mjs @@ -0,0 +1,41 @@ +//#region src/array/windowed.ts +/** +* 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 arr - The input array to create windows from. +* @param size - The size of each window. Must be a positive integer. +* @param [step=1] - The step size between the start of each window. Must be a positive integer. +* @param [options={}] - Options object to configure the behavior of the function. +* @param [options.partialWindows=false] - Whether to include partial windows at the end of the array. +* @returns 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]] +*/ +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; +} +//#endregion +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..80f973084021fc1b82e1ba898409ffe635450633 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.d.mts @@ -0,0 +1,24 @@ +//#region src/array/without.d.ts +/** + * 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 array - The array to filter. + * @param values - The values to exclude. + * @returns 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[]; +//#endregion +export { without }; \ No newline at end of file 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..80f973084021fc1b82e1ba898409ffe635450633 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.d.ts @@ -0,0 +1,24 @@ +//#region src/array/without.d.ts +/** + * 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 array - The array to filter. + * @param values - The values to exclude. + * @returns 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[]; +//#endregion +export { without }; \ No newline at end of file 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..3f9f7ec42ffeb868d34a6cf0d4754684391cf845 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.js @@ -0,0 +1,27 @@ +const require_difference = require("./difference.js"); +//#region src/array/without.ts +/** +* 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 array - The array to filter. +* @param values - The values to exclude. +* @returns 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'] +*/ +function without(array, ...values) { + return require_difference.difference(array, values); +} +//#endregion +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..c723997767370dc0915c2ac52cafb4ccf8192f4c --- /dev/null +++ b/node_modules/es-toolkit/dist/array/without.mjs @@ -0,0 +1,27 @@ +import { difference } from "./difference.mjs"; +//#region src/array/without.ts +/** +* 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 array - The array to filter. +* @param values - The values to exclude. +* @returns 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'] +*/ +function without(array, ...values) { + return difference(array, values); +} +//#endregion +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..f4340a6d1b87000102a35f113c97e2e55e3a9c48 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.d.mts @@ -0,0 +1,21 @@ +//#region src/array/xor.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @returns 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[]; +//#endregion +export { xor }; \ No newline at end of file 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..f4340a6d1b87000102a35f113c97e2e55e3a9c48 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.d.ts @@ -0,0 +1,21 @@ +//#region src/array/xor.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @returns 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[]; +//#endregion +export { xor }; \ No newline at end of file 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..8773ffc96c83ce0c8e5d3a36e4d5c86bb9f819d3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.js @@ -0,0 +1,26 @@ +const require_difference = require("./difference.js"); +const require_intersection = require("./intersection.js"); +const require_union = require("./union.js"); +//#region src/array/xor.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @returns 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']); +*/ +function xor(arr1, arr2) { + return require_difference.difference(require_union.union(arr1, arr2), require_intersection.intersection(arr1, arr2)); +} +//#endregion +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..80dcf200a25db28ad2104a140158acc4c17ba0de --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xor.mjs @@ -0,0 +1,26 @@ +import { difference } from "./difference.mjs"; +import { intersection } from "./intersection.mjs"; +import { union } from "./union.mjs"; +//#region src/array/xor.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @returns 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']); +*/ +function xor(arr1, arr2) { + return difference(union(arr1, arr2), intersection(arr1, arr2)); +} +//#endregion +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..6cff91132630a756ee19c2dec0042ec4310c56b5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.d.mts @@ -0,0 +1,23 @@ +//#region src/array/xorBy.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @param mapper - The function to map array elements to comparison values. + * @returns 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[]; +//#endregion +export { xorBy }; \ No newline at end of file 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..6cff91132630a756ee19c2dec0042ec4310c56b5 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.d.ts @@ -0,0 +1,23 @@ +//#region src/array/xorBy.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @param mapper - The function to map array elements to comparison values. + * @returns 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[]; +//#endregion +export { xorBy }; \ No newline at end of file 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..484056ea136962d630979cd701bdb431287bf891 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.js @@ -0,0 +1,30 @@ +const require_differenceBy = require("./differenceBy.js"); +const require_intersectionBy = require("./intersectionBy.js"); +const require_unionBy = require("./unionBy.js"); +//#region src/array/xorBy.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @param mapper - The function to map array elements to comparison values. +* @returns 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 }] +*/ +function xorBy(arr1, arr2, mapper) { + const union = require_unionBy.unionBy(arr1, arr2, mapper); + const intersection = require_intersectionBy.intersectionBy(arr1, arr2, mapper); + return require_differenceBy.differenceBy(union, intersection, mapper); +} +//#endregion +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..37f2a768db6bf46c397b6a6a4e59c456354d6f73 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorBy.mjs @@ -0,0 +1,28 @@ +import { differenceBy } from "./differenceBy.mjs"; +import { intersectionBy } from "./intersectionBy.mjs"; +import { unionBy } from "./unionBy.mjs"; +//#region src/array/xorBy.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @param mapper - The function to map array elements to comparison values. +* @returns 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 }] +*/ +function xorBy(arr1, arr2, mapper) { + return differenceBy(unionBy(arr1, arr2, mapper), intersectionBy(arr1, arr2, mapper), mapper); +} +//#endregion +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..e666a858a13d26e25bfef2474eaa484c39256f4b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.d.mts @@ -0,0 +1,22 @@ +//#region src/array/xorWith.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @param areElementsEqual - The custom equality function to compare elements. + * @returns 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[]; +//#endregion +export { xorWith }; \ No newline at end of file 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..e666a858a13d26e25bfef2474eaa484c39256f4b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.d.ts @@ -0,0 +1,22 @@ +//#region src/array/xorWith.d.ts +/** + * 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 arr1 - The first array. + * @param arr2 - The second array. + * @param areElementsEqual - The custom equality function to compare elements. + * @returns 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[]; +//#endregion +export { xorWith }; \ No newline at end of file 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..aaf4ca1c4ac226cf58de8f549a766f8756c6681b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.js @@ -0,0 +1,29 @@ +const require_differenceWith = require("./differenceWith.js"); +const require_intersectionWith = require("./intersectionWith.js"); +const require_unionWith = require("./unionWith.js"); +//#region src/array/xorWith.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @param areElementsEqual - The custom equality function to compare elements. +* @returns 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 }] +*/ +function xorWith(arr1, arr2, areElementsEqual) { + const union = require_unionWith.unionWith(arr1, arr2, areElementsEqual); + const intersection = require_intersectionWith.intersectionWith(arr1, arr2, areElementsEqual); + return require_differenceWith.differenceWith(union, intersection, areElementsEqual); +} +//#endregion +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..76eb64775f7a07099a29c97a9382e1d25cfdde0b --- /dev/null +++ b/node_modules/es-toolkit/dist/array/xorWith.mjs @@ -0,0 +1,27 @@ +import { differenceWith } from "./differenceWith.mjs"; +import { intersectionWith } from "./intersectionWith.mjs"; +import { unionWith } from "./unionWith.mjs"; +//#region src/array/xorWith.ts +/** +* 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 arr1 - The first array. +* @param arr2 - The second array. +* @param areElementsEqual - The custom equality function to compare elements. +* @returns 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 }] +*/ +function xorWith(arr1, arr2, areElementsEqual) { + return differenceWith(unionWith(arr1, arr2, areElementsEqual), intersectionWith(arr1, arr2, areElementsEqual), areElementsEqual); +} +//#endregion +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..1b0db1c233f9927f0e3f34b30baa39ea9e0e2001 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.d.mts @@ -0,0 +1,107 @@ +//#region src/array/zip.d.ts +/** + * 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 arr1 - The first array to zip. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @param arr4 - The fourth array to zip. + * @returns 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 arrs - The arrays to zip together. + * @returns 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[][]; +//#endregion +export { zip }; \ No newline at end of file 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..1b0db1c233f9927f0e3f34b30baa39ea9e0e2001 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.d.ts @@ -0,0 +1,107 @@ +//#region src/array/zip.d.ts +/** + * 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 arr1 - The first array to zip. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @param arr4 - The fourth array to zip. + * @returns 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 arrs - The arrays to zip together. + * @returns 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[][]; +//#endregion +export { zip }; \ No newline at end of file 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..d395f00920dc583afff1be010b0727e11906efb0 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.js @@ -0,0 +1,34 @@ +//#region src/array/zip.ts +/** +* 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 arrs - The arrays to zip together. +* @returns 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]] +*/ +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; +} +//#endregion +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..54d1c2af2b4ccb36bbecdb6ae4d1670c47c53fd3 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zip.mjs @@ -0,0 +1,34 @@ +//#region src/array/zip.ts +/** +* 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 arrs - The arrays to zip together. +* @returns 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]] +*/ +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; +} +//#endregion +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..d49db1ba910cf4aa4ccb78c07a3fe4e5909bd101 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.d.mts @@ -0,0 +1,34 @@ +//#region src/array/zipObject.d.ts +/** + * 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 keys - An array of property names. + * @param values - An array of values corresponding to the property names. + * @returns 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; +//#endregion +export { zipObject }; \ No newline at end of file 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..d49db1ba910cf4aa4ccb78c07a3fe4e5909bd101 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.d.ts @@ -0,0 +1,34 @@ +//#region src/array/zipObject.d.ts +/** + * 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 keys - An array of property names. + * @param values - An array of values corresponding to the property names. + * @returns 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; +//#endregion +export { zipObject }; \ No newline at end of file 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..15a53d12156a2e776d14c3b71ab71214bb3c835a --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.js @@ -0,0 +1,38 @@ +//#region src/array/zipObject.ts +/** +* 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 keys - An array of property names. +* @param values - An array of values corresponding to the property names. +* @returns 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 } +*/ +function zipObject(keys, values) { + const result = {}; + for (let i = 0; i < keys.length; i++) result[keys[i]] = values[i]; + return result; +} +//#endregion +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..28a6f875a33f252fe1c67b39c3f210d21e3da67e --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipObject.mjs @@ -0,0 +1,38 @@ +//#region src/array/zipObject.ts +/** +* 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 keys - An array of property names. +* @param values - An array of values corresponding to the property names. +* @returns 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 } +*/ +function zipObject(keys, values) { + const result = {}; + for (let i = 0; i < keys.length; i++) result[keys[i]] = values[i]; + return result; +} +//#endregion +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..a1dcf0bd9a341b07bb18a636a054c0fca3f9ecd4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.d.mts @@ -0,0 +1,73 @@ +//#region src/array/zipWith.d.ts +/** + * 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 arr1 - The first array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @param arr4 - The fourth array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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[]; +//#endregion +export { zipWith }; \ No newline at end of file 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..a1dcf0bd9a341b07bb18a636a054c0fca3f9ecd4 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.d.ts @@ -0,0 +1,73 @@ +//#region src/array/zipWith.d.ts +/** + * 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 arr1 - The first array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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 arr1 - The first array to zip. + * @param arr2 - The second array to zip. + * @param arr3 - The third array to zip. + * @param arr4 - The fourth array to zip. + * @param combine - The combiner function that takes corresponding elements from each array, their index, and returns a single value. + * @returns 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[]; +//#endregion +export { zipWith }; \ No newline at end of file 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..35824ec15ea07b3f3ccd3c3bd54a0640134757a7 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.js @@ -0,0 +1,32 @@ +//#region src/array/zipWith.ts +/** +* 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 arr1 - The first array to zip. +* @param rest - The additional arrays to zip together, followed by the combiner function. +* @param combine - The combiner function that takes corresponding elements from each array, followed by their index, and returns a single value. +* @returns 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'] +*/ +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++) result[i] = combine(...arrs.map((arr) => arr[i]), i); + return result; +} +//#endregion +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..96fd9c6f1ec5208bb3805d9301224bd11ac07103 --- /dev/null +++ b/node_modules/es-toolkit/dist/array/zipWith.mjs @@ -0,0 +1,32 @@ +//#region src/array/zipWith.ts +/** +* 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 arr1 - The first array to zip. +* @param rest - The additional arrays to zip together, followed by the combiner function. +* @param combine - The combiner function that takes corresponding elements from each array, followed by their index, and returns a single value. +* @returns 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'] +*/ +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++) result[i] = combine(...arrs.map((arr) => arr[i]), i); + return result; +} +//#endregion +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..1b27059b55ba0c8753227c0dc933b47ed61335d3 --- /dev/null +++ b/node_modules/es-toolkit/dist/browser.global.js @@ -0,0 +1,8 @@ +(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e._={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(...e){if(e.length===0)return[[]];let t=1;for(let n=0;n=0;r--){let n=e[r],i=n.length;t[r]=n[a%i],a=Math.floor(a/i)}r[i]=t}return r}function n(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`Size must be an integer greater than zero.`);let n=Math.ceil(e.length/t),r=Array(n);for(let i=0;in)return[];if(t===0)return[[]];let r=Array(t);for(let e=0;e=0&&r[o]===o+n-t;)o--;if(o<0)return i;r[o]++;for(let e=o+1;e!n.has(e))}function s(e,t,n){let r=new Set(t.map(e=>n(e)));return e.filter(e=>!r.has(n(e)))}function c(e,t,n){return e.filter(e=>t.every(t=>!n(e,t)))}function l(e,t){return t=Math.max(t,0),e.slice(t)}function u(e,t){return t=Math.min(-t,0),t===0?e.slice():e.slice(0,t)}function d(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 f(e,t){let n=e.findIndex((e,n,r)=>!t(e,n,r));return n===-1?[]:e.slice(n)}function p(e,t,n=0,r=e.length){let i=e.length,a=Math.max(n>=0?n:i+n,0),o=Math.min(r>=0?r:i+r,i);for(let n=a;n0){this.available--;return}return new Promise(e=>{this.deferredTasks.push(e)})}release(){let e=this.deferredTasks.shift();if(e!=null){e();return}this.availabler[t])}function te(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;an.has(e))}function ce(e,t,n){let r=[],i=new Set(t.map(n));for(let t=0;tt.some(t=>n(e,t)))}function ue(e,t){return o(t,e).length===0}function de(e,t,n){return c(t,e,n).length===0}function fe(e){return e[e.length-1]}function pe(e,t,n){return n?.concurrency!=null&&(t=h(t,n.concurrency)),Promise.all(e.map(t))}function me(e,t){let n=new Set(t),r=0;for(let t=0;t=t)throw Error(`Invalid input: The maximum value must be greater than the minimum value.`);return Math.random()*(t-e)+e}function ye(e,t){return Math.floor(ve(e,t))}function be(e,t){if(t>e.length)throw Error(`Size must be less than or equal to the length of array.`);let n=Array(t),r=new Set;for(let i=e.length-t,a=0;i=1;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function Se(e){return e.slice(1)}function Ce(e,t){return e.slice(0,t)}function we(e,t){return t<=0||e.length===0?[]:e.slice(-t)}function Te(e,t,n=0,r=e.length){let i=e.length,a=Math.max(n>=0?n:i+n,0),o=Math.min(r>=0?r:i+r,i),s=e.slice();for(let e=a;e!t(e,i))&&n.push(i)}return n}function ke(e){let t=0;for(let n=0;nt&&(t=e[n].length);let n=Array(t);for(let r=0;rt&&(t=e[n].length);let n=e.length,r=Array(t);for(let i=0;i{if(++n>=e)return t(...r)}}function Re(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}async function ze(){}function Be(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Ve(...e){return function(...t){let n=e.length?e[0].apply(this,t):t[0];for(let t=1;t!e(...t))}function We(){}function Ge(e){let t=!1,n;return function(...r){return t||(t=!0,n=e(...r)),n}}function Ke(e,...t){return qe(e,Je,...t)}function qe(e,t,...n){let r=function(...r){let i=0,a=n.slice().map(e=>e===t?r[i++]:e),o=r.slice(i);return e.apply(this,a.concat(o))};return e.prototype&&(r.prototype=Object.create(e.prototype)),r}let Je=Symbol(`partial.placeholder`);Ke.placeholder=Je;function Ye(e,...t){return Xe(e,Ze,...t)}function Xe(e,t,...n){let r=function(...r){let i=n.filter(e=>e===t).length,a=Math.max(r.length-i,0),o=r.slice(0,a),s=a,c=n.slice().map(e=>e===t?r[s++]:e);return e.apply(this,o.concat(c))};return e.prototype&&(r.prototype=Object.create(e.prototype)),r}let Ze=Symbol(`partialRight.placeholder`);Ye.placeholder=Ze;function Qe(e,t=e.length-1){return function(...n){let r=n.slice(t),i=n.slice(0,t);for(;i.length{let i=()=>{r(new Fe)},a=()=>{clearTimeout(o),i()};if(t?.aborted)return i();let o=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e);t?.addEventListener(`abort`,a,{once:!0})})}let et=()=>!0;async function tt(e,t){let n,r,i,a;typeof t==`number`?(n=0,r=t,i=void 0,a=et):(n=t?.delay??0,r=t?.retries??1/0,i=t?.signal,a=t?.shouldRetry??et);let o;for(let t=0;t<=r;t++){if(i?.aborted)throw o??Error(`The retry operation was aborted due to an abort signal.`);try{return await e()}catch(e){if(o=e,!a(e,t))throw e;await $e(typeof n==`function`?n(t):n)}}throw o}function nt(e,t){let n=0;for(let r=0;rt(e))/e.length}function it(e){if(e.length===0)return NaN;let t=e.slice().sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]}function at(e,t){return it(e.map(e=>t(e)))}function ot(e,t){if(Number.isNaN(Number(t)))throw Error(`Expected percentile to be a number but got "${t}".`);if(t<0)throw Error(`Expected percentile to be >= 0 but got "${t}".`);if(t>100)throw Error(`Expected percentile to be <= 100 but got "${t}".`);if(e.length===0)return NaN;let n=e.slice().sort((e,t)=>(Number.isNaN(e)?-1/0:e)-(Number.isNaN(t)?-1/0:t));return t===0?n[0]:n[Math.ceil(n.length*(t/100))-1]}function st(e,t,n=1){if(t??(t=e,e=0),!Number.isInteger(n)||n===0)throw Error(`The step value must be a non-zero integer.`);let r=Math.max(Math.ceil((t-e)/n),0),i=Array(r);for(let t=0;tObject.prototype.propertyIsEnumerable.call(e,t))}function v(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}let dt=`[object RegExp]`,ft=`[object String]`,pt=`[object Number]`,mt=`[object Boolean]`,ht=`[object Arguments]`,gt=`[object Symbol]`,_t=`[object Date]`,vt=`[object Map]`,yt=`[object Set]`,bt=`[object Array]`,xt=`[object ArrayBuffer]`,St=`[object Object]`,Ct=`[object DataView]`,wt=`[object Uint8Array]`,Tt=`[object Uint8ClampedArray]`,Et=`[object Uint16Array]`,Dt=`[object Uint32Array]`,Ot=`[object Int8Array]`,kt=`[object Int16Array]`,At=`[object Int32Array]`,jt=`[object Float32Array]`,Mt=`[object Float64Array]`;function y(e){return Ne.Buffer!==void 0&&Ne.Buffer.isBuffer(e)}function Nt(e,t){return b(e,void 0,e,new Map,t)}function b(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(_(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;at(e[n],n,e))}function S(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)===`[object Object]`:!1}function Lt(e,{delimiter:t=`.`}={}){return Rt(e,``,t)}function Rt(e,t,n){let r={},i=Object.keys(e);for(let a=0;a0){Object.assign(r,Rt(s,c,n));continue}if(Array.isArray(s)&&s.length>0){Object.assign(r,Rt(s,c,n));continue}r[c]=s}return r}function zt(e){let t={},n=Object.keys(e);for(let r=0;rUt(e)).join(``)}`}function qt(e){if(T(e))return e.map(e=>qt(e));if(S(e)){let t={},n=Object.keys(e);for(let r=0;re.toLowerCase()).join(`_`)}function Xt(e){if(T(e))return e.map(e=>Xt(e));if(E(e)){let t={},n=Object.keys(e);for(let r=0;r`u`?!1:e instanceof Blob}function $t(){return typeof window<`u`&&window?.document!=null}function en(e){return e instanceof Date}function tn(e){return S(e)&&Object.keys(e).length===0}function D(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function nn(e,t,n){return rn(e,t,void 0,void 0,void 0,void 0,n)}function rn(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return an(e,t,a,o)}return an(e,t,a,o)}function an(e,t,n,r){if(Object.is(e,t))return!0;let i=v(e),a=v(t);if(i===`[object Arguments]`&&(i=St),a===`[object Arguments]`&&(a=St),i!==a)return!1;switch(i){case ft:return e.toString()===t.toString();case pt:return D(e.valueOf(),t.valueOf());case mt:case _t:case gt:return Object.is(e.valueOf(),t.valueOf());case dt:return e.source===t.source&&e.flags===t.flags;case`[object Function]`:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case vt:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!rn(a,t.get(i),i,e,t,n,r))return!1;return!0;case yt:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;orn(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case bt:case wt:case Tt:case Et:case Dt:case`[object BigUint64Array]`:case Ot:case kt:case At:case`[object BigInt64Array]`:case jt:case Mt:if(y(e)!==y(t)||e.length!==t.length)return!1;for(let i=0;i`u`?!1:Qt(e)&&e instanceof File}function O(e){return typeof e==`function`}function cn(e){return e!=null&&typeof e[Symbol.iterator]==`function`}function ln(e){if(typeof e!=`string`)return!1;try{return JSON.parse(e),!0}catch{return!1}}function un(e){switch(typeof e){case`object`:return e===null||dn(e)||fn(e);case`string`:case`number`:case`boolean`:return!0;default:return!1}}function dn(e){return Array.isArray(e)?e.every(e=>un(e)):!1}function fn(e){if(!S(e))return!1;let t=Reflect.ownKeys(e);for(let n=0;n=0}function mn(e){return e instanceof Map}function k(e){return e==null}function hn(){return typeof process<`u`&&process?.versions?.node!=null}function gn(e){return e!=null}function _n(e){return e===null}function vn(e){return e instanceof Promise}function yn(e){return e instanceof RegExp}function bn(e){return e instanceof Set}function xn(e){return typeof e==`symbol`}function Sn(e){return e===void 0}function Cn(e){return e instanceof WeakMap}function wn(e){return e instanceof WeakSet}async function Tn(e){let t=Object.keys(e),n=await Promise.all(t.map(t=>e[t])),r={};for(let e=0;e{let i=()=>{clearTimeout(a)};if(t?.aborted)return;let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),r(new Ie)},e);t?.addEventListener(`abort`,i,{once:!0})})}async function On(e,t,{signal:n}={}){return Promise.race([e(),Dn(t,{signal:n})])}function kn(e){return Gt(e).map(e=>e.toUpperCase()).join(`_`)}let An=new Map([[`Æ`,`Ae`],[`Ð`,`D`],[`Ø`,`O`],[`Þ`,`Th`],[`ß`,`ss`],[`æ`,`ae`],[`ð`,`d`],[`ø`,`o`],[`þ`,`th`],[`Đ`,`D`],[`đ`,`d`],[`Ħ`,`H`],[`ħ`,`h`],[`ı`,`i`],[`IJ`,`IJ`],[`ij`,`ij`],[`ĸ`,`k`],[`Ŀ`,`L`],[`ŀ`,`l`],[`Ł`,`L`],[`ł`,`l`],[`ʼn`,`'n`],[`Ŋ`,`N`],[`ŋ`,`n`],[`Œ`,`Oe`],[`œ`,`oe`],[`Ŧ`,`T`],[`ŧ`,`t`],[`ſ`,`s`]]);function jn(e){e=e.normalize(`NFD`);let t=``;for(let n=0;n=`̀`&&r<=`ͯ`||r>=`⃐`&&r<=`⃿`||r>=`︠`&&r<=`︯`||(t+=An.get(r)??r)}return t}let Mn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function Nn(e){return e.replace(/[&<>"']/g,e=>Mn[e])}function Pn(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`)}function Fn(e){return e.substring(0,1).toLowerCase()+e.substring(1)}function In(e){return Gt(e).map(e=>Ut(e)).join(``)}function Ln(e){return[...e].reverse().join(``)}function Rn(e,t){if(t===void 0)return e.trimEnd();let n=e.length;switch(typeof t){case`string`:if(t.length!==1)throw 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 zn(e,t){if(t===void 0)return e.trimStart();let n=0;switch(typeof t){case`string`:if(t.length!==1)throw Error(`The 'chars' parameter should be a single character string.`);for(;n`,""":`"`,"'":`'`};function Hn(e){return e.replace(/&(?:amp|lt|gt|quot|#(0+)?39);/g,e=>Vn[e]||`'`)}function Un(e){return e.substring(0,1).toUpperCase()+e.substring(1)}async function Wn(e){try{return[null,await e()]}catch(e){return[e,null]}}function Gn(e,t){if(!e)throw typeof t==`string`?Error(t):t}function Kn(e){return arguments.length===0?[]:Array.isArray(e)?e:[e]}function A(e){return Array.isArray(e)?e:Array.from(e)}function j(e){return e!=null&&typeof e!=`function`&&pn(e.length)}function qn(e,t=1){if(t=Math.max(Math.floor(t),0),t===0||!j(e)||Number.isNaN(t))return[];let r=A(e);return isFinite(t)?n(r,t):[r]}function Jn(e){return j(e)?a(Array.from(e)):[]}function Yn(...e){return te(e)}let Xn=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function Zn(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:Xn.test(e);default:return!1}}function M(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function N(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(N).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function P(e){if(Array.isArray(e))return e.map(M);if(typeof e==`symbol`)return[e];e=N(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&t.push(``);rvoid 0)}function er(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return tr(e,t,n,r);case`function`:return Object.keys(t).length>0?er(e,{...t},n,r,i):D(e,t);default:return L(e)&&i?typeof t==`string`?t===``:!0:D(e,t)}}function tr(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return rr(e,t,n,r);if(t instanceof Map)return nr(e,t,n,r);if(t instanceof Set)return ir(e,t,n,r);let i=Object.keys(t);if(e==null||_(e))return i.length===0;if(i.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;avoid 0)}function R(e){return e=Ft(e),t=>ar(t,e)}function or(e,t){return Nt(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(v(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),x(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case pt:case ft:case mt:{let t=new e.constructor(e?.valueOf());return x(t,e),t}case ht:{let t={};return x(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function sr(e){return or(e)}let cr=/^(?:0|[1-9]\d*)$/;function lr(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e!!t(e,n,r));case`object`:if(Array.isArray(t)&&t.length===2){let n=t[0],r=t[1];return d(e,B(n,r))}else return d(e,R(t));case`symbol`:case`number`:case`string`:return d(e,I(t))}}function br(e,t=g){return j(e)?xr(A(e),t):[]}function xr(e,t){switch(typeof t){case`function`:return f(e,(e,n,r)=>!!t(e,n,r));case`object`:if(Array.isArray(t)&&t.length===2){let n=t[0],r=t[1];return f(e,B(n,r))}else return f(e,R(t));case`number`:case`symbol`:case`string`:return f(e,I(t))}}function Sr(e,t=g){if(!e)return e;let n=j(e)||Array.isArray(e)?st(0,e.length):Object.keys(e);for(let r=0;r=0;r--){let i=n[r],a=e[i];if(t(a,i,e)===!1)break}return e}function Y(e,t,n){return L(n)&&(typeof t==`number`&&j(n)&&lr(t)&&t=0;r--){let n=t[r],a=e[n];if(i(a,n,e))return a}return}return e.slice(0,n+1).findLast(i)}function Ar(e,t=g,n=e?e.length-1:0){if(!e)return-1;Number.isNaN(n)&&(n=0),n=n<0?Math.max(e.length+n,0):Math.min(n,e.length-1);let r=A(e).slice(0,n+1);switch(typeof t){case`function`:return r.findLastIndex(t);case`object`:if(Array.isArray(t)&&t.length===2){let e=t[0],n=t[1];return r.findLastIndex(B(e,n))}else return r.findLastIndex(R(t));case`number`:case`symbol`:case`string`:return r.findLastIndex(I(t))}}function jr(e){if(j(e))return ae(A(e))}function Mr(e,t=1){if(!j(e))return[];let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;ae.length||t instanceof RegExp?!1:(n<0&&(n=Math.max(0,e.length+n)),e.includes(t,n));if(Array.isArray(e))return e.includes(t,n);if(j(e)){n<0&&(n=Math.max(0,e.length+n));for(let r=n;re(t):typeof e==`string`?I(e):null}function qr(e){return j(e)?Ee(Array.from(e)):[]}function Jr(e,...t){if(e==null)return[];let n=W(t),r=D,i=qr;typeof n==`function`&&(r=n,i=Yr,t.pop());let a=i(Array.from(e));for(let e=0;e1&&(s=F(a,c.slice(0,-1))),i.push(o?.apply(s,n))}return i}function Zr(e,t){return j(e)?Array.from(e).join(t):``}function Qr(e,t=g,n){let r=arguments.length>=3;if(!e)return n;let i,a=0;j(e)?(i=st(0,e.length),!r&&e.length>0&&(n=e[0],a+=1)):(i=Object.keys(e),!r&&i.length>0&&(n=e[i[0]],a+=1));for(let r=a;r{let r=n(t);return e[r]=t,e},{})}function ei(e,t,n){if(!j(e)||e.length===0)return-1;let r=e.length,i=n===void 0?r-1:J(n);if(n!==void 0&&(i=i<0?Math.max(r+i,0):Math.min(i,r-1)),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 ti(e,t=0){if(!(!j(e)||e.length===0))return t=J(t),t<0&&(t+=e.length),e[t]}function ni(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}let ri=(e,t,n)=>{if(e!==t){let r=ni(e),i=ni(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ai=/^\w*$/;function oi(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||G(e)?!0:typeof e==`string`&&(ai.test(e)||!ii.test(e))||t!=null&&Object.hasOwn(t,e)}function si(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e;for(let e=0;et==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):typeof t==`object`?t[e]:t,o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||oi(e)?e:{key:e,path:P(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function ci(e,t=g){if(!e)return[[],[]];let n=j(e)?e:Object.values(e);t=V(t);let r=[],i=[];for(let e=0;er(e))),a=0;for(let t=0;tD(e,t);let i=Array.isArray(t)?t:Array.from(t),a=i.includes(void 0);for(let t=0;tn(e[t],r))||(e[r++]=e[t]);continue}a||delete e[r++]}return e.length=r,e}function mi(e,...t){if(t.length===0)return[];let n=[];for(let e=0;elr(t,e.length)?Number(t):t).sort((e,t)=>t-e);for(let t of new Set(i)){if(lr(t,e.length)){Array.prototype.splice.call(e,t,1);continue}if(oi(t,e)){delete e[M(t)];continue}hi(e,T(t)?t:P(t))}return r}function vi(e,t=g,n){let r=arguments.length>=3;if(!e)return n;let i,a;j(e)?(i=st(0,e.length).reverse(),!r&&e.length>0?(n=e[e.length-1],a=1):a=0):(i=Object.keys(e).reverse(),!r&&i.length>0?(n=e[i[0]],a=1):a=0);for(let r=a;re!==`constructor`):t}function ji(e){let t=Ai(e.length,e=>`${e}`),n=new Set(t);y(e)&&(n.add(`offset`),n.add(`parent`)),Z(e)&&(n.add(`buffer`),n.add(`byteLength`),n.add(`byteOffset`));let r=Object.keys(e).filter(e=>!n.has(e));return Array.isArray(e)?[...t,...r]:[...t.filter(t=>Object.hasOwn(e,t)),...r]}function Mi(e){if(e==null)return[];let t=Q(e),n=Array(t.length);for(let r=0;r1&&Y(e,t[0],t[1])?t=[]:n>2&&Y(t[0],t[1],t[2])&&(t=[t[0]]),si(e,te(t),[`asc`])}function Bi(e){return typeof e==`number`||H(e)&&v(e)===`[object Number]`}function Vi(e){return Bi(e)&&Number.isNaN(Number(e))}function Hi(e,t,n=X,r){if(Ni(e)||e.length===0)return 0;let i=0,a=e.length,o=V(n),s=o(t),c=Vi(s),l=_n(s),u=G(s),d=Sn(s);for(;i>>1,a=e[i];!_n(a)&&!xn(a)&&ae)}function Wi(e,t){if(!e?.length)return-1;let n=Ui(e,t);return n2147483647)return Gi(e,t,e=>e);let r=0;for(;r>>1,a=e[i];!_n(a)&&!xn(a)&&a<=t?r=i+1:n=i}return n}function qi(e,t){if(!e?.length)return-1;let n=Ki(e,t)-1;return n>=0&&D(e[n],t)?n:-1}function Ji(e){return j(e)?Se(A(e)):[]}function Yi(e,t=1,n){return t=n||t===void 0?1:J(t),t<1||!j(e)?[]:Ce(A(e),t)}function Xi(e,t=1,n){return t=n?1:J(t),t<=0||!j(e)?[]:we(A(e),t)}function Zi(e,t){if(!U(e))return[];let n=A(e),r=n.findLastIndex(Ue(V(t??g)));return n.slice(r+1)}function Qi(e,t){if(!U(e))return[];let n=A(e),r=n.findIndex(yi(V(t??X)));return r===-1?n:n.slice(0,r)}function $i(...e){return Ee(Ir(e.filter(U),e=>Array.from(e),1))}function ea(...e){let t=fe(e),n=pr(e);return U(t)||t==null?Ee(n):De(n,Re(V(t),1))}function ta(...e){let t=fe(e),n=pr(e);return U(t)||t==null?Ee(n):Oe(n,t)}function na(e,t=g){return U(e)?De(Array.from(e),Re(V(t),1)):[]}function ra(e,t){return j(e)?typeof t==`function`?Oe(Array.from(e),(e,n)=>t(n,e)):qr(Array.from(e)):[]}function ia(e){return!U(e)||!e.length?[]:(e=T(e)?e:Array.from(e),e=e.filter(e=>U(e)),ke(e))}function aa(e,t){if(!U(e)||!e.length)return[];let n=T(e)?ke(e):ke(Array.from(e,e=>Array.from(e)));if(!t)return n;let r=Array(n.length);for(let e=0;eGr(e,t,n)),n),n)}function la(...e){let t=W(e),n=(e,t)=>e===t;typeof t==`function`&&(n=t,e=e.slice(0,-1));let r=e.filter(U);return hr(ta(...r,n),ta(...Ae(r,2).map(([e,t])=>Jr(e,t,n)),n),n)}function ua(...e){return e.length?Me(...e.filter(e=>U(e))):[]}let da=(e,t,n)=>{let r=e[t];(!(Object.hasOwn(e,t)&&D(r,n))||n===void 0&&!(t in e))&&(e[t]=n)};function fa(e=[],t=[]){let n={};for(let r=0;rn,()=>void 0)}function ha(e,t){let n={};if(!j(e))return n;j(t)||(t=[]);let r=Me(Array.from(e),Array.from(t));for(let e=0;et(...e))}function _a(e,t){if(typeof t!=`function`)throw TypeError(`Expected a function`);return e=J(e),function(...n){if(--e<1)return t.apply(this,n)}}function va(e,t=e.length,n){return n&&(t=e.length),(Number.isNaN(t)||t<0)&&(t=0),Re(e,t)}function ya(e,...t){try{return e(...t)}catch(e){return e instanceof Error?e:Error(e)}}function ba(e,t){if(typeof t!=`function`)throw TypeError(`Expected a function`);let n;return e=J(e),function(...r){return--e>0&&(n=t.apply(this,r)),e<=1&&t&&(t=void 0),n}}function xa(e,t,...n){let r=function(...i){let a=[],o=0;for(let e=0;ee===Ca.placeholder),a=n.length-i.length;return ae===Ca.placeholder),o=i.length-a.length;return i=Ta(i,n),oe===Da.placeholder),a=n.length-i.length;return ae===Da.placeholder),o=i.length-a.length;return i=ka(i,n),oe===Da.placeholder).length,r=Math.max(e.length-n,0),i=[],a=0;for(let t=0;t=a)?(s=e.apply(this,t),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Ma(e,...t){if(typeof e!=`function`)throw TypeError(`Expected a function`);return setTimeout(e,1,...t)}function Na(e,t,...n){if(typeof e!=`function`)throw TypeError(`Expected a function`);return setTimeout(e,K(t)||0,...n)}function Pa(e){return function(...t){return e.apply(this,t.reverse())}}function Fa(...e){let t=te(e,1);if(t.some(e=>typeof e!=`function`))throw TypeError(`Expected a function`);return Ve(...t)}function Ia(...e){let t=te(e,1);if(t.some(e=>typeof e!=`function`))throw TypeError(`Expected a function`);return He(...t)}function La(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(`Expected a function`);let n=function(...r){let i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);let o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(La.Cache||Map),n}La.Cache=Map;function Ra(e=0){return function(...t){return t.at(J(e))}}function za(e){return Ge(e)}function Ba(e,...t){if(typeof e!=`function`)throw TypeError(`Expected a function`);let n=t.flat();return function(...t){let r=Math.min(t.length,n.length),i=[...t];for(let e=0;et[e]).slice(0,t.length);for(let e=r.length;e=Math.min(t,n)&&et)&&(t=r)}return t}function no(e,t=g){if(e==null)return;let n=A(e);if(n.length===0)return;let r=V(t),i,a;for(let e=0;ea)&&(a=o,i=t)}return i}function ro(e,t){if(!e||!e.length)return 0;t!=null&&(t=V(t));let n;for(let r=0;rn&&([t,n]=[n,t]),!r&&(!Number.isInteger(t)||!Number.isInteger(n))&&(r=!0),t=wi(t,-(2**53-1),2**53-1),n=wi(n,-(2**53-1),2**53-1),t===n?t:r?ve(t,n):ye(t,n+1)}function po(e,t,n){n&&typeof n!=`number`&&Y(e,t,n)&&(t=n=void 0),e=q(e),t===void 0?(t=e,e=0):t=q(t),n=n===void 0?e=0;t--)i[t]=e,e+=n;return i}function ho(e,t=0){return Xa(`round`,e,t)}function go(e,t){return e===void 0&&t===void 0?0:e===void 0||t===void 0?e??t:(typeof e==`string`||typeof t==`string`?(e=N(e),t=N(t)):(e=K(e),t=K(t)),e-t)}function _o(...e){}function vo(e,...t){for(let n=0;ne!==`constructor`)}function So(e){let t=Ai(e.length,e=>`${e}`),n=new Set(t);y(e)&&(n.add(`offset`),n.add(`parent`)),Z(e)&&(n.add(`buffer`),n.add(`byteLength`),n.add(`byteOffset`));let r=bo(e).filter(e=>!n.has(e));return Array.isArray(e)?[...t,...r]:[...t.filter(t=>Object.hasOwn(e,t)),...r]}function Co(e,...t){for(let n=0;n0&&typeof e[0]==`string`&&Object.hasOwn(e,`index`)&&(t.index=e.index,t.input=e.input),t}if(Z(e)){let t=e,n=t.constructor;return new n(t.buffer,t.byteOffset,t.length)}if(t===`[object ArrayBuffer]`)return new ArrayBuffer(e.byteLength);if(t===`[object DataView]`){let t=e,n=t.buffer,r=t.byteOffset,i=t.byteLength,a=new ArrayBuffer(i),o=new Uint8Array(n,r,i);return new Uint8Array(a).set(o),new DataView(a)}if(t===`[object Boolean]`||t===`[object Number]`||t===`[object String]`){let n=e.constructor,r=new n(e.valueOf());return t===`[object String]`?No(r,e):jo(r,e),r}if(t===`[object Date]`)return new Date(Number(e));if(t===`[object RegExp]`){let t=e,n=new RegExp(t.source,t.flags);return n.lastIndex=t.lastIndex,n}if(t===`[object Symbol]`)return Object(Symbol.prototype.valueOf.call(e));if(t===`[object Map]`){let t=e,n=new Map;return t.forEach((e,t)=>{n.set(t,e)}),n}if(t===`[object Set]`){let t=e,n=new Set;return t.forEach(e=>{n.add(e)}),n}if(t===`[object Arguments]`){let t=e,n={};return jo(n,t),n.length=t.length,n[Symbol.iterator]=t[Symbol.iterator],n}let n={};return Po(n,e),jo(n,e),Mo(n,e),n}function Ao(e){switch(v(e)){case ht:case bt:case xt:case Ct:case mt:case _t:case jt:case Mt:case Ot:case kt:case At:case vt:case pt:case St:case dt:case yt:case ft:case gt:case wt:case Tt:case Et:case Dt:return!0;default:return!1}}function jo(e,t){for(let n in t)Object.hasOwn(t,n)&&(e[n]=t[n])}function Mo(e,t){let n=Object.getOwnPropertySymbols(t);for(let r=0;r=n)&&(e[r]=t[r])}function Po(e,t){let n=Object.getPrototypeOf(t);n!==null&&typeof t.constructor==`function`&&Object.setPrototypeOf(e,n)}function Fo(e,t){if(!t)return ko(e);let n=t(e);return n===void 0?ko(e):n}function Io(e,t){let n=L(e)?Object.create(e):{};if(t!=null){let e=Q(t);for(let r=0;r2?t[2]:void 0;i&&Y(t[0],t[1],i)&&(r=1);for(let i=0;in(e[t],t,e))}function Go(e,t=g){if(e==null)return e;for(let n in e)if(t(e[n],n,e)===!1)break;return e}function Ko(e,t=g){if(e==null)return e;let n=[];for(let t in e)n.push(t);for(let r=n.length-1;r>=0;r--){let i=n[r];if(t(e[i],i,e)===!1)break}return e}function qo(e,t=g){if(e==null)return e;let n=Object(e),r=Q(e);for(let e=0;e=0;--e){let i=r[e];if(t(n[i],i,n)===!1)break}return e}function Yo(e){if(!j(e))return{};let t={};for(let n=0;ntypeof e[t]==`function`)}function Zo(e){if(e==null)return[];let t=[];for(let n in e)O(e[n])&&t.push(n);return t}function Qo(e,t){if(e==null)return!1;let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Zn(t)&&!(t in Object(e))?P(t):[t],n.length===0)return!1;let r=e;for(let e=0;eArray.isArray(e)||Zn(e))?us(e):ls(e)}function ls(e){let t={},n=[...$(e),...os(e)];for(let r=0;r{if(!E(e))return e})}return t}function ds(e,t){if(e==null)return{};let n={},r=V(t??X),i=[...$(e),...os(e)];for(let t=0;tvoid 0,pa(e,t,()=>n,i)}function _s(e,...t){return Lo(sr(e),...t)}function vs(e){let t=Array(e.size),n=e.keys(),r=e.values();for(let e=0;et(n,e,r,i)),n}function ws(e,t,n){return pa(e,t,n,()=>void 0)}function Ts(e){let t=$(e),n=Array(t.length);for(let r=0;r=0}let Os=Function.prototype.toString,ks=RegExp(`^${Os.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)}$`);function As(e){if(typeof e!=`function`)return!1;if(globalThis?.[`__core-js_shared__`]!=null)throw Error(`Unsupported core-js use. Try https://npms.io/search?q=ponyfill.`);return ks.test(Os.call(e))}function js(e){return e===null}function Ms(e){return Sn(e)}function Ns(e,t){if(t==null)return!0;if(e==null)return Object.keys(t).length===0;let n=Object.keys(t);for(let r=0;re!==`constructor`).length===0:t.length===0}return!0}function Bs(e,t,n){return typeof n!=`function`&&(n=()=>void 0),nn(e,t,(...r)=>{let i=n(...r);if(i!==void 0)return!!i;if(e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set)return Bs(Array.from(e),Array.from(t),Le(2,n))})}function Vs(e){return v(e)===`[object Error]`}function Hs(e){return Number.isFinite(e)}function Us(e){return Number.isInteger(e)}function Ws(e){return yn(e)}function Gs(e){return Number.isSafeInteger(e)}function Ks(e){return Cn(e)}function qs(e){return wn(e)}function Js(e){return Ut(N(e))}function Ys(e,...t){if(e==null||!L(e)||T(e)&&t.length===0)return e;let n=[];for(let e=0;ee!==``)}function sc(e){return typeof e!=`string`&&(e=N(e)),e.replace(/['\u2019]/g,``)}function cc(e){let t=oc(sc(Xs(e)));if(t.length===0)return``;let[n,...r]=t;return`${n.toLowerCase()}${r.map(e=>Ut(e)).join(``)}`}function lc(e,t,n){return e==null||t==null?!1:(n??=e.length,e.endsWith(t,n))}function uc(e){return Nn(N(e))}function dc(e){return Pn(N(e))}function fc(e){return oc(sc(Xs(e))).map(e=>e.toLowerCase()).join(`-`)}function pc(e){return oc(sc(Xs(e))).map(e=>e.toLowerCase()).join(` `)}function mc(e){return Fn(N(e))}function hc(e){return Fi.test(e)?Array.from(e).length:e.length}function gc(e,t){let n=hc(t);if(n===0||e<1)return``;let r=t.repeat(Math.ceil(e/n));return Fi.test(r)?Array.from(r).slice(0,e).join(``):r.slice(0,e)}function _c(e,t=0,n=` `){let r=N(e),i=J(t),a=hc(r);if(i<=a)return r;let o=(i-a)/2,s=`${n}`;return gc(Math.floor(o),s)+r+gc(Math.ceil(o),s)}function vc(e,t=0,n=` `){let r=N(e),i=J(t),a=hc(r);return i<=a?r:r+gc(i-a,`${n}`)}function yc(e,t=0,n=` `){let r=N(e),i=J(t),a=hc(r);return i<=a?r:gc(i-a,`${n}`)+r}let bc=2**53-1;function xc(e,t,n){return t=(n?Y(e,t,n):t===void 0)?1:J(t),t<1||t>bc?``:N(e).repeat(t)}function Sc(e,t,n){return arguments.length<3?N(e):N(e).replace(t,n)}function Cc(e){return oc(sc(Xs(e))).map(e=>e.toLowerCase()).join(`_`)}function wc(e,t,n){return N(e).split(t,n)}function Tc(e){let t=oc(sc(Xs(e)).trim()),n=``;for(let e=0;e/g,Nc={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:Mc,variable:``,imports:{_:{escape:uc,template:Pc}}};function Pc(e,t,n){e=N(e),n&&(t=Nc),t=Lo({...t},Nc);let r=new RegExp([t.escape?.source??kc.source,t.interpolate?.source??kc.source,t.interpolate===Mc?Dc.source:kc.source,t.evaluate?.source??kc.source,`$`].join(`|`),`g`),i=0,a=!1,o=`__p += ''`;for(let t of e.matchAll(r)){let[n,r,s,c,l]=t,{index:u}=t;o+=` + '${e.slice(i,u).replace(Oc,jc)}'`,r&&(o+=` + _.escape(${r})`),s?o+=` + ((${s}) == null ? '' : ${s})`:c&&(o+=` + ((${c}) == null ? '' : ${c})`),l&&(o+=`;\n${l};\n __p += ''`,a=!0),i=u+n.length}let s=Lo({...t.imports},Nc.imports),c=Object.keys(s),l=Object.values(s),u=`//# sourceURL=${t.sourceURL?String(t.sourceURL).replace(/[\r\n]/g,` `):`es-toolkit.templateSource[${Date.now()}]`}\n`,d=`function(${t.variable||`obj`}) { + let __p = ''; + ${t.variable?``:`if (obj == null) { obj = {}; }`} + ${a?`function print() { __p += Array.prototype.join.call(arguments, ''); }`:``} + ${t.variable?o:`with(obj) {\n${o}\n}`} + return __p; + }`,f=ya(()=>Function(...c,`${u}return ${d}`)(...l));if(f.source=d,f instanceof Error)throw f;return f}let Fc=Nc;function Ic(e){return N(e).toLowerCase()}function Lc(e){return N(e).toUpperCase()}function Rc(e,t,n){if(e==null)return``;if(n!=null||t==null)return e.toString().trim();switch(typeof t){case`object`:return Array.isArray(t)?Bn(e,t.flatMap(e=>e.toString().split(``))):Bn(e,t.toString().split(``));default:return Bn(e,t.toString().split(``))}}function zc(e,t,n){return e==null?``:n!=null||t==null?e.toString().trimEnd():Rn(e,t.toString().split(``))}function Bc(e,t,n){return e==null?``:n!=null||t==null?e.toString().trimStart():zn(e,t.toString().split(``))}function Vc(e,t){e=e==null?``:`${e}`;let n=30,r=`...`;L(t)&&(n=Hc(t.length),r=`omission`in t?`${t.omission}`:`...`);let i=e.length,a=Array.from(r).length,o=Math.max(n-a,0),s;if(Fi.test(e)&&(s=Array.from(e),i=s.length),n>=i)return e;if(i<=a)return r;let c=s===void 0?e.slice(0,o):s?.slice(0,o).join(``),l=t?.separator;if(!l)return c+=r,c;let u=l instanceof RegExp?l.source:l,d=`u`+(l instanceof RegExp?l.flags.replace(`u`,``):``),f=RegExp(`(?.*(?:(?!${u}).))(?:${u})`,d).exec(c);return(f?.groups?f.groups.result:c)+r}function Hc(e){return e==null?30:e<=0?0:e}function Uc(e){return Hn(N(e))}function Wc(e){return oc(sc(Xs(e))).map(e=>e.toUpperCase()).join(` `)}function Gc(e){return Un(N(e))}function Kc(e){let t=e.length,n=e.map(e=>{let t=e[0],n=e[1];if(!O(n))throw TypeError(`Expected a function`);return[V(t),n]});return function(...e){for(let r=0;re}function Jc(e,t){return e==null||Number.isNaN(e)?t:e}function Yc(e,t){return typeof e==`string`&&typeof t==`string`?e>t:K(e)>K(t)}function Xc(e,t){return typeof e==`string`&&typeof t==`string`?e>=t:K(e)>=K(t)}function Zc(e,t,...n){if(n=n.flat(1),e!=null)switch(typeof t){case`string`:return typeof e==`object`&&Object.hasOwn(e,t)?Qc(e,[t],n):Qc(e,P(t),n);case`number`:case`symbol`:return Qc(e,[t],n);default:return Array.isArray(t)?Qc(e,t,n):Qc(e,[t],n)}}function Qc(e,t,n){let r=F(e,t.slice(0,-1),e);if(r==null)return;let i=W(t),a=i?.valueOf();return i=typeof a==`number`?M(a):String(i),F(r,i)?.apply(r,n)}function $c(e,t){return typeof e==`string`&&typeof t==`string`?eV(e));return function(...e){return t.map(t=>t.apply(this,e))}}function al(...e){return function(...t){for(let n=0;n = (value: T, index: number, collection: T[]) => R; +//#endregion +export { ArrayIterator }; \ No newline at end of file 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..78fec16c7fc5acb17eb380dd8f8f764dbe01f2b0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ArrayIterator.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ArrayIterator.d.ts +type ArrayIterator = (value: T, index: number, collection: T[]) => R; +//#endregion +export { ArrayIterator }; \ No newline at end of file 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..c2f238b62c3a1d724b1925f3c71067a1cd3d362b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ConformsPredicateObject.d.ts +type ConformsPredicateObject = { [P in keyof T]: T[P] extends ((arg: infer A) => any) ? A : any }; +//#endregion +export { ConformsPredicateObject }; \ No newline at end of file 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..c2f238b62c3a1d724b1925f3c71067a1cd3d362b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ConformsPredicateObject.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ConformsPredicateObject.d.ts +type ConformsPredicateObject = { [P in keyof T]: T[P] extends ((arg: infer A) => any) ? A : any }; +//#endregion +export { ConformsPredicateObject }; \ No newline at end of file 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..94e2c00570cb2047e970e7f4a8c67c48f8d80c6c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.mts @@ -0,0 +1,5 @@ +//#region src/compat/_internal/EmptyObjectOf.d.ts +type EmptyObject = { [K in keyof T]?: never }; +type EmptyObjectOf = EmptyObject extends T ? EmptyObject : never; +//#endregion +export { EmptyObjectOf }; \ No newline at end of file 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..94e2c00570cb2047e970e7f4a8c67c48f8d80c6c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/EmptyObjectOf.d.ts @@ -0,0 +1,5 @@ +//#region src/compat/_internal/EmptyObjectOf.d.ts +type EmptyObject = { [K in keyof T]?: never }; +type EmptyObjectOf = EmptyObject extends T ? EmptyObject : never; +//#endregion +export { EmptyObjectOf }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/Equals.d.mts b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e8a8b266910c4d3c16dc105e0f44bb3e96e15d93 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/Equals.d.ts +type Equals = (() => X extends T ? 1 : 2) extends (() => X extends U ? 1 : 2) ? true : false; +//#endregion +export { Equals }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/Equals.d.ts b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8a8b266910c4d3c16dc105e0f44bb3e96e15d93 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Equals.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/Equals.d.ts +type Equals = (() => X extends T ? 1 : 2) extends (() => X extends U ? 1 : 2) ? true : false; +//#endregion +export { Equals }; \ No newline at end of file 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..9810fa47393ef29293d7a39fa7aaf352572c9ebc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.mts @@ -0,0 +1,13 @@ +//#region src/compat/_internal/GetFieldType.d.ts +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>; +//#endregion +export { GetFieldType }; \ No newline at end of file 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..9810fa47393ef29293d7a39fa7aaf352572c9ebc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/GetFieldType.d.ts @@ -0,0 +1,13 @@ +//#region src/compat/_internal/GetFieldType.d.ts +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>; +//#endregion +export { GetFieldType }; \ No newline at end of file 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..c13f1f46cea8e1285442015edd2c6c4702769eba --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/IsEqualCustomizer.d.ts +type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyKey | undefined, parent: any, otherParent: any, stack: any) => boolean | undefined; +//#endregion +export { IsEqualCustomizer }; \ No newline at end of file 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..c13f1f46cea8e1285442015edd2c6c4702769eba --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsEqualCustomizer.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/IsEqualCustomizer.d.ts +type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyKey | undefined, parent: any, otherParent: any, stack: any) => boolean | undefined; +//#endregion +export { IsEqualCustomizer }; \ No newline at end of file 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..7a7114d7c5df7343a6862c5d20a1f9293855a5e2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/IsMatchWithCustomizer.d.ts +type IsMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyKey, object: object, source: object) => boolean | undefined; +//#endregion +export { IsMatchWithCustomizer }; \ No newline at end of file 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..7a7114d7c5df7343a6862c5d20a1f9293855a5e2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsMatchWithCustomizer.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/IsMatchWithCustomizer.d.ts +type IsMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyKey, object: object, source: object) => boolean | undefined; +//#endregion +export { IsMatchWithCustomizer }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.mts b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..43a46a87f1c9573d5a7d8aafec56289ce21ee09b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.mts @@ -0,0 +1,6 @@ +import { Equals } from "./Equals.mjs"; + +//#region src/compat/_internal/IsWritable.d.ts +type IsWritable = Equals<{ [K in keyof T]: T[K] }, { -readonly [K in keyof T]: T[K] }>; +//#endregion +export { IsWritable }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.ts b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e44e9feb7b488db04a13084d56784eaad203f87e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IsWritable.d.ts @@ -0,0 +1,6 @@ +import { Equals } from "./Equals.js"; + +//#region src/compat/_internal/IsWritable.d.ts +type IsWritable = Equals<{ [K in keyof T]: T[K] }, { -readonly [K in keyof T]: T[K] }>; +//#endregion +export { IsWritable }; \ No newline at end of file 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..a886b139299386769eb31dd796c4f802551c686a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.mts @@ -0,0 +1,6 @@ +import { PartialShallow } from "./PartialShallow.mjs"; + +//#region src/compat/_internal/IterateeShorthand.d.ts +type IterateeShorthand = PropertyKey | [PropertyKey, any] | PartialShallow; +//#endregion +export { IterateeShorthand }; \ No newline at end of file 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..1030890638056c9d9dac60bde778430494ffe54c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/IterateeShorthand.d.ts @@ -0,0 +1,6 @@ +import { PartialShallow } from "./PartialShallow.js"; + +//#region src/compat/_internal/IterateeShorthand.d.ts +type IterateeShorthand = PropertyKey | [PropertyKey, any] | PartialShallow; +//#endregion +export { IterateeShorthand }; \ No newline at end of file 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..3fc27821a60459c6b9c5719e806c469df7675ba0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.mts @@ -0,0 +1,6 @@ +import { PartialShallow } from "./PartialShallow.mjs"; + +//#region src/compat/_internal/ListIteratee.d.ts +type ListIteratee = ((value: T, index: number, collection: ArrayLike) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); +//#endregion +export { ListIteratee }; \ No newline at end of file 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..8ce28214685f07d5e1217cf019610b08900bbc60 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratee.d.ts @@ -0,0 +1,6 @@ +import { PartialShallow } from "./PartialShallow.js"; + +//#region src/compat/_internal/ListIteratee.d.ts +type ListIteratee = ((value: T, index: number, collection: ArrayLike) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); +//#endregion +export { ListIteratee }; \ No newline at end of file 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..cf4509e28e04fa71f0c0a2ad89ee71dc711d7b6e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.mts @@ -0,0 +1,7 @@ +import { ListIterator } from "./ListIterator.mjs"; +import { IterateeShorthand } from "./IterateeShorthand.mjs"; + +//#region src/compat/_internal/ListIterateeCustom.d.ts +type ListIterateeCustom = ListIterator | IterateeShorthand; +//#endregion +export { ListIterateeCustom }; \ No newline at end of file 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..341568cd18cb96f4dc2818d15824cc3f514aae10 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterateeCustom.d.ts @@ -0,0 +1,7 @@ +import { ListIterator } from "./ListIterator.js"; +import { IterateeShorthand } from "./IterateeShorthand.js"; + +//#region src/compat/_internal/ListIterateeCustom.d.ts +type ListIterateeCustom = ListIterator | IterateeShorthand; +//#endregion +export { ListIterateeCustom }; \ No newline at end of file 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..ddcfcadf9f57d62e873b728dc34189b878f22c31 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ListIterator.d.ts +type ListIterator = (value: T, index: number, collection: ArrayLike) => R; +//#endregion +export { ListIterator }; \ No newline at end of file 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..ddcfcadf9f57d62e873b728dc34189b878f22c31 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIterator.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ListIterator.d.ts +type ListIterator = (value: T, index: number, collection: ArrayLike) => R; +//#endregion +export { ListIterator }; \ No newline at end of file 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..421b42a6f40596f2c73c44fc05fa74d2a5357ca1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ListIteratorTypeGuard.d.ts +type ListIteratorTypeGuard = (value: T, index: number, collection: ArrayLike) => value is S; +//#endregion +export { ListIteratorTypeGuard }; \ No newline at end of file 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..421b42a6f40596f2c73c44fc05fa74d2a5357ca1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListIteratorTypeGuard.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ListIteratorTypeGuard.d.ts +type ListIteratorTypeGuard = (value: T, index: number, collection: ArrayLike) => value is S; +//#endregion +export { ListIteratorTypeGuard }; \ No newline at end of file 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..2810ae9324fb31a19bc29b74cae97c6fa50537e2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.mts @@ -0,0 +1,6 @@ +import { RecursiveArray } from "./RecursiveArray.mjs"; + +//#region src/compat/_internal/ListOfRecursiveArraysOrValues.d.ts +interface ListOfRecursiveArraysOrValues extends ArrayLike> {} +//#endregion +export { ListOfRecursiveArraysOrValues }; \ No newline at end of file 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..2b8db9b7cd91167909be5c32e5895e24f950f1d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ListOfRecursiveArraysOrValues.d.ts @@ -0,0 +1,6 @@ +import { RecursiveArray } from "./RecursiveArray.js"; + +//#region src/compat/_internal/ListOfRecursiveArraysOrValues.d.ts +interface ListOfRecursiveArraysOrValues extends ArrayLike> {} +//#endregion +export { ListOfRecursiveArraysOrValues }; \ No newline at end of file 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..7784d549697b9821319a6365554ecf66f5a01da1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.js @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MAX_ARRAY_LENGTH.ts +const MAX_ARRAY_LENGTH = 4294967295; +//#endregion +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..6cc42fd309f363f3d480f95db326fa73a8f65dcb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_ARRAY_LENGTH.mjs @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MAX_ARRAY_LENGTH.ts +const MAX_ARRAY_LENGTH = 4294967295; +//#endregion +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..b2685f7e08720e009f2c2d0f926f360136603ce0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.js @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MAX_SAFE_INTEGER.ts +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER; +//#endregion +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..942fd4f7d75fc82879219ba07f8aaec4ba4a9320 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MAX_SAFE_INTEGER.mjs @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MAX_SAFE_INTEGER.ts +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER; +//#endregion +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..fc7645f22de8baf3a3c20c19808adcb07d4332cc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Many.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/Many.d.ts +type Many = T | readonly T[]; +//#endregion +export { Many }; \ No newline at end of file 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..fc7645f22de8baf3a3c20c19808adcb07d4332cc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/Many.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/Many.d.ts +type Many = T | readonly T[]; +//#endregion +export { Many }; \ No newline at end of file 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..d8c1c6ec6094e91066c377689a911faa83487489 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MemoListIterator.d.ts +type MemoListIterator = (prev: R, curr: T, index: number, list: A) => R; +//#endregion +export { MemoListIterator }; \ No newline at end of file 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..d8c1c6ec6094e91066c377689a911faa83487489 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoListIterator.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MemoListIterator.d.ts +type MemoListIterator = (prev: R, curr: T, index: number, list: A) => R; +//#endregion +export { MemoListIterator }; \ No newline at end of file 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..ff39fa6111f0af3a3d034be726f2c9e7785c9f77 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MemoObjectIterator.d.ts +type MemoObjectIterator = (prev: R, curr: T, key: string, list: A) => R; +//#endregion +export { MemoObjectIterator }; \ No newline at end of file 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..ff39fa6111f0af3a3d034be726f2c9e7785c9f77 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MemoObjectIterator.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/MemoObjectIterator.d.ts +type MemoObjectIterator = (prev: R, curr: T, key: string, list: A) => R; +//#endregion +export { MemoObjectIterator }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.mts b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d10dc114dadc0e208bde6c36ca75ca3d36771900 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.mts @@ -0,0 +1,7 @@ +//#region src/compat/_internal/MutableList.d.ts +interface MutableList { + length: number; + [k: number]: T; +} +//#endregion +export { MutableList }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.ts b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d10dc114dadc0e208bde6c36ca75ca3d36771900 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/MutableList.d.ts @@ -0,0 +1,7 @@ +//#region src/compat/_internal/MutableList.d.ts +interface MutableList { + length: number; + [k: number]: T; +} +//#endregion +export { MutableList }; \ No newline at end of file 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..66b44b63e05778335af83578fb267c1220360a0d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.mts @@ -0,0 +1,8 @@ +import { ObjectIterator } from "./ObjectIterator.mjs"; +import { IterateeShorthand } from "./IterateeShorthand.mjs"; + +//#region src/compat/_internal/ObjectIteratee.d.ts +type ObjectIteratee = ObjectIterator | IterateeShorthand; +type ObjectIterateeCustom = ObjectIterator | IterateeShorthand; +//#endregion +export { ObjectIteratee, ObjectIterateeCustom }; \ No newline at end of file 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..2cd5edf90730123f503936c9b9b6f3ab76090023 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIteratee.d.ts @@ -0,0 +1,8 @@ +import { ObjectIterator } from "./ObjectIterator.js"; +import { IterateeShorthand } from "./IterateeShorthand.js"; + +//#region src/compat/_internal/ObjectIteratee.d.ts +type ObjectIteratee = ObjectIterator | IterateeShorthand; +type ObjectIterateeCustom = ObjectIterator | IterateeShorthand; +//#endregion +export { ObjectIteratee, ObjectIterateeCustom }; \ No newline at end of file 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..a4ffda1f0e19a4de7913dbdb1ca6540a7d2b2c65 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.mts @@ -0,0 +1,5 @@ +//#region src/compat/_internal/ObjectIterator.d.ts +type ObjectIterator = (value: T[keyof T], key: string, collection: T) => R; +type ObjectIteratorTypeGuard = (value: T[keyof T], key: string, collection: T) => value is U; +//#endregion +export { ObjectIterator, ObjectIteratorTypeGuard }; \ No newline at end of file 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..a4ffda1f0e19a4de7913dbdb1ca6540a7d2b2c65 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ObjectIterator.d.ts @@ -0,0 +1,5 @@ +//#region src/compat/_internal/ObjectIterator.d.ts +type ObjectIterator = (value: T[keyof T], key: string, collection: T) => R; +type ObjectIteratorTypeGuard = (value: T[keyof T], key: string, collection: T) => value is U; +//#endregion +export { ObjectIterator, ObjectIteratorTypeGuard }; \ No newline at end of file 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..a24ea20bf2d0ee91602cf90353520915f0920b00 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/PartialShallow.d.ts +type PartialShallow = { [P in keyof T]?: T[P] extends object ? object : T[P] }; +//#endregion +export { PartialShallow }; \ No newline at end of file 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..a24ea20bf2d0ee91602cf90353520915f0920b00 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PartialShallow.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/PartialShallow.d.ts +type PartialShallow = { [P in keyof T]?: T[P] extends object ? object : T[P] }; +//#endregion +export { PartialShallow }; \ No newline at end of file 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..e5925cda5aced6b772374f75480438b0d635aa10 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.mts @@ -0,0 +1,6 @@ +import { Many } from "./Many.mjs"; + +//#region src/compat/_internal/PropertyPath.d.ts +type PropertyPath = Many; +//#endregion +export { PropertyPath }; \ No newline at end of file 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..adfcc9f069dcc3878623d178ae7d3890323c75df --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/PropertyPath.d.ts @@ -0,0 +1,6 @@ +import { Many } from "./Many.js"; + +//#region src/compat/_internal/PropertyPath.d.ts +type PropertyPath = Many; +//#endregion +export { PropertyPath }; \ No newline at end of file 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..740bf4d43c0d7c14338a6b307c2f2c617887f200 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/RecursiveArray.d.ts +interface RecursiveArray extends Array> {} +//#endregion +export { RecursiveArray }; \ No newline at end of file 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..740bf4d43c0d7c14338a6b307c2f2c617887f200 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RecursiveArray.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/RecursiveArray.d.ts +interface RecursiveArray extends Array> {} +//#endregion +export { RecursiveArray }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.mts b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..068f5348e6ce4b1ddbeeb9cb6c4cf91976608147 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.mts @@ -0,0 +1,7 @@ +import { MutableList } from "./MutableList.mjs"; +import { IsWritable } from "./IsWritable.mjs"; + +//#region src/compat/_internal/RejectReadonly.d.ts +type RejectReadonly> = IsWritable extends true ? T : never; +//#endregion +export { RejectReadonly }; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.ts b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed451304446fbe5d323dd3922178ba0581ed049a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/RejectReadonly.d.ts @@ -0,0 +1,7 @@ +import { MutableList } from "./MutableList.js"; +import { IsWritable } from "./IsWritable.js"; + +//#region src/compat/_internal/RejectReadonly.d.ts +type RejectReadonly> = IsWritable extends true ? T : never; +//#endregion +export { RejectReadonly }; \ No newline at end of file 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..70025dabab903eba2d8448e293e09ec4beda5b42 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/StringIterator.d.ts +type StringIterator = (char: string, index: number, string: string) => R; +//#endregion +export { StringIterator }; \ No newline at end of file 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..70025dabab903eba2d8448e293e09ec4beda5b42 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/StringIterator.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/StringIterator.d.ts +type StringIterator = (char: string, index: number, string: string) => R; +//#endregion +export { StringIterator }; \ No newline at end of file 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..bace2c22bb5d335c006f83dac8e2ba37c9737a04 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/TupleIterator.d.ts +type TupleIterator = (value: T[number], index: T extends `${infer N extends number}` ? N : never, collection: T) => TResult; +//#endregion +export { TupleIterator }; \ No newline at end of file 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..bace2c22bb5d335c006f83dac8e2ba37c9737a04 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/TupleIterator.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/TupleIterator.d.ts +type TupleIterator = (value: T[number], index: T extends `${infer N extends number}` ? N : never, collection: T) => TResult; +//#endregion +export { TupleIterator }; \ No newline at end of file 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..0978a63d0b34c295a79863bd64e8939a845298f2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.mts @@ -0,0 +1,6 @@ +import { PartialShallow } from "./PartialShallow.mjs"; + +//#region src/compat/_internal/ValueIteratee.d.ts +type ValueIteratee = ((value: T) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); +//#endregion +export { ValueIteratee }; \ No newline at end of file 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..beafc5fd55ae1a9a61f1dbaf16ec5314d0317cf6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratee.d.ts @@ -0,0 +1,6 @@ +import { PartialShallow } from "./PartialShallow.js"; + +//#region src/compat/_internal/ValueIteratee.d.ts +type ValueIteratee = ((value: T) => unknown) | (PropertyKey | [PropertyKey, any] | PartialShallow); +//#endregion +export { ValueIteratee }; \ No newline at end of file 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..cefd08e6b7a2ca9132c1431884cffc0567149197 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.mts @@ -0,0 +1,6 @@ +import { IterateeShorthand } from "./IterateeShorthand.mjs"; + +//#region src/compat/_internal/ValueIterateeCustom.d.ts +type ValueIterateeCustom = ((value: T) => TResult) | IterateeShorthand; +//#endregion +export { ValueIterateeCustom }; \ No newline at end of file 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..ebfa2e5e9d015f997f1e6ec89d191a7581187c6b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIterateeCustom.d.ts @@ -0,0 +1,6 @@ +import { IterateeShorthand } from "./IterateeShorthand.js"; + +//#region src/compat/_internal/ValueIterateeCustom.d.ts +type ValueIterateeCustom = ((value: T) => TResult) | IterateeShorthand; +//#endregion +export { ValueIterateeCustom }; \ No newline at end of file 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..52a4fc7f604e2c6956e966103c55f7d7a4c459a2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ValueIteratorTypeGuard.d.ts +type ValueIteratorTypeGuard = (value: T) => value is S; +//#endregion +export { ValueIteratorTypeGuard }; \ No newline at end of file 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..52a4fc7f604e2c6956e966103c55f7d7a4c459a2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueIteratorTypeGuard.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ValueIteratorTypeGuard.d.ts +type ValueIteratorTypeGuard = (value: T) => value is S; +//#endregion +export { ValueIteratorTypeGuard }; \ No newline at end of file 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..e78834b34f477a6ffeff8cca215c356bbcedbddf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.mts @@ -0,0 +1,6 @@ +import { IterateeShorthand } from "./IterateeShorthand.mjs"; + +//#region src/compat/_internal/ValueKeyIteratee.d.ts +type ValueKeyIteratee = ((value: T, key: string) => unknown) | IterateeShorthand; +//#endregion +export { ValueKeyIteratee }; \ No newline at end of file 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..2f700734f98c87a7fb9d40b7a63103e84a111a05 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIteratee.d.ts @@ -0,0 +1,6 @@ +import { IterateeShorthand } from "./IterateeShorthand.js"; + +//#region src/compat/_internal/ValueKeyIteratee.d.ts +type ValueKeyIteratee = ((value: T, key: string) => unknown) | IterateeShorthand; +//#endregion +export { ValueKeyIteratee }; \ No newline at end of file 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..9f45ea7ba16b74e680fc85f1b7802fecafe0f213 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ValueKeyIterateeTypeGuard.d.ts +type ValueKeyIterateeTypeGuard = (value: T, key: string) => value is S; +//#endregion +export { ValueKeyIterateeTypeGuard }; \ No newline at end of file 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..9f45ea7ba16b74e680fc85f1b7802fecafe0f213 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/ValueKeyIterateeTypeGuard.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/_internal/ValueKeyIterateeTypeGuard.d.ts +type ValueKeyIterateeTypeGuard = (value: T, key: string) => value is S; +//#endregion +export { ValueKeyIterateeTypeGuard }; \ No newline at end of file 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..aa2f4a64e3354af9a8382b2218cabe33cab4ac01 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/assignValue.js @@ -0,0 +1,8 @@ +const require_eq = require("../util/eq.js"); +//#region src/compat/_internal/assignValue.ts +const assignValue = (object, key, value) => { + const objValue = object[key]; + if (!(Object.hasOwn(object, key) && require_eq.eq(objValue, value)) || value === void 0 && !(key in object)) object[key] = value; +}; +//#endregion +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..9b24a1cee2cc94237517f1cdaa974322e3efaa9b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs @@ -0,0 +1,8 @@ +import { eq } from "../util/eq.mjs"; +//#region src/compat/_internal/assignValue.ts +const assignValue = (object, key, value) => { + const objValue = object[key]; + if (!(Object.hasOwn(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) object[key] = value; +}; +//#endregion +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..57d62ca72c12ff6c4fdab35beb07a616ec657280 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/compareValues.js @@ -0,0 +1,22 @@ +//#region src/compat/_internal/compareValues.ts +function getPriority(a) { + if (typeof a === "symbol") return 1; + if (a === null) return 2; + if (a === void 0) 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; +}; +//#endregion +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..0888373165fa2f78f35863c677381cd409ecde36 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/compareValues.mjs @@ -0,0 +1,22 @@ +//#region src/compat/_internal/compareValues.ts +function getPriority(a) { + if (typeof a === "symbol") return 1; + if (a === null) return 2; + if (a === void 0) 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; +}; +//#endregion +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..9f9975e4081191aaacf35557a84a1f327a0cbeae --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/copyArray.js @@ -0,0 +1,17 @@ +//#region src/compat/_internal/copyArray.ts +/** +* Copies the values of `source` to `array`. +* +* @template T +* @param {ArrayLike} source The array to copy values from. +* @param {T[]} [array=[]] The array to copy values to. +* @returns {T[]} Returns `array`. +*/ +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; +} +//#endregion +exports.default = 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..938b5aacaa5c794e4d00ef0ab4ea7e93ad495218 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/copyArray.mjs @@ -0,0 +1,17 @@ +//#region src/compat/_internal/copyArray.ts +/** +* Copies the values of `source` to `array`. +* +* @template T +* @param {ArrayLike} source The array to copy values from. +* @param {T[]} [array=[]] The array to copy values to. +* @returns {T[]} Returns `array`. +*/ +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; +} +//#endregion +export { copyArray as default }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/createPadding.js b/node_modules/es-toolkit/dist/compat/_internal/createPadding.js new file mode 100644 index 0000000000000000000000000000000000000000..5b0b097b644758df164533e49e67c4a31e632580 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/createPadding.js @@ -0,0 +1,14 @@ +const require_regexMultiByte = require("./regexMultiByte.js"); +//#region src/compat/_internal/createPadding.ts +function stringSize(str) { + return require_regexMultiByte.regexMultiByte.test(str) ? Array.from(str).length : str.length; +} +function createPadding(length, chars) { + const charsLength = stringSize(chars); + if (charsLength === 0 || length < 1) return ""; + const result = chars.repeat(Math.ceil(length / charsLength)); + return require_regexMultiByte.regexMultiByte.test(result) ? Array.from(result).slice(0, length).join("") : result.slice(0, length); +} +//#endregion +exports.createPadding = createPadding; +exports.stringSize = stringSize; diff --git a/node_modules/es-toolkit/dist/compat/_internal/createPadding.mjs b/node_modules/es-toolkit/dist/compat/_internal/createPadding.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d26125828e5fd0b617cc44a496f9ccbf4d8d5eb5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/createPadding.mjs @@ -0,0 +1,13 @@ +import { regexMultiByte } from "./regexMultiByte.mjs"; +//#region src/compat/_internal/createPadding.ts +function stringSize(str) { + return regexMultiByte.test(str) ? Array.from(str).length : str.length; +} +function createPadding(length, chars) { + const charsLength = stringSize(chars); + if (charsLength === 0 || length < 1) return ""; + const result = chars.repeat(Math.ceil(length / charsLength)); + return regexMultiByte.test(result) ? Array.from(result).slice(0, length).join("") : result.slice(0, length); +} +//#endregion +export { createPadding, stringSize }; 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..031d96f4d20b56be330502e7a5cc1761f5fc6eaa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.js @@ -0,0 +1,16 @@ +//#region src/compat/_internal/decimalAdjust.ts +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 && Number.isFinite(Number(number))) { + 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)); +} +//#endregion +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..7997393830d60e357eef3c200f620c1e30b08cad --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/decimalAdjust.mjs @@ -0,0 +1,16 @@ +//#region src/compat/_internal/decimalAdjust.ts +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 && Number.isFinite(Number(number))) { + 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)); +} +//#endregion +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..70890353956fba0997da5daf984c41eadadf03ce --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.js @@ -0,0 +1,13 @@ +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/_internal/flattenArrayLike.ts +function flattenArrayLike(values) { + const result = []; + for (let i = 0; i < values.length; i++) { + const arrayLike = values[i]; + if (!require_isArrayLikeObject.isArrayLikeObject(arrayLike)) continue; + for (let j = 0; j < arrayLike.length; j++) result.push(arrayLike[j]); + } + return result; +} +//#endregion +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..0c6c5e835bbea1c0edf7aff000a0856411bb5ef4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/flattenArrayLike.mjs @@ -0,0 +1,13 @@ +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/_internal/flattenArrayLike.ts +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; +} +//#endregion +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..7b312359d5b3946463b3d3a3d3a7528c9bea6848 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js @@ -0,0 +1,6 @@ +//#region src/compat/_internal/getSymbols.ts +function getSymbols(object) { + return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol)); +} +//#endregion +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..8b0ae8ef935d276b9b4d7bd6695ee54151f68317 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs @@ -0,0 +1,6 @@ +//#region src/compat/_internal/getSymbols.ts +function getSymbols(object) { + return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol)); +} +//#endregion +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..2109bd29d93df7c678d25462f194a5d4f26d54c2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.js @@ -0,0 +1,12 @@ +const require_getSymbols = require("./getSymbols.js"); +//#region src/compat/_internal/getSymbolsIn.ts +function getSymbolsIn(object) { + const result = []; + while (object) { + result.push(...require_getSymbols.getSymbols(object)); + object = Object.getPrototypeOf(object); + } + return result; +} +//#endregion +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..83e35c71b0c1d4f432d67245a8beab302aa568f2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.mjs @@ -0,0 +1,12 @@ +import { getSymbols } from "./getSymbols.mjs"; +//#region src/compat/_internal/getSymbolsIn.ts +function getSymbolsIn(object) { + const result = []; + while (object) { + result.push(...getSymbols(object)); + object = Object.getPrototypeOf(object); + } + return result; +} +//#endregion +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..3abdb40cec8c49f26516abd8586321e54aec9e23 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getTag.js @@ -0,0 +1,14 @@ +//#region src/compat/_internal/getTag.ts +/** +* Gets the `toStringTag` of `value`. +* +* @private +* @param {T} value The value to query. +* @returns {string} Returns the `Object.prototype.toString.call` result. +*/ +function getTag(value) { + if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]"; + return Object.prototype.toString.call(value); +} +//#endregion +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..77ddb9267598ad850c0214b796d256c9ec9c6418 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs @@ -0,0 +1,14 @@ +//#region src/compat/_internal/getTag.ts +/** +* Gets the `toStringTag` of `value`. +* +* @private +* @param {T} value The value to query. +* @returns {string} Returns the `Object.prototype.toString.call` result. +*/ +function getTag(value) { + if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]"; + return Object.prototype.toString.call(value); +} +//#endregion +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..50c88a7042f845da8d051db3fd38c92e31ab4bbe --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js @@ -0,0 +1,40 @@ +//#region src/compat/_internal/isDeepKey.ts +/** Matches any deep property path. Examples: `a.b`, `a[0]`, `a["b"]` */ +const regexIsDeepProp = /\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/; +/** +* Checks if a given key is a deep key. +* +* A deep key is a string that contains a dot (.) or square brackets with a property accessor. +* +* @param {PropertyKey} key - The key to check. +* @returns {boolean} - Returns true if the key is a deep key, otherwise false. +* +* Examples: +* +* isDeepKey('a.b') // true +* isDeepKey('a[b]') // true +* isDeepKey('a') // false +* isDeepKey(123) // false +* isDeepKey('a.b.c') // true +* isDeepKey('a[b][c]') // true +* isDeepKey('a.') // false +* isDeepKey('.a') // false +* isDeepKey('a[b') // false +* isDeepKey('a]b]') // false +* isDeepKey('a][b') // false +* isDeepKey('') // false +* isDeepKey('a[0]') // true +* +*/ +function isDeepKey(key) { + switch (typeof key) { + case "number": + case "symbol": return false; + case "string": + if (key === "" || key.startsWith(".") || key.endsWith(".")) return false; + return regexIsDeepProp.test(key); + default: return false; + } +} +//#endregion +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..8d4ed8de7824101de006fb762b2aaa1c08cc0907 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs @@ -0,0 +1,40 @@ +//#region src/compat/_internal/isDeepKey.ts +/** Matches any deep property path. Examples: `a.b`, `a[0]`, `a["b"]` */ +const regexIsDeepProp = /\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/; +/** +* Checks if a given key is a deep key. +* +* A deep key is a string that contains a dot (.) or square brackets with a property accessor. +* +* @param {PropertyKey} key - The key to check. +* @returns {boolean} - Returns true if the key is a deep key, otherwise false. +* +* Examples: +* +* isDeepKey('a.b') // true +* isDeepKey('a[b]') // true +* isDeepKey('a') // false +* isDeepKey(123) // false +* isDeepKey('a.b.c') // true +* isDeepKey('a[b][c]') // true +* isDeepKey('a.') // false +* isDeepKey('.a') // false +* isDeepKey('a[b') // false +* isDeepKey('a]b]') // false +* isDeepKey('a][b') // false +* isDeepKey('') // false +* isDeepKey('a[0]') // true +* +*/ +function isDeepKey(key) { + switch (typeof key) { + case "number": + case "symbol": return false; + case "string": + if (key === "" || key.startsWith(".") || key.endsWith(".")) return false; + return regexIsDeepProp.test(key); + default: return false; + } +} +//#endregion +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..4d596dc6487ef0b1f1583fb8c948a656d7625116 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIndex.js @@ -0,0 +1,11 @@ +//#region src/compat/_internal/isIndex.ts +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); + } +} +//#endregion +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..6be28ab371d0209b6f57563e7f34b93a9490021d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs @@ -0,0 +1,11 @@ +//#region src/compat/_internal/isIndex.ts +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); + } +} +//#endregion +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..eabb237780687eef005d36785aeb6688e48d4ad9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.js @@ -0,0 +1,12 @@ +const require_eq = require("../util/eq.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isObject = require("../predicate/isObject.js"); +const require_isIndex = require("./isIndex.js"); +//#region src/compat/_internal/isIterateeCall.ts +function isIterateeCall(value, index, object) { + if (!require_isObject.isObject(object)) return false; + if (typeof index === "number" && require_isArrayLike.isArrayLike(object) && require_isIndex.isIndex(index) && index < object.length || typeof index === "string" && index in object) return require_eq.eq(object[index], value); + return false; +} +//#endregion +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..c614b836de44353db4f8c6f63e96d3ae7b0c651f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs @@ -0,0 +1,12 @@ +import { eq } from "../util/eq.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isObject } from "../predicate/isObject.mjs"; +import { isIndex } from "./isIndex.mjs"; +//#region src/compat/_internal/isIterateeCall.ts +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 eq(object[index], value); + return false; +} +//#endregion +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..9283ddde76c12ea956f513c2a4673cd4a1eae9cf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isKey.js @@ -0,0 +1,26 @@ +const require_isSymbol = require("../predicate/isSymbol.js"); +//#region src/compat/_internal/isKey.ts +/** Matches any deep property path. (e.g. `a.b[0].c`)*/ +const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; +/** Matches any word character (alphanumeric & underscore).*/ +const regexIsPlainProp = /^\w*$/; +/** +* Checks if `value` is a property name and not a property path. (It's ok that the `value` is not in the keys of the `object`) +* @param {unknown} value The value to check. +* @param {unknown} object The object to query. +* @returns {boolean} Returns `true` if `value` is a property name, else `false`. +* +* @example +* isKey('a', { a: 1 }); +* // => true +* +* isKey('a.b', { a: { b: 2 } }); +* // => false +*/ +function isKey(value, object) { + if (Array.isArray(value)) return false; + if (typeof value === "number" || typeof value === "boolean" || value == null || require_isSymbol.isSymbol(value)) return true; + return typeof value === "string" && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value)) || object != null && Object.hasOwn(object, value); +} +//#endregion +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..c39feaed104e6236c8836e30bb15c415494c4938 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs @@ -0,0 +1,26 @@ +import { isSymbol } from "../predicate/isSymbol.mjs"; +//#region src/compat/_internal/isKey.ts +/** Matches any deep property path. (e.g. `a.b[0].c`)*/ +const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; +/** Matches any word character (alphanumeric & underscore).*/ +const regexIsPlainProp = /^\w*$/; +/** +* Checks if `value` is a property name and not a property path. (It's ok that the `value` is not in the keys of the `object`) +* @param {unknown} value The value to check. +* @param {unknown} object The object to query. +* @returns {boolean} Returns `true` if `value` is a property name, else `false`. +* +* @example +* isKey('a', { a: 1 }); +* // => true +* +* isKey('a.b', { a: { b: 2 } }); +* // => false +*/ +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); +} +//#endregion +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..f5756f938d1beaef8736108805da930f082c6b6f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js @@ -0,0 +1,7 @@ +//#region src/compat/_internal/isPrototype.ts +function isPrototype(value) { + const constructor = value?.constructor; + return value === (typeof constructor === "function" ? constructor.prototype : Object.prototype); +} +//#endregion +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..dc21b4a976f298b53c65cbb759556e25f39b7a38 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs @@ -0,0 +1,7 @@ +//#region src/compat/_internal/isPrototype.ts +function isPrototype(value) { + const constructor = value?.constructor; + return value === (typeof constructor === "function" ? constructor.prototype : Object.prototype); +} +//#endregion +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..2fe244c22892fecff42b54a4c88110e73fd6896b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.js @@ -0,0 +1,10 @@ +//#region src/compat/_internal/mapToEntries.ts +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; +} +//#endregion +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..11229c2dc4b2540da200a24b68a546f4d5dfa30f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/mapToEntries.mjs @@ -0,0 +1,10 @@ +//#region src/compat/_internal/mapToEntries.ts +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; +} +//#endregion +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..28b00a9834d301302d378a936c7209e32bbb2b0d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.js @@ -0,0 +1,8 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/_internal/normalizeForCase.ts +function normalizeForCase(str) { + if (typeof str !== "string") str = require_toString.toString(str); + return str.replace(/['\u2019]/g, ""); +} +//#endregion +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..ad4e6ae80bd41e127826d5c435f7e7e69c444399 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.mjs @@ -0,0 +1,8 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/_internal/normalizeForCase.ts +function normalizeForCase(str) { + if (typeof str !== "string") str = toString(str); + return str.replace(/['\u2019]/g, ""); +} +//#endregion +export { normalizeForCase }; diff --git a/node_modules/es-toolkit/dist/compat/_internal/regexMultiByte.js b/node_modules/es-toolkit/dist/compat/_internal/regexMultiByte.js new file mode 100644 index 0000000000000000000000000000000000000000..65ba000d70652e3ac340cea8e9e51ce9745fed34 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/regexMultiByte.js @@ -0,0 +1,11 @@ +//#region src/compat/_internal/regexMultiByte.ts +/** +* Used to compose unicode character classes. +* @link https://github.com/lodash/lodash/blob/4.17.21-es/_hasUnicode.js +* +* Used to detect strings with zero-width joiners or code points from the astral planes. +* @link http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/ +*/ +const regexMultiByte = /* @__PURE__ */ new RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"); +//#endregion +exports.regexMultiByte = regexMultiByte; diff --git a/node_modules/es-toolkit/dist/compat/_internal/regexMultiByte.mjs b/node_modules/es-toolkit/dist/compat/_internal/regexMultiByte.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6cdf83e288259711276eea6b1facd9d3f394dc7a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/regexMultiByte.mjs @@ -0,0 +1,11 @@ +//#region src/compat/_internal/regexMultiByte.ts +/** +* Used to compose unicode character classes. +* @link https://github.com/lodash/lodash/blob/4.17.21-es/_hasUnicode.js +* +* Used to detect strings with zero-width joiners or code points from the astral planes. +* @link http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/ +*/ +const regexMultiByte = /* @__PURE__ */ new RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"); +//#endregion +export { regexMultiByte }; 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..339d2cc4c639e8b44117e4c7e3d82d685670b386 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/setToEntries.js @@ -0,0 +1,12 @@ +//#region src/compat/_internal/setToEntries.ts +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; +} +//#endregion +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..4a6f48d09dca1e571df965a248857f087b7c663e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/setToEntries.mjs @@ -0,0 +1,12 @@ +//#region src/compat/_internal/setToEntries.ts +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; +} +//#endregion +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..0b20906694423408bda895ac14a8c3432c100d1b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/tags.js @@ -0,0 +1,54 @@ +//#region src/compat/_internal/tags.ts +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]"; +//#endregion +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..b278d7333382679d3444c4cc3de75a1dd42b00d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/tags.mjs @@ -0,0 +1,29 @@ +//#region src/compat/_internal/tags.ts +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]"; +//#endregion +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..ed5f11baa49d7e5e9009f9fcec88d9fe4de17a7d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toArray.js @@ -0,0 +1,6 @@ +//#region src/compat/_internal/toArray.ts +function toArray(value) { + return Array.isArray(value) ? value : Array.from(value); +} +//#endregion +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..801f3add186e6d813a9d5f8be457c94f0f027615 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toArray.mjs @@ -0,0 +1,6 @@ +//#region src/compat/_internal/toArray.ts +function toArray(value) { + return Array.isArray(value) ? value : Array.from(value); +} +//#endregion +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..dbb09a629c2aadb3e98dd7d5175256068f04e468 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toKey.js @@ -0,0 +1,15 @@ +//#region src/compat/_internal/toKey.ts +/** +* Converts `value` to a string key if it's not a string or symbol. +* +* @private +* @param {*} value The value to inspect. +* @returns {string|symbol} Returns the key. +*/ +function toKey(value) { + if (typeof value === "string" || typeof value === "symbol") return value; + if (Object.is(value?.valueOf?.(), -0)) return "-0"; + return String(value); +} +//#endregion +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..d5a8c9a220d12c558b95ca8ad662321051949625 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs @@ -0,0 +1,15 @@ +//#region src/compat/_internal/toKey.ts +/** +* Converts `value` to a string key if it's not a string or symbol. +* +* @private +* @param {*} value The value to inspect. +* @returns {string|symbol} Returns the key. +*/ +function toKey(value) { + if (typeof value === "string" || typeof value === "symbol") return value; + if (Object.is(value?.valueOf?.(), -0)) return "-0"; + return String(value); +} +//#endregion +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..2122fd630e055402b0cd32e52396c33220580bed --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.d.mts @@ -0,0 +1,30 @@ +//#region src/compat/array/castArray.d.ts +/** + * Casts value as an array if it's not one. + * + * @template T The type of elements in the array. + * @param value The value to be cast to an array. + * @returns 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[]; +//#endregion +export { castArray }; \ No newline at end of file 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..2122fd630e055402b0cd32e52396c33220580bed --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.d.ts @@ -0,0 +1,30 @@ +//#region src/compat/array/castArray.d.ts +/** + * Casts value as an array if it's not one. + * + * @template T The type of elements in the array. + * @param value The value to be cast to an array. + * @returns 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[]; +//#endregion +export { castArray }; \ No newline at end of file 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..0ca0400bcc6ba39f749a5fcd0e86cf89aa1961bf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.js @@ -0,0 +1,33 @@ +//#region src/compat/array/castArray.ts +/** +* Casts value as an array if it's not one. +* +* @template T The type of elements in the array. +* @param value The value to be cast to an array. +* @returns 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: [] +*/ +function castArray(value) { + if (arguments.length === 0) return []; + return Array.isArray(value) ? value : [value]; +} +//#endregion +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..8410f9ea65786e409b36bd9039941c9287d630ea --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/castArray.mjs @@ -0,0 +1,33 @@ +//#region src/compat/array/castArray.ts +/** +* Casts value as an array if it's not one. +* +* @template T The type of elements in the array. +* @param value The value to be cast to an array. +* @returns 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: [] +*/ +function castArray(value) { + if (arguments.length === 0) return []; + return Array.isArray(value) ? value : [value]; +} +//#endregion +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..047c0838e3a0a3fef0c655b941a36cedd85d0cac --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.d.mts @@ -0,0 +1,26 @@ +//#region src/compat/array/chunk.d.ts +/** + * 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 arr - The array to be chunked into smaller arrays. + * @param size - The size of each smaller array. Must be a positive integer. + * @returns 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[][]; +//#endregion +export { chunk }; \ No newline at end of file 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..047c0838e3a0a3fef0c655b941a36cedd85d0cac --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.d.ts @@ -0,0 +1,26 @@ +//#region src/compat/array/chunk.d.ts +/** + * 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 arr - The array to be chunked into smaller arrays. + * @param size - The size of each smaller array. Must be a positive integer. + * @returns 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[][]; +//#endregion +export { chunk }; \ No newline at end of file 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..cad37a77736db7383cc9f88d7afda655b2ea2793 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.js @@ -0,0 +1,35 @@ +const require_chunk = require("../../array/chunk.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/chunk.ts +/** +* 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 arr - The array to be chunked into smaller arrays. +* @param size - The size of each smaller array. Must be a positive integer. +* @returns 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']] +*/ +function chunk(arr, size = 1) { + size = Math.max(Math.floor(size), 0); + if (size === 0 || !require_isArrayLike.isArrayLike(arr) || Number.isNaN(size)) return []; + const array = require_toArray.toArray(arr); + if (!isFinite(size)) return [array]; + return require_chunk.chunk(array, size); +} +//#endregion +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..39f00bb7cdd1079de12d11eeb890514f861e179e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/chunk.mjs @@ -0,0 +1,35 @@ +import { chunk as chunk$1 } from "../../array/chunk.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/chunk.ts +/** +* 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 arr - The array to be chunked into smaller arrays. +* @param size - The size of each smaller array. Must be a positive integer. +* @returns 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']] +*/ +function chunk(arr, size = 1) { + size = Math.max(Math.floor(size), 0); + if (size === 0 || !isArrayLike(arr) || Number.isNaN(size)) return []; + const array = toArray(arr); + if (!isFinite(size)) return [array]; + return chunk$1(array, size); +} +//#endregion +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..7e23a3a4b8a391ecb98929c2c70508eec2bea759 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/array/compact.d.ts +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 arr - The input array to remove falsey values. + * @returns 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[]; +//#endregion +export { compact }; \ No newline at end of file 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..7e23a3a4b8a391ecb98929c2c70508eec2bea759 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/array/compact.d.ts +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 arr - The input array to remove falsey values. + * @returns 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[]; +//#endregion +export { compact }; \ No newline at end of file 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..54a0d0011aff267b92a09dc6ad0ad43ef8e01f10 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.js @@ -0,0 +1,20 @@ +const require_compact = require("../../array/compact.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/compact.ts +/** +* Removes falsey values (false, null, 0, 0n, '', undefined, NaN) from an array. +* +* @template T - The type of elements in the array. +* @param arr - The input array to remove falsey values. +* @returns 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] +*/ +function compact(arr) { + if (!require_isArrayLike.isArrayLike(arr)) return []; + return require_compact.compact(Array.from(arr)); +} +//#endregion +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..aa1a4b6276e7442e7fd6131b0e674c764f9cc5e8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/compact.mjs @@ -0,0 +1,20 @@ +import { compact as compact$1 } from "../../array/compact.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/compact.ts +/** +* Removes falsey values (false, null, 0, 0n, '', undefined, NaN) from an array. +* +* @template T - The type of elements in the array. +* @param arr - The input array to remove falsey values. +* @returns 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] +*/ +function compact(arr) { + if (!isArrayLike(arr)) return []; + return compact$1(Array.from(arr)); +} +//#endregion +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..47dcd1b538a36d05b191ed02d5f1cdfa62dde380 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/array/concat.d.ts +/** + * Concatenates multiple arrays and values into a single array. + * + * @template T The type of elements in the array. + * @param values - The values and/or arrays to concatenate. + * @returns 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[]; +//#endregion +export { concat }; \ No newline at end of file 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..47dcd1b538a36d05b191ed02d5f1cdfa62dde380 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/array/concat.d.ts +/** + * Concatenates multiple arrays and values into a single array. + * + * @template T The type of elements in the array. + * @param values - The values and/or arrays to concatenate. + * @returns 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[]; +//#endregion +export { concat }; \ No newline at end of file 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..3ccf3683526ae34bf0d456f9b6084ce143e5ce4e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.js @@ -0,0 +1,34 @@ +const require_flatten = require("../../array/flatten.js"); +//#region src/compat/array/concat.ts +/** +* Concatenates multiple arrays and values into a single array. +* +* @template T The type of elements in the array. +* @param values - The values and/or arrays to concatenate. +* @returns 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] +*/ +function concat(...values) { + return require_flatten.flatten(values); +} +//#endregion +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..60906b1fd11193e9f19493eb845cc2694f56966e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/concat.mjs @@ -0,0 +1,34 @@ +import { flatten } from "../../array/flatten.mjs"; +//#region src/compat/array/concat.ts +/** +* Concatenates multiple arrays and values into a single array. +* +* @template T The type of elements in the array. +* @param values - The values and/or arrays to concatenate. +* @returns 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] +*/ +function concat(...values) { + return flatten(values); +} +//#endregion +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..dc72d6edcf4a4623863853e8a078ee7a294cb11a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.d.mts @@ -0,0 +1,20 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/countBy.d.ts +/** + * 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; +//#endregion +export { countBy }; \ No newline at end of file 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..57a26e1160e006ce44b876290b8dc3cde06cb732 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.d.ts @@ -0,0 +1,20 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/countBy.d.ts +/** + * 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; +//#endregion +export { countBy }; \ No newline at end of file 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..e7482d868934b8cf44cc96ed8702fd00096498f8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.js @@ -0,0 +1,17 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/countBy.ts +function countBy(collection, iteratee$1) { + if (collection == null) return {}; + const array = require_isArrayLike.isArrayLike(collection) ? Array.from(collection) : Object.values(collection); + const mapper = require_iteratee.iteratee(iteratee$1 ?? void 0); + 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; +} +//#endregion +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..20ac3cf85fbdbad699b39d05c07df5d0531a1999 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/countBy.mjs @@ -0,0 +1,17 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/countBy.ts +function countBy(collection, iteratee$1) { + if (collection == null) return {}; + const array = isArrayLike(collection) ? Array.from(collection) : Object.values(collection); + const mapper = iteratee(iteratee$1 ?? void 0); + 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; +} +//#endregion +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..2503da4366e6d823b89f60aa1de7d8f98271ad47 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.d.mts @@ -0,0 +1,29 @@ +//#region src/compat/array/difference.d.ts +/** + * Computes the difference between an array and multiple arrays. + * + * @template T + * @param arr - The primary array from which to derive the difference. This is the main array + * from which elements will be compared and filtered. + * @param 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 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[]; +//#endregion +export { difference }; \ No newline at end of file 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..2503da4366e6d823b89f60aa1de7d8f98271ad47 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.d.ts @@ -0,0 +1,29 @@ +//#region src/compat/array/difference.d.ts +/** + * Computes the difference between an array and multiple arrays. + * + * @template T + * @param arr - The primary array from which to derive the difference. This is the main array + * from which elements will be compared and filtered. + * @param 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 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[]; +//#endregion +export { difference }; \ No newline at end of file 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..bbb54276928bdaaed8da1667ea7cb12cc667919c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.js @@ -0,0 +1,40 @@ +const require_difference = require("../../array/difference.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/difference.ts +/** +* Computes the difference between an array and multiple arrays. +* +* @template T +* @param arr - The primary array from which to derive the difference. This is the main array +* from which elements will be compared and filtered. +* @param 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 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. +*/ +function difference(arr, ...values) { + if (!require_isArrayLikeObject.isArrayLikeObject(arr)) return []; + const arr1 = Array.from(arr); + const arr2 = []; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (require_isArrayLikeObject.isArrayLikeObject(value)) arr2.push(...Array.from(value)); + } + return require_difference.difference(arr1, arr2); +} +//#endregion +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..a3eb1a9084c07ce66273a878504a6ce0275ed95d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/difference.mjs @@ -0,0 +1,40 @@ +import { difference as difference$1 } from "../../array/difference.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/difference.ts +/** +* Computes the difference between an array and multiple arrays. +* +* @template T +* @param arr - The primary array from which to derive the difference. This is the main array +* from which elements will be compared and filtered. +* @param 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 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. +*/ +function difference(arr, ...values) { + if (!isArrayLikeObject(arr)) return []; + const arr1 = Array.from(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); +} +//#endregion +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..575b25062ba92f6aed89a916dc64fed998117cde --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.d.mts @@ -0,0 +1,109 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/differenceBy.d.ts +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2 + * @param array The array to inspect + * @param values The values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param values4 The fourth array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param values4 The fourth array of values to exclude + * @param values5 The fifth array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param values4 The fourth array of values to exclude + * @param values5 The fifth array of values to exclude + * @param values Additional arrays of values to exclude and iteratee + * @returns 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 array The array to inspect + * @param values The arrays of values to exclude + * @returns Returns the new array of filtered values + * @example + * differenceBy([2, 1], [2, 3]) + * // => [1] + */ +declare function differenceBy(array: ArrayLike | null | undefined, ...values: Array>): T[]; +//#endregion +export { differenceBy }; \ No newline at end of file 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..06de1e9dea3ec95c71be7d1426b79cfa25025761 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.d.ts @@ -0,0 +1,109 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/differenceBy.d.ts +/** + * Creates an array of array values not included in the other given arrays using an iteratee function. + * + * @template T1, T2 + * @param array The array to inspect + * @param values The values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param values4 The fourth array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param values4 The fourth array of values to exclude + * @param values5 The fifth array of values to exclude + * @param iteratee The iteratee invoked per element + * @returns 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 array The array to inspect + * @param values1 The first array of values to exclude + * @param values2 The second array of values to exclude + * @param values3 The third array of values to exclude + * @param values4 The fourth array of values to exclude + * @param values5 The fifth array of values to exclude + * @param values Additional arrays of values to exclude and iteratee + * @returns 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 array The array to inspect + * @param values The arrays of values to exclude + * @returns Returns the new array of filtered values + * @example + * differenceBy([2, 1], [2, 3]) + * // => [1] + */ +declare function differenceBy(array: ArrayLike | null | undefined, ...values: Array>): T[]; +//#endregion +export { differenceBy }; \ No newline at end of file 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..1cbfa9858cac91ca6e37089c29eb99d2afc37f27 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.js @@ -0,0 +1,24 @@ +const require_difference = require("../../array/difference.js"); +const require_differenceBy = require("../../array/differenceBy.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_last = require("./last.js"); +const require_flattenArrayLike = require("../_internal/flattenArrayLike.js"); +//#region src/compat/array/differenceBy.ts +/** +* Computes the difference between an array and multiple arrays using an iteratee function. +* +* @template T +* @param array - The primary array from which to derive the difference. +* @param values - Multiple arrays containing elements to be excluded from the primary array. +* @returns A new array containing the elements that are present in the primary array but not in the values arrays. +*/ +function differenceBy(array, ..._values) { + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + const iteratee$1 = require_last.last(_values); + const values = require_flattenArrayLike.flattenArrayLike(_values); + if (require_isArrayLikeObject.isArrayLikeObject(iteratee$1)) return require_difference.difference(Array.from(array), values); + return require_differenceBy.differenceBy(Array.from(array), values, require_iteratee.iteratee(iteratee$1)); +} +//#endregion +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..6f93cc133b9f44fa230be3da490b7d270009e857 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceBy.mjs @@ -0,0 +1,24 @@ +import { difference } from "../../array/difference.mjs"; +import { differenceBy as differenceBy$1 } from "../../array/differenceBy.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { last } from "./last.mjs"; +import { flattenArrayLike } from "../_internal/flattenArrayLike.mjs"; +//#region src/compat/array/differenceBy.ts +/** +* Computes the difference between an array and multiple arrays using an iteratee function. +* +* @template T +* @param array - The primary array from which to derive the difference. +* @param values - Multiple arrays containing elements to be excluded from the primary array. +* @returns A new array containing the elements that are present in the primary array but not in the values arrays. +*/ +function differenceBy(array, ..._values) { + if (!isArrayLikeObject(array)) return []; + const iteratee$1 = last(_values); + const values = flattenArrayLike(_values); + if (isArrayLikeObject(iteratee$1)) return difference(Array.from(array), values); + return differenceBy$1(Array.from(array), values, iteratee(iteratee$1)); +} +//#endregion +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..44a3cc2145ed4835bb59ec376c6df8a6c5081d96 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.d.mts @@ -0,0 +1,92 @@ +//#region src/compat/array/differenceWith.d.ts +/** + * Computes the difference between the primary array and another array using a comparator function. + * + * @template T1, T2 + * @param array - The primary array to compare elements against. + * @param values - The array containing elements to compare with the primary array. + * @param comparator - A function to determine if two elements are considered equal. + * @returns 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 array - The primary array to compare elements against. + * @param values1 - The first array containing elements to compare with the primary array. + * @param values2 - The second array containing elements to compare with the primary array. + * @param comparator - A function to determine if two elements are considered equal. + * @returns 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 array - The primary array to compare elements against. + * @param values1 - The first array containing elements to compare with the primary array. + * @param values2 - The second array containing elements to compare with the primary array. + * @param values - Additional arrays and an optional comparator function to determine if two elements are considered equal. + * @returns 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 array - The primary array to compare elements against. + * @param values - One or more arrays containing elements to compare with the primary array. + * @returns 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[]; +//#endregion +export { differenceWith }; \ No newline at end of file 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..44a3cc2145ed4835bb59ec376c6df8a6c5081d96 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.d.ts @@ -0,0 +1,92 @@ +//#region src/compat/array/differenceWith.d.ts +/** + * Computes the difference between the primary array and another array using a comparator function. + * + * @template T1, T2 + * @param array - The primary array to compare elements against. + * @param values - The array containing elements to compare with the primary array. + * @param comparator - A function to determine if two elements are considered equal. + * @returns 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 array - The primary array to compare elements against. + * @param values1 - The first array containing elements to compare with the primary array. + * @param values2 - The second array containing elements to compare with the primary array. + * @param comparator - A function to determine if two elements are considered equal. + * @returns 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 array - The primary array to compare elements against. + * @param values1 - The first array containing elements to compare with the primary array. + * @param values2 - The second array containing elements to compare with the primary array. + * @param values - Additional arrays and an optional comparator function to determine if two elements are considered equal. + * @returns 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 array - The primary array to compare elements against. + * @param values - One or more arrays containing elements to compare with the primary array. + * @returns 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[]; +//#endregion +export { differenceWith }; \ No newline at end of file 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..8bddce431f033b9326ca1cf697d289535644e6c1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.js @@ -0,0 +1,42 @@ +const require_difference = require("../../array/difference.js"); +const require_differenceWith = require("../../array/differenceWith.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_last = require("./last.js"); +const require_flattenArrayLike = require("../_internal/flattenArrayLike.js"); +//#region src/compat/array/differenceWith.ts +/** +* Computes the difference between the primary array and one or more arrays using an optional comparator function. +* +* @template T +* @param array - The primary array to compare elements against. +* @param values - One or more arrays to compare with the primary array, and an optional comparator function to determine if two elements are considered equal. +* @returns A new array containing the elements from the primary array that do not match any elements in the provided arrays or those compared using the comparator function. +* +* @example +* // Example with a comparator function +* 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 }] +* +* @example +* // Example without a comparator function +* const array = [1, 2, 3]; +* const values1 = [2]; +* const values2 = [3]; +* +* const result = differenceWith(array, values1, values2); +* // result will be [1] +*/ +function differenceWith(array, ...values) { + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + const comparator = require_last.last(values); + const flattenedValues = require_flattenArrayLike.flattenArrayLike(values); + if (typeof comparator === "function") return require_differenceWith.differenceWith(Array.from(array), flattenedValues, comparator); + return require_difference.difference(Array.from(array), flattenedValues); +} +//#endregion +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..8bebe8972be75442dad50a1dac4fa9b1b2c7ad83 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/differenceWith.mjs @@ -0,0 +1,42 @@ +import { difference } from "../../array/difference.mjs"; +import { differenceWith as differenceWith$1 } from "../../array/differenceWith.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { last } from "./last.mjs"; +import { flattenArrayLike } from "../_internal/flattenArrayLike.mjs"; +//#region src/compat/array/differenceWith.ts +/** +* Computes the difference between the primary array and one or more arrays using an optional comparator function. +* +* @template T +* @param array - The primary array to compare elements against. +* @param values - One or more arrays to compare with the primary array, and an optional comparator function to determine if two elements are considered equal. +* @returns A new array containing the elements from the primary array that do not match any elements in the provided arrays or those compared using the comparator function. +* +* @example +* // Example with a comparator function +* 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 }] +* +* @example +* // Example without a comparator function +* const array = [1, 2, 3]; +* const values1 = [2]; +* const values2 = [3]; +* +* const result = differenceWith(array, values1, values2); +* // result will be [1] +*/ +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); +} +//#endregion +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..a659dc1175d384c6c5308a8a5df0d597fca06b7e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.d.mts @@ -0,0 +1,20 @@ +//#region src/compat/array/drop.d.ts +/** + * 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 array - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the beginning of the array. + * @returns 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, itemsCount?: number): T[]; +//#endregion +export { drop }; \ No newline at end of file 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..a659dc1175d384c6c5308a8a5df0d597fca06b7e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.d.ts @@ -0,0 +1,20 @@ +//#region src/compat/array/drop.d.ts +/** + * 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 array - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the beginning of the array. + * @returns 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, itemsCount?: number): T[]; +//#endregion +export { drop }; \ No newline at end of file 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..127762a6911bc282bea1cf449406e46535357613 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.js @@ -0,0 +1,12 @@ +const require_drop = require("../../array/drop.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/array/drop.ts +function drop(array, itemsCount = 1, guard) { + if (!require_isArrayLike.isArrayLike(array)) return []; + itemsCount = guard ? 1 : require_toInteger.toInteger(itemsCount); + return require_drop.drop(require_toArray.toArray(array), itemsCount); +} +//#endregion +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..07e08b4cad86effe01a6a3e025f55f234e370fe7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/drop.mjs @@ -0,0 +1,12 @@ +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"; +//#region src/compat/array/drop.ts +function drop(array, itemsCount = 1, guard) { + if (!isArrayLike(array)) return []; + itemsCount = guard ? 1 : toInteger(itemsCount); + return drop$1(toArray(array), itemsCount); +} +//#endregion +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..d79e5ed75f1461460c8ff3559dc5643e82af3cff --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/array/dropRight.d.ts +/** + * 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 collection - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the end of the array. + * @param [guard] - Enables use as an iteratee for methods like `_.map`. + * @returns 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[]; +//#endregion +export { dropRight }; \ No newline at end of file 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..d79e5ed75f1461460c8ff3559dc5643e82af3cff --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/array/dropRight.d.ts +/** + * 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 collection - The array from which to drop elements. + * @param itemsCount - The number of elements to drop from the end of the array. + * @param [guard] - Enables use as an iteratee for methods like `_.map`. + * @returns 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[]; +//#endregion +export { dropRight }; \ No newline at end of file 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..1cc8d49435239ff48de57fe4412995fd2c243d5a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.js @@ -0,0 +1,29 @@ +const require_dropRight = require("../../array/dropRight.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/array/dropRight.ts +/** +* 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 collection - The array from which to drop elements. +* @param itemsCount - The number of elements to drop from the end of the array. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns 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. +*/ +function dropRight(collection, itemsCount = 1, guard) { + if (!require_isArrayLike.isArrayLike(collection)) return []; + itemsCount = guard ? 1 : require_toInteger.toInteger(itemsCount); + return require_dropRight.dropRight(require_toArray.toArray(collection), itemsCount); +} +//#endregion +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..a47cfb6eff762c8675481b7b18f27859cbf9bf99 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRight.mjs @@ -0,0 +1,29 @@ +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"; +//#region src/compat/array/dropRight.ts +/** +* 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 collection - The array from which to drop elements. +* @param itemsCount - The number of elements to drop from the end of the array. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns 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. +*/ +function dropRight(collection, itemsCount = 1, guard) { + if (!isArrayLike(collection)) return []; + itemsCount = guard ? 1 : toInteger(itemsCount); + return dropRight$1(toArray(collection), itemsCount); +} +//#endregion +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..b0b5ea7dfa94c7898d6918f4d5704ede9c749094 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.mts @@ -0,0 +1,38 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; + +//#region src/compat/array/dropRightWhile.d.ts +/** + * 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 array - The array to query. + * @param [predicate] - The function invoked per iteration. + * @returns 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 }, { user: 'fred', active: false }, { user: 'pebbles', active: false }] + */ +declare function dropRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { dropRightWhile }; \ No newline at end of file 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..515c8b57e18948362c2b0e8ed991508a18ee9b64 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.d.ts @@ -0,0 +1,38 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; + +//#region src/compat/array/dropRightWhile.d.ts +/** + * 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 array - The array to query. + * @param [predicate] - The function invoked per iteration. + * @returns 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 }, { user: 'fred', active: false }, { user: 'pebbles', active: false }] + */ +declare function dropRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { dropRightWhile }; \ No newline at end of file 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..7747790f080dc2435e11794934dbd0996aa9e329 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.js @@ -0,0 +1,45 @@ +const require_dropRightWhile = require("../../array/dropRightWhile.js"); +const require_identity = require("../../function/identity.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_property = require("../object/property.js"); +const require_matches = require("../predicate/matches.js"); +const require_matchesProperty = require("../predicate/matchesProperty.js"); +//#region src/compat/array/dropRightWhile.ts +/** +* Removes elements from the end of an array until the predicate returns false. +* +* This function iterates over an array and drops elements from the end 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 array - The array from which to drop elements. +* @param predicate - A predicate function that determines +* whether to continue dropping elements. The function is called with each element, index, and array, and dropping +* continues as long as it returns true. +* @returns A new array with the elements remaining after the predicate returns false. +* +* @example +* const array = [3, 2, 1]; +* const result = dropRightWhile(array, (item, index, arr) => index >= 1); +* // Returns: [3] +*/ +function dropRightWhile(array, predicate = require_identity.identity) { + if (!require_isArrayLike.isArrayLike(array)) return []; + return dropRightWhileImpl(require_toArray.toArray(array), predicate); +} +function dropRightWhileImpl(arr, predicate) { + switch (typeof predicate) { + case "function": return require_dropRightWhile.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 require_dropRightWhile.dropRightWhile(arr, require_matchesProperty.matchesProperty(key, value)); + } else return require_dropRightWhile.dropRightWhile(arr, require_matches.matches(predicate)); + case "symbol": + case "number": + case "string": return require_dropRightWhile.dropRightWhile(arr, require_property.property(predicate)); + } +} +//#endregion +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..1c3a28655739a5dc3c2d77b904c8d1b2a3b6676a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropRightWhile.mjs @@ -0,0 +1,45 @@ +import { dropRightWhile as dropRightWhile$1 } from "../../array/dropRightWhile.mjs"; +import { identity } from "../../function/identity.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { property } from "../object/property.mjs"; +import { matches } from "../predicate/matches.mjs"; +import { matchesProperty } from "../predicate/matchesProperty.mjs"; +//#region src/compat/array/dropRightWhile.ts +/** +* Removes elements from the end of an array until the predicate returns false. +* +* This function iterates over an array and drops elements from the end 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 array - The array from which to drop elements. +* @param predicate - A predicate function that determines +* whether to continue dropping elements. The function is called with each element, index, and array, and dropping +* continues as long as it returns true. +* @returns A new array with the elements remaining after the predicate returns false. +* +* @example +* const array = [3, 2, 1]; +* const result = dropRightWhile(array, (item, index, arr) => index >= 1); +* // Returns: [3] +*/ +function dropRightWhile(array, predicate = identity) { + if (!isArrayLike(array)) return []; + return dropRightWhileImpl(toArray(array), 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)); + } +} +//#endregion +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..b41646edf87512d7e664b75a59f3816882b46a47 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.d.mts @@ -0,0 +1,29 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; + +//#region src/compat/array/dropWhile.d.ts +/** + * 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 array - The array to query + * @param [predicate=identity] - The function invoked per iteration + * @returns 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 }) + * // => [] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], ['a', 1]) + * // => [] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], 'a') + * // => [] + */ +declare function dropWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { dropWhile }; \ No newline at end of file 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..126fe836c5e78f8eb61f8a3c6fd2271bc36de5b2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.d.ts @@ -0,0 +1,29 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; + +//#region src/compat/array/dropWhile.d.ts +/** + * 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 array - The array to query + * @param [predicate=identity] - The function invoked per iteration + * @returns 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 }) + * // => [] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], ['a', 1]) + * // => [] + * + * dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], 'a') + * // => [] + */ +declare function dropWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { dropWhile }; \ No newline at end of file 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..02f96ac1cc0906c179dee1b427a859dc8b933f4f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.js @@ -0,0 +1,50 @@ +const require_dropWhile = require("../../array/dropWhile.js"); +const require_identity = require("../../function/identity.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_property = require("../object/property.js"); +const require_matches = require("../predicate/matches.js"); +const require_matchesProperty = require("../predicate/matchesProperty.js"); +//#region src/compat/array/dropWhile.ts +/** +* 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 array - The array to query +* @param [predicate=identity] - The function invoked per iteration +* @returns 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 }) +* // => [] +* +* dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], ['a', 1]) +* // => [] +* +* dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], 'a') +* // => [] +*/ +function dropWhile(array, predicate = require_identity.identity) { + if (!require_isArrayLike.isArrayLike(array)) return []; + return dropWhileImpl(require_toArray.toArray(array), predicate); +} +function dropWhileImpl(arr, predicate) { + switch (typeof predicate) { + case "function": return require_dropWhile.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 require_dropWhile.dropWhile(arr, require_matchesProperty.matchesProperty(key, value)); + } else return require_dropWhile.dropWhile(arr, require_matches.matches(predicate)); + case "number": + case "symbol": + case "string": return require_dropWhile.dropWhile(arr, require_property.property(predicate)); + } +} +//#endregion +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..b3caff2723cfb906e1e8859c94d7cd6b078eba19 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/dropWhile.mjs @@ -0,0 +1,50 @@ +import { dropWhile as dropWhile$1 } from "../../array/dropWhile.mjs"; +import { identity } from "../../function/identity.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { property } from "../object/property.mjs"; +import { matches } from "../predicate/matches.mjs"; +import { matchesProperty } from "../predicate/matchesProperty.mjs"; +//#region src/compat/array/dropWhile.ts +/** +* 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 array - The array to query +* @param [predicate=identity] - The function invoked per iteration +* @returns 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 }) +* // => [] +* +* dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], ['a', 1]) +* // => [] +* +* dropWhile([{ a: 1, b: 2 }, { a: 1, b: 3 }], 'a') +* // => [] +*/ +function dropWhile(array, predicate = identity) { + if (!isArrayLike(array)) return []; + return dropWhileImpl(toArray(array), 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)); + } +} +//#endregion +export { dropWhile }; diff --git a/node_modules/es-toolkit/dist/compat/array/each.d.mts b/node_modules/es-toolkit/dist/compat/array/each.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f1ba24cf7f4e431105f05aa11f7f755c8857bf68 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/each.d.mts @@ -0,0 +1 @@ +import { forEach } from "./forEach.mjs"; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/array/each.d.ts b/node_modules/es-toolkit/dist/compat/array/each.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..65b02279aa832076199d8aaf0716578d0e38a347 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/each.d.ts @@ -0,0 +1 @@ +import { forEach } from "./forEach.js"; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/array/each.js b/node_modules/es-toolkit/dist/compat/array/each.js new file mode 100644 index 0000000000000000000000000000000000000000..ba30e2aa75a8d5455a19038e15545df9b12e2c5a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/each.js @@ -0,0 +1 @@ +require("./forEach.js"); diff --git a/node_modules/es-toolkit/dist/compat/array/each.mjs b/node_modules/es-toolkit/dist/compat/array/each.mjs new file mode 100644 index 0000000000000000000000000000000000000000..092e3d6dc378cd4febccc47ae513fdad27537694 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/each.mjs @@ -0,0 +1 @@ +import "./forEach.mjs"; diff --git a/node_modules/es-toolkit/dist/compat/array/eachRight.d.mts b/node_modules/es-toolkit/dist/compat/array/eachRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0d29b8d6ed342bdeeb7968bd0c48fdd6e7f8506a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/eachRight.d.mts @@ -0,0 +1 @@ +import { forEachRight } from "./forEachRight.mjs"; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/array/eachRight.d.ts b/node_modules/es-toolkit/dist/compat/array/eachRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e279fadb1e55cfd44f0505a4fd31fb94312155de --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/eachRight.d.ts @@ -0,0 +1 @@ +import { forEachRight } from "./forEachRight.js"; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/array/eachRight.js b/node_modules/es-toolkit/dist/compat/array/eachRight.js new file mode 100644 index 0000000000000000000000000000000000000000..49cb59940c174bf45b5072dcffe8660fa06fbc96 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/eachRight.js @@ -0,0 +1 @@ +require("./forEachRight.js"); diff --git a/node_modules/es-toolkit/dist/compat/array/eachRight.mjs b/node_modules/es-toolkit/dist/compat/array/eachRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6854cd9a5dbb652b25414102e58fba9a8aa9ecc2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/eachRight.mjs @@ -0,0 +1 @@ +import "./forEachRight.mjs"; 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..baaf9826211bb2a4014f6da1a6902e348b63d15c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.d.mts @@ -0,0 +1,65 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/array/every.d.ts +/** + * 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 collection - The collection to iterate over + * @param [predicate=identity] - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @param [predicate=identity] - The function invoked per iteration + * @returns 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; +//#endregion +export { every }; \ No newline at end of file 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..62961a4e1f31355186339d909511ffeeb66a1b55 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.d.ts @@ -0,0 +1,65 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/array/every.d.ts +/** + * 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 collection - The collection to iterate over + * @param [predicate=identity] - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @param [predicate=identity] - The function invoked per iteration + * @returns 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; +//#endregion +export { every }; \ No newline at end of file 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..c0ae33d59e659f7291827074247b252e4a60846c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.js @@ -0,0 +1,39 @@ +const require_identity = require("../../function/identity.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +require("../compat.js"); +//#region src/compat/array/every.ts +/** +* Checks if every item in an object has a specific property, where the property name is provided as a PropertyKey. +* +* @template T +* @param source - The source array or object to check through. +* @param [doesMatch] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns `true` if every property value has the specified property, or `false` if at least one does not match. +* +* @example +* // Using a property name +* const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }; +* const result = every(obj, 'name'); +* console.log(result); // true +*/ +function every(source, doesMatch, guard) { + if (!source) return true; + if (guard && require_isIterateeCall.isIterateeCall(source, doesMatch, guard)) doesMatch = void 0; + const predicate = require_iteratee.iteratee(doesMatch ?? require_identity.identity); + if (!require_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; +} +//#endregion +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..4710621a143ee64f20975f9ace2272657fa75c67 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/every.mjs @@ -0,0 +1,39 @@ +import { identity } from "../../function/identity.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +import "../compat.mjs"; +//#region src/compat/array/every.ts +/** +* Checks if every item in an object has a specific property, where the property name is provided as a PropertyKey. +* +* @template T +* @param source - The source array or object to check through. +* @param [doesMatch] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns `true` if every property value has the specified property, or `false` if at least one does not match. +* +* @example +* // Using a property name +* const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }; +* const result = every(obj, 'name'); +* console.log(result); // true +*/ +function every(source, doesMatch, guard) { + if (!source) return true; + if (guard && isIterateeCall(source, doesMatch, guard)) doesMatch = void 0; + const predicate = iteratee(doesMatch ?? identity); + 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; +} +//#endregion +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..35b7c94c22c0d7f2522396e755c4376900b74a8f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.d.mts @@ -0,0 +1,54 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/fill.d.ts +/** + * Fills an array with a value. + * @template T + * @param array - The array to fill + * @param value - The value to fill array with + * @returns 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 array - The array-like object to fill + * @param value - The value to fill array with + * @returns 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 array - The array to fill + * @param value - The value to fill array with + * @param [start=0] - The start position + * @param [end=array.length] - The end position + * @returns 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 array - The array-like object to fill + * @param value - The value to fill array with + * @param [start=0] - The start position + * @param [end=array.length] - The end position + * @returns 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; +//#endregion +export { fill }; \ No newline at end of file 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..296da2eed92fb8c072a9e47c528e807bc83f8013 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.d.ts @@ -0,0 +1,54 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/fill.d.ts +/** + * Fills an array with a value. + * @template T + * @param array - The array to fill + * @param value - The value to fill array with + * @returns 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 array - The array-like object to fill + * @param value - The value to fill array with + * @returns 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 array - The array to fill + * @param value - The value to fill array with + * @param [start=0] - The start position + * @param [end=array.length] - The end position + * @returns 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 array - The array-like object to fill + * @param value - The value to fill array with + * @param [start=0] - The start position + * @param [end=array.length] - The end position + * @returns 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; +//#endregion +export { fill }; \ No newline at end of file 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..cdd521dfd6f72e071fdd2c0bfd3ff758b18674c6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.js @@ -0,0 +1,42 @@ +const require_fill = require("../../array/fill.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isString = require("../predicate/isString.js"); +//#region src/compat/array/fill.ts +/** +* 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, U +* @param array - The array to fill. +* @param value - The value to fill the array with. +* @param [start=0] - The start position. Defaults to 0. +* @param [end=arr.length] - The end position. Defaults to the array's length. +* @returns The array with the filled values. +* +* @example +* fill([1, 2, 3], 'a'); +* // => ['a', 'a', 'a'] +* +* fill(Array(3), 2); +* // => [2, 2, 2] +* +* fill([4, 6, 8, 10], '*', 1, 3); +* // => [4, '*', '*', 10] +* +* fill([1, 2, 3], '*', -2, -1); +* // => [1, '*', 3] +*/ +function fill(array, value, start = 0, end = array ? array.length : 0) { + if (!require_isArrayLike.isArrayLike(array)) return []; + if (require_isString.isString(array)) return array; + start = Math.floor(start); + end = Math.floor(end); + if (!start) start = 0; + if (!end) end = 0; + return require_fill.fill(array, value, start, end); +} +//#endregion +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..acbd56a95156534f64dc7a254752f36fa05a895c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/fill.mjs @@ -0,0 +1,42 @@ +import { fill as fill$1 } from "../../array/fill.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isString } from "../predicate/isString.mjs"; +//#region src/compat/array/fill.ts +/** +* 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, U +* @param array - The array to fill. +* @param value - The value to fill the array with. +* @param [start=0] - The start position. Defaults to 0. +* @param [end=arr.length] - The end position. Defaults to the array's length. +* @returns The array with the filled values. +* +* @example +* fill([1, 2, 3], 'a'); +* // => ['a', 'a', 'a'] +* +* fill(Array(3), 2); +* // => [2, 2, 2] +* +* fill([4, 6, 8, 10], '*', 1, 3); +* // => [4, '*', '*', 10] +* +* fill([1, 2, 3], '*', -2, -1); +* // => [1, '*', 3] +*/ +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); +} +//#endregion +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..80dd94339406864432bd96938818d994831df218 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.d.mts @@ -0,0 +1,79 @@ +import { ObjectIteratorTypeGuard } from "../_internal/ObjectIterator.mjs"; +import { StringIterator } from "../_internal/StringIterator.mjs"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; +import { ListIteratorTypeGuard } from "../_internal/ListIteratorTypeGuard.mjs"; + +//#region src/compat/array/filter.d.ts +/** + * 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. + * + * @template T, U + * @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. + * + * @template T + * @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. + * + * @template T, U + * @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. + * + * @template T + * @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; +//#endregion +export { filter }; \ No newline at end of file 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..3d532b771a47f3aee3c239a2515b4c9bed2f434a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.d.ts @@ -0,0 +1,79 @@ +import { ObjectIteratorTypeGuard } from "../_internal/ObjectIterator.js"; +import { StringIterator } from "../_internal/StringIterator.js"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; +import { ListIteratorTypeGuard } from "../_internal/ListIteratorTypeGuard.js"; + +//#region src/compat/array/filter.d.ts +/** + * 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. + * + * @template T, U + * @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. + * + * @template T + * @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. + * + * @template T, U + * @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. + * + * @template T + * @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; +//#endregion +export { filter }; \ No newline at end of file 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..413dd8c3d5449eec8c4f7ac9e4f8778965af2a99 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.js @@ -0,0 +1,50 @@ +const require_identity = require("../../function/identity.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/filter.ts +/** +* Iterates over the collection and filters elements based on the given predicate. +* If a function is provided, it is invoked for each element in the collection. +* +* @template T +* @param collection - The array or object to iterate over. +* @param [predicate=identity] - The function invoked per iteration. +* @returns Returns a new array of filtered elements that satisfy the predicate. +* +* @example +* filter([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [{ a: 1 }, { a: 2 }] +* +* filter([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [{ b: 1 }] +* +* filter({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [{ a: 2, b: false }] +* +* filter([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [{ a: 2 }] +*/ +function filter(collection, predicate = require_identity.identity) { + if (!collection) return []; + predicate = require_iteratee.iteratee(predicate); + if (!Array.isArray(collection)) { + const result = []; + const keys = Object.keys(collection); + const length = require_isArrayLike.isArrayLike(collection) ? collection.length : keys.length; + for (let i = 0; i < length; i++) { + const key = keys[i]; + const value = collection[key]; + if (predicate(value, key, collection)) result.push(value); + } + return result; + } + const result = []; + const length = collection.length; + for (let i = 0; i < length; i++) { + const value = collection[i]; + if (predicate(value, i, collection)) result.push(value); + } + return result; +} +//#endregion +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..e6acdf60e2e33ebbfe93b651bdefb8c2ee898b6b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/filter.mjs @@ -0,0 +1,50 @@ +import { identity } from "../../function/identity.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/filter.ts +/** +* Iterates over the collection and filters elements based on the given predicate. +* If a function is provided, it is invoked for each element in the collection. +* +* @template T +* @param collection - The array or object to iterate over. +* @param [predicate=identity] - The function invoked per iteration. +* @returns Returns a new array of filtered elements that satisfy the predicate. +* +* @example +* filter([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [{ a: 1 }, { a: 2 }] +* +* filter([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [{ b: 1 }] +* +* filter({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [{ a: 2, b: false }] +* +* filter([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [{ a: 2 }] +*/ +function filter(collection, predicate = identity) { + if (!collection) return []; + predicate = iteratee(predicate); + if (!Array.isArray(collection)) { + const result = []; + const keys = Object.keys(collection); + const length = isArrayLike(collection) ? collection.length : keys.length; + for (let i = 0; i < length; i++) { + const key = keys[i]; + const value = collection[key]; + if (predicate(value, key, collection)) result.push(value); + } + return result; + } + const result = []; + const length = collection.length; + for (let i = 0; i < length; i++) { + const value = collection[i]; + if (predicate(value, i, collection)) result.push(value); + } + return result; +} +//#endregion +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..f29742aa1d6752cc102f6966182605056670ee95 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.d.mts @@ -0,0 +1,70 @@ +import { ObjectIteratorTypeGuard } from "../_internal/ObjectIterator.mjs"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; +import { ListIteratorTypeGuard } from "../_internal/ListIteratorTypeGuard.mjs"; + +//#region src/compat/array/find.d.ts +/** + * Finds the first element in an array-like object that matches a type guard predicate. + * + * @template T, U + * @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. + * + * @template T + * @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. + * + * @template T, U + * @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. + * + * @template T + * @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; +//#endregion +export { find }; \ No newline at end of file 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..d2edde9d2f783ad60d23f3cceb3c2cb9d71eae7a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.d.ts @@ -0,0 +1,70 @@ +import { ObjectIteratorTypeGuard } from "../_internal/ObjectIterator.js"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; +import { ListIteratorTypeGuard } from "../_internal/ListIteratorTypeGuard.js"; + +//#region src/compat/array/find.d.ts +/** + * Finds the first element in an array-like object that matches a type guard predicate. + * + * @template T, U + * @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. + * + * @template T + * @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. + * + * @template T, U + * @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. + * + * @template T + * @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; +//#endregion +export { find }; \ No newline at end of file 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..e317c17091dfea54e47ef95c40534b4c1da4c390 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.js @@ -0,0 +1,35 @@ +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/find.ts +/** +* Finds the first item in an object that has a specific property, where the property name is provided as a PropertyKey. +* +* @template T +* @param source - The source array or object to search through. +* @param [doesMatch=identity] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name. +* @param [fromIndex=0] - The index to start the search from, defaults to 0. +* @returns The first property value that has the specified property, or `undefined` if no match is found. +* +* @example +* // Using a property name +* const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }; +* const result = find(obj, 'name'); +* console.log(result); // { id: 1, name: 'Alice' } +*/ +function find(source, _doesMatch = require_identity.identity, fromIndex = 0) { + if (!source) return; + if (fromIndex < 0) fromIndex = Math.max(source.length + fromIndex, 0); + const doesMatch = require_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; + } + return source.slice(fromIndex).find(doesMatch); +} +//#endregion +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..b42ba7f930b65c3b86ca384aa912756614233f90 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/find.mjs @@ -0,0 +1,35 @@ +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/find.ts +/** +* Finds the first item in an object that has a specific property, where the property name is provided as a PropertyKey. +* +* @template T +* @param source - The source array or object to search through. +* @param [doesMatch=identity] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name. +* @param [fromIndex=0] - The index to start the search from, defaults to 0. +* @returns The first property value that has the specified property, or `undefined` if no match is found. +* +* @example +* // Using a property name +* const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }; +* const result = find(obj, 'name'); +* console.log(result); // { id: 1, name: 'Alice' } +*/ +function find(source, _doesMatch = identity, fromIndex = 0) { + if (!source) return; + 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; + } + return source.slice(fromIndex).find(doesMatch); +} +//#endregion +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..77ac3fb047fabebaabbe7aa0b76599c234ddc44d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.d.mts @@ -0,0 +1,21 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; + +//#region src/compat/array/findIndex.d.ts +/** + * 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 arr - The array to search through. + * @param 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 [fromIndex=0] - The index to start the search from, defaults to 0. + * @returns 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; +//#endregion +export { findIndex }; \ No newline at end of file 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..a9784d0da213c0276166afa85fb5237d7da55aed --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.d.ts @@ -0,0 +1,21 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; + +//#region src/compat/array/findIndex.d.ts +/** + * 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 arr - The array to search through. + * @param 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 [fromIndex=0] - The index to start the search from, defaults to 0. + * @returns 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; +//#endregion +export { findIndex }; \ No newline at end of file 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..9f29c609d2c39da5013204543c23d15dd68cf378 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.js @@ -0,0 +1,46 @@ +const require_property = require("../object/property.js"); +const require_matches = require("../predicate/matches.js"); +const require_matchesProperty = require("../predicate/matchesProperty.js"); +const require_toInteger = require("../util/toInteger.js"); +const require_identity = require("../function/identity.js"); +//#region src/compat/array/findIndex.ts +/** +* 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 arr - The array to search through. +* @param 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 [fromIndex=0] - The index to start the search from, defaults to 0. +* @returns 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 +*/ +function findIndex(arr, doesMatch = require_identity.identity, fromIndex = 0) { + if (!arr) return -1; + fromIndex = require_toInteger.toInteger(fromIndex); + 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(require_matchesProperty.matchesProperty(key, value)); + } else index = subArray.findIndex(require_matches.matches(doesMatch)); + break; + case "number": + case "symbol": + case "string": index = subArray.findIndex(require_property.property(doesMatch)); + } + return index === -1 ? -1 : index + fromIndex; +} +//#endregion +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..ca3122107892f7872069812cfb60f41301b5ef32 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findIndex.mjs @@ -0,0 +1,46 @@ +import { property } from "../object/property.mjs"; +import { matches } from "../predicate/matches.mjs"; +import { matchesProperty } from "../predicate/matchesProperty.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +import { identity } from "../function/identity.mjs"; +//#region src/compat/array/findIndex.ts +/** +* 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 arr - The array to search through. +* @param 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 [fromIndex=0] - The index to start the search from, defaults to 0. +* @returns 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 +*/ +function findIndex(arr, doesMatch = identity, fromIndex = 0) { + if (!arr) return -1; + fromIndex = toInteger(fromIndex); + 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; +} +//#endregion +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..8f72af062b61effaa7ddfb1f3ecc53b30ef2fb83 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.d.mts @@ -0,0 +1,83 @@ +import { ObjectIteratorTypeGuard } from "../_internal/ObjectIterator.mjs"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; +import { ListIteratorTypeGuard } from "../_internal/ListIteratorTypeGuard.mjs"; + +//#region src/compat/array/findLast.d.ts +/** + * Finds the last element in a collection that satisfies the predicate. + * + * @template T, S + * @param collection - The collection to search. + * @param predicate - The predicate function with type guard. + * @param [fromIndex] - The index to start searching from. + * @returns 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 collection - The collection to search. + * @param [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param [fromIndex] - The index to start searching from. + * @returns 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: 'pebbles', age: 18 } + */ +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 collection - The object to search. + * @param predicate - The predicate function with type guard. + * @param [fromIndex] - The index to start searching from. + * @returns 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 collection - The object to search. + * @param [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param [fromIndex] - The index to start searching from. + * @returns 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; +//#endregion +export { findLast }; \ No newline at end of file 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..c2c5246d62b8e4717b48c55f6705504c97059e38 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.d.ts @@ -0,0 +1,83 @@ +import { ObjectIteratorTypeGuard } from "../_internal/ObjectIterator.js"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; +import { ListIteratorTypeGuard } from "../_internal/ListIteratorTypeGuard.js"; + +//#region src/compat/array/findLast.d.ts +/** + * Finds the last element in a collection that satisfies the predicate. + * + * @template T, S + * @param collection - The collection to search. + * @param predicate - The predicate function with type guard. + * @param [fromIndex] - The index to start searching from. + * @returns 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 collection - The collection to search. + * @param [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param [fromIndex] - The index to start searching from. + * @returns 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: 'pebbles', age: 18 } + */ +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 collection - The object to search. + * @param predicate - The predicate function with type guard. + * @param [fromIndex] - The index to start searching from. + * @returns 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 collection - The object to search. + * @param [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param [fromIndex] - The index to start searching from. + * @returns 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; +//#endregion +export { findLast }; \ No newline at end of file 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..1b9ee8edd1e2d70264fedd776efc8ded678cfd49 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.js @@ -0,0 +1,39 @@ +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/array/findLast.ts +/** +* Finds the last item in an object that has a specific property, where the property name is provided as a PropertyKey. +* +* @template T +* @param collection - The array or object to search through. +* @param [predicate=identity] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name. +* @param [fromIndex] - The index to start the search from, defaults to collection.length-1 for arrays or Object.keys(collection).length-1 for objects. +* @returns The last property value that has the specified property, or `undefined` if no match is found. +* +* @example +* // Using a property name +* const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2 }, c: { id: 3, name: 'Bob' } }; +* const result = findLast(obj, 'name'); +* console.log(result); // { id: 3, name: 'Bob' } +*/ +function findLast(collection, predicate = require_identity.identity, fromIndex) { + if (!collection) return; + const length = Array.isArray(collection) ? collection.length : Object.keys(collection).length; + fromIndex = require_toInteger.toInteger(fromIndex ?? length - 1); + if (fromIndex < 0) fromIndex = Math.max(length + fromIndex, 0); + else fromIndex = Math.min(fromIndex, length - 1); + const doesMatch = require_iteratee.iteratee(predicate); + if (!Array.isArray(collection)) { + const keys = Object.keys(collection); + for (let i = fromIndex; i >= 0; i--) { + const key = keys[i]; + const value = collection[key]; + if (doesMatch(value, key, collection)) return value; + } + return; + } + return collection.slice(0, fromIndex + 1).findLast(doesMatch); +} +//#endregion +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..57a81c1a6d45bd4a892c28096dc9421de163e231 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLast.mjs @@ -0,0 +1,39 @@ +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +//#region src/compat/array/findLast.ts +/** +* Finds the last item in an object that has a specific property, where the property name is provided as a PropertyKey. +* +* @template T +* @param collection - The array or object to search through. +* @param [predicate=identity] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name. +* @param [fromIndex] - The index to start the search from, defaults to collection.length-1 for arrays or Object.keys(collection).length-1 for objects. +* @returns The last property value that has the specified property, or `undefined` if no match is found. +* +* @example +* // Using a property name +* const obj = { a: { id: 1, name: 'Alice' }, b: { id: 2 }, c: { id: 3, name: 'Bob' } }; +* const result = findLast(obj, 'name'); +* console.log(result); // { id: 3, name: 'Bob' } +*/ +function findLast(collection, predicate = identity, fromIndex) { + if (!collection) return; + const length = Array.isArray(collection) ? collection.length : Object.keys(collection).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(predicate); + if (!Array.isArray(collection)) { + const keys = Object.keys(collection); + for (let i = fromIndex; i >= 0; i--) { + const key = keys[i]; + const value = collection[key]; + if (doesMatch(value, key, collection)) return value; + } + return; + } + return collection.slice(0, fromIndex + 1).findLast(doesMatch); +} +//#endregion +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..2dcad1d00901fef1d663c628f2384663bfe01e9b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.mts @@ -0,0 +1,34 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; + +//#region src/compat/array/findLastIndex.d.ts +/** + * Finds the index of the last element in the array that satisfies the predicate. + * + * @template T + * @param array - The array to search through. + * @param [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param [fromIndex] - The index to start searching from. + * @returns 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; +//#endregion +export { findLastIndex }; \ No newline at end of file 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..81bed5bc13b42a2caa04b84df4d149ccd813f502 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLastIndex.d.ts @@ -0,0 +1,34 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; + +//#region src/compat/array/findLastIndex.d.ts +/** + * Finds the index of the last element in the array that satisfies the predicate. + * + * @template T + * @param array - The array to search through. + * @param [predicate] - The predicate function, partial object, property-value pair, or property name. + * @param [fromIndex] - The index to start searching from. + * @returns 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; +//#endregion +export { findLastIndex }; \ No newline at end of file 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..6e243e1379e58f0de7f0d8ebf76a805a4470ddf3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/findLastIndex.js @@ -0,0 +1,40 @@ +const require_identity = require("../../function/identity.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_property = require("../object/property.js"); +const require_matches = require("../predicate/matches.js"); +const require_matchesProperty = require("../predicate/matchesProperty.js"); +//#region src/compat/array/findLastIndex.ts +/** +* Finds the index of the last element in the array that satisfies the predicate. +* +* @template T +* @param arr - The array to search through. +* @param doesMatch - The predicate function, partial object, property-value pair, or property name. +* @param [fromIndex=arr.length - 1] - The index to start the search from, defaults to the last index of the array. +* @returns The index of the last matching element, or -1 if not found. +* +* @example +* const items = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]; +* findLastIndex(items, 'name'); +* // => 1 +*/ +function findLastIndex(arr, doesMatch = require_identity.identity, fromIndex = arr ? arr.length - 1 : 0) { + if (!arr) return -1; + if (Number.isNaN(fromIndex)) fromIndex = 0; + if (fromIndex < 0) fromIndex = Math.max(arr.length + fromIndex, 0); + else fromIndex = Math.min(fromIndex, arr.length - 1); + const subArray = require_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(require_matchesProperty.matchesProperty(key, value)); + } else return subArray.findLastIndex(require_matches.matches(doesMatch)); + case "number": + case "symbol": + case "string": return subArray.findLastIndex(require_property.property(doesMatch)); + } +} +//#endregion +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..67ca81a6b34369ac9fe62b97544ada990a8a5953 --- /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"; +//#region src/compat/array/findLastIndex.ts +/** +* Finds the index of the last element in the array that satisfies the predicate. +* +* @template T +* @param arr - The array to search through. +* @param doesMatch - The predicate function, partial object, property-value pair, or property name. +* @param [fromIndex=arr.length - 1] - The index to start the search from, defaults to the last index of the array. +* @returns The index of the last matching element, or -1 if not found. +* +* @example +* const items = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]; +* findLastIndex(items, 'name'); +* // => 1 +*/ +function findLastIndex(arr, doesMatch = identity, fromIndex = arr ? arr.length - 1 : 0) { + if (!arr) return -1; + if (Number.isNaN(fromIndex)) fromIndex = 0; + 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)); + } +} +//#endregion +export { findLastIndex }; diff --git a/node_modules/es-toolkit/dist/compat/array/first.d.mts b/node_modules/es-toolkit/dist/compat/array/first.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..296a68fe229488bb52cd6cf3681ceac84d66fbfb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/first.d.mts @@ -0,0 +1 @@ +import { head } from "./head.mjs"; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/array/first.d.ts b/node_modules/es-toolkit/dist/compat/array/first.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d00dedd2263318bb311327fd48f43d129458d860 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/first.d.ts @@ -0,0 +1 @@ +import { head } from "./head.js"; \ No newline at end of file diff --git a/node_modules/es-toolkit/dist/compat/array/first.js b/node_modules/es-toolkit/dist/compat/array/first.js new file mode 100644 index 0000000000000000000000000000000000000000..1d480d84873840936af9b2c9d1c58c2f187153d2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/first.js @@ -0,0 +1 @@ +require("./head.js"); diff --git a/node_modules/es-toolkit/dist/compat/array/first.mjs b/node_modules/es-toolkit/dist/compat/array/first.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1d5c01873db1ed8005d38ac50b97c0d8cb5b70c9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/first.mjs @@ -0,0 +1 @@ +import "./head.mjs"; 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..63cdc2a1824804beedecd50d8377e00924ff53a8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.d.mts @@ -0,0 +1,94 @@ +import { ListIterator } from "../_internal/ListIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/array/flatMap.d.ts +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T + * @param collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The property name to use as iteratee. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The object properties to match. + * @returns 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[]; +//#endregion +export { flatMap }; \ No newline at end of file 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..ffeb41008f20a13d3765e5730d87df280d62f1f6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.d.ts @@ -0,0 +1,94 @@ +import { ListIterator } from "../_internal/ListIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { Many } from "../_internal/Many.js"; + +//#region src/compat/array/flatMap.d.ts +/** + * Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. + * + * @template T + * @param collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The property name to use as iteratee. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The object properties to match. + * @returns 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[]; +//#endregion +export { flatMap }; \ No newline at end of file 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..1aed01c5a625070f653042fd09d534002aa5e52a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.js @@ -0,0 +1,24 @@ +const require_identity = require("../../function/identity.js"); +const require_isNil = require("../../predicate/isNil.js"); +const require_flattenDepth = require("./flattenDepth.js"); +const require_map = require("./map.js"); +//#region src/compat/array/flatMap.ts +/** +* Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. +* +* @template R +* @param collection - The collection to iterate over. +* @param [iteratee=identity] - The function invoked per iteration. +* @returns Returns the new flattened array. +* +* @example +* flatMap([1, 2], n => [n, n * 2]); +* // => [1, 2, 2, 4] +*/ +function flatMap(collection, iteratee = require_identity.identity) { + if (require_isNil.isNil(collection)) return []; + const mapped = require_isNil.isNil(iteratee) ? require_map.map(collection) : require_map.map(collection, iteratee); + return require_flattenDepth.flattenDepth(mapped, 1); +} +//#endregion +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..5612888a3dcd876b58ef1fa5b2d8d5a4a0f75b24 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMap.mjs @@ -0,0 +1,23 @@ +import { identity } from "../../function/identity.mjs"; +import { isNil } from "../../predicate/isNil.mjs"; +import { flattenDepth } from "./flattenDepth.mjs"; +import { map } from "./map.mjs"; +//#region src/compat/array/flatMap.ts +/** +* Creates a flattened array of values by running each element in collection through iteratee and flattening the mapped results. +* +* @template R +* @param collection - The collection to iterate over. +* @param [iteratee=identity] - The function invoked per iteration. +* @returns Returns the new flattened array. +* +* @example +* flatMap([1, 2], n => [n, n * 2]); +* // => [1, 2, 2, 4] +*/ +function flatMap(collection, iteratee = identity) { + if (isNil(collection)) return []; + return flattenDepth(isNil(iteratee) ? map(collection) : map(collection, iteratee), 1); +} +//#endregion +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..21185a95c46c81b4ce7d1622de130040b7772493 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.mts @@ -0,0 +1,83 @@ +import { ListIterator } from "../_internal/ListIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.mjs"; + +//#region src/compat/array/flatMapDeep.d.ts +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T + * @param collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The property name to use as iteratee. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The object properties to match. + * @returns 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[]; +//#endregion +export { flatMapDeep }; \ No newline at end of file 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..4a27d9a20a388257d89022b31a41fb8383f03854 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.d.ts @@ -0,0 +1,83 @@ +import { ListIterator } from "../_internal/ListIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.js"; + +//#region src/compat/array/flatMapDeep.d.ts +/** + * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. + * + * @template T + * @param collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param iteratee - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The property name to use as iteratee. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The object properties to match. + * @returns 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[]; +//#endregion +export { flatMapDeep }; \ No newline at end of file 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..4ed708fb480475c6cb63adb4a077fbdf90823fd0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.js @@ -0,0 +1,19 @@ +const require_flatMapDepth = require("./flatMapDepth.js"); +//#region src/compat/array/flatMapDeep.ts +/** +* Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. +* +* @template T, R +* @param collection - The array or object to iterate over. +* @param [iteratee] - The function that produces the new array elements. +* @returns A new array that has been deeply flattened. +* +* @example +* flatMapDeep([1, 2, 3], n => [[n, n]]); +* // => [1, 1, 2, 2, 3, 3] +*/ +function flatMapDeep(collection, iteratee) { + return require_flatMapDepth.flatMapDepth(collection, iteratee, Infinity); +} +//#endregion +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..8426ae0755a63e93b89f01cc6bdd6aa8cdf3e55c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDeep.mjs @@ -0,0 +1,19 @@ +import { flatMapDepth } from "./flatMapDepth.mjs"; +//#region src/compat/array/flatMapDeep.ts +/** +* Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. +* +* @template T, R +* @param collection - The array or object to iterate over. +* @param [iteratee] - The function that produces the new array elements. +* @returns A new array that has been deeply flattened. +* +* @example +* flatMapDeep([1, 2, 3], n => [[n, n]]); +* // => [1, 1, 2, 2, 3, 3] +*/ +function flatMapDeep(collection, iteratee) { + return flatMapDepth(collection, iteratee, Infinity); +} +//#endregion +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..398fdb3d6d83250fb7e9a3a5f0a6bdceb5c795a5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.mts @@ -0,0 +1,87 @@ +import { ListIterator } from "../_internal/ListIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.mjs"; + +//#region src/compat/array/flatMapDepth.d.ts +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T + * @param collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The function invoked per iteration. + * @param [depth=1] - The maximum recursion depth. + * @returns 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 collection - The object to iterate over. + * @param iteratee - The function invoked per iteration. + * @param [depth=1] - The maximum recursion depth. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The property name to use as iteratee. + * @param [depth=1] - The maximum recursion depth. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The object properties to match. + * @param [depth=1] - The maximum recursion depth. + * @returns 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[]; +//#endregion +export { flatMapDepth }; \ No newline at end of file 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..8d5d4f231a15b8c26c07c0f1ad847c92f08de78a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.d.ts @@ -0,0 +1,87 @@ +import { ListIterator } from "../_internal/ListIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.js"; + +//#region src/compat/array/flatMapDepth.d.ts +/** + * Creates a flattened array of values by running each element through iteratee and flattening the mapped results up to depth times. + * + * @template T + * @param collection - The collection to iterate over. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The function invoked per iteration. + * @param [depth=1] - The maximum recursion depth. + * @returns 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 collection - The object to iterate over. + * @param iteratee - The function invoked per iteration. + * @param [depth=1] - The maximum recursion depth. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The property name to use as iteratee. + * @param [depth=1] - The maximum recursion depth. + * @returns 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 collection - The collection to iterate over. + * @param iteratee - The object properties to match. + * @param [depth=1] - The maximum recursion depth. + * @returns 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[]; +//#endregion +export { flatMapDepth }; \ No newline at end of file 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..f85f43ae701a7acaa5e2a4ce72c67e6a23e7c41d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.js @@ -0,0 +1,26 @@ +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_flattenDepth = require("./flattenDepth.js"); +const require_map = require("./map.js"); +//#region src/compat/array/flatMapDepth.ts +/** +* 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 collection - The array or object to iterate over. +* @param [iteratee] - The function that produces the new array elements. +* @param [depth=1] - The maximum recursion depth. +* @returns A new array that has been flattened up to the specified depth. +* +* @example +* flatMapDepth([1, 2, 3], n => [[n, n]], 2); +* // => [1, 1, 2, 2, 3, 3] +*/ +function flatMapDepth(collection, iteratee$1 = require_identity.identity, depth = 1) { + if (collection == null) return []; + const iterateeFn = require_iteratee.iteratee(iteratee$1); + const mapped = require_map.map(collection, iterateeFn); + return require_flattenDepth.flattenDepth(mapped, depth); +} +//#endregion +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..f6c5ac315eae15fc6f33b475674832e19dbd931d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatMapDepth.mjs @@ -0,0 +1,24 @@ +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { flattenDepth } from "./flattenDepth.mjs"; +import { map } from "./map.mjs"; +//#region src/compat/array/flatMapDepth.ts +/** +* 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 collection - The array or object to iterate over. +* @param [iteratee] - The function that produces the new array elements. +* @param [depth=1] - The maximum recursion depth. +* @returns A new array that has been flattened up to the specified depth. +* +* @example +* flatMapDepth([1, 2, 3], n => [[n, n]], 2); +* // => [1, 1, 2, 2, 3, 3] +*/ +function flatMapDepth(collection, iteratee$1 = identity, depth = 1) { + if (collection == null) return []; + return flattenDepth(map(collection, iteratee(iteratee$1)), depth); +} +//#endregion +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..e118624b0b9394869f6b9e21021a08516f527260 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/array/flatten.d.ts +/** + * Flattens array up to depth times. + * + * @template T + * @param array - The array to flatten. + * @returns Returns the new flattened array. + * + * @example + * flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ +declare function flatten(array: ArrayLike | null | undefined): T[]; +//#endregion +export { flatten }; \ No newline at end of file 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..e118624b0b9394869f6b9e21021a08516f527260 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/array/flatten.d.ts +/** + * Flattens array up to depth times. + * + * @template T + * @param array - The array to flatten. + * @returns Returns the new flattened array. + * + * @example + * flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ +declare function flatten(array: ArrayLike | null | undefined): T[]; +//#endregion +export { flatten }; \ No newline at end of file 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..86d48c78391f21897454cb01efb179074ae3d229 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.js @@ -0,0 +1,18 @@ +const require_flattenDepth = require("./flattenDepth.js"); +//#region src/compat/array/flatten.ts +/** +* Flattens array up to depth times. +* +* @template T +* @param array - The array to flatten. +* @returns Returns the new flattened array. +* +* @example +* flatten([1, [2, [3, [4]], 5]]); +* // => [1, 2, [3, [4]], 5] +*/ +function flatten(array) { + return require_flattenDepth.flattenDepth(array, 1); +} +//#endregion +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..1c7af8706ef62bb763f873203d12af906a4d3f02 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flatten.mjs @@ -0,0 +1,18 @@ +import { flattenDepth } from "./flattenDepth.mjs"; +//#region src/compat/array/flatten.ts +/** +* Flattens array up to depth times. +* +* @template T +* @param array - The array to flatten. +* @returns Returns the new flattened array. +* +* @example +* flatten([1, [2, [3, [4]], 5]]); +* // => [1, 2, [3, [4]], 5] +*/ +function flatten(array) { + return flattenDepth(array, 1); +} +//#endregion +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..4cded6efbbf7135cd3d620be6e91fcbb13f03704 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.mts @@ -0,0 +1,17 @@ +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.mjs"; + +//#region src/compat/array/flattenDeep.d.ts +/** + * Recursively flattens array. + * + * @template T + * @param array - The array to flatten. + * @returns Returns the new flattened array. + * + * @example + * flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ +declare function flattenDeep(array: ListOfRecursiveArraysOrValues | null | undefined): Array ? never : T>; +//#endregion +export { flattenDeep }; \ No newline at end of file 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..50e8fa4705cca7eb8de8aedb3e9dd8a49e19a1d6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.d.ts @@ -0,0 +1,17 @@ +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.js"; + +//#region src/compat/array/flattenDeep.d.ts +/** + * Recursively flattens array. + * + * @template T + * @param array - The array to flatten. + * @returns Returns the new flattened array. + * + * @example + * flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ +declare function flattenDeep(array: ListOfRecursiveArraysOrValues | null | undefined): Array ? never : T>; +//#endregion +export { flattenDeep }; \ No newline at end of file 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..6bc46ca47b833da02217cf4a0e8f927e2d91bc22 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.js @@ -0,0 +1,18 @@ +const require_flattenDepth = require("./flattenDepth.js"); +//#region src/compat/array/flattenDeep.ts +/** +* Recursively flattens array. +* +* @template T +* @param array - The array to flatten. +* @returns Returns the new flattened array. +* +* @example +* flattenDeep([1, [2, [3, [4]], 5]]); +* // => [1, 2, 3, 4, 5] +*/ +function flattenDeep(array) { + return require_flattenDepth.flattenDepth(array, Infinity); +} +//#endregion +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..097c112caf27b857a9a3a8fe12d5dc0488e81142 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDeep.mjs @@ -0,0 +1,18 @@ +import { flattenDepth } from "./flattenDepth.mjs"; +//#region src/compat/array/flattenDeep.ts +/** +* Recursively flattens array. +* +* @template T +* @param array - The array to flatten. +* @returns Returns the new flattened array. +* +* @example +* flattenDeep([1, [2, [3, [4]], 5]]); +* // => [1, 2, 3, 4, 5] +*/ +function flattenDeep(array) { + return flattenDepth(array, Infinity); +} +//#endregion +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..a4c33fd07f5d5efdbd810ca9feb28a4729557411 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.mts @@ -0,0 +1,23 @@ +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.mjs"; + +//#region src/compat/array/flattenDepth.d.ts +/** + * Recursively flattens array up to depth times. + * + * @template T + * @param array - The array to flatten. + * @param [depth=1] - The maximum recursion depth. + * @returns 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[]; +//#endregion +export { flattenDepth }; \ No newline at end of file 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..d37422b3e7a1988079f839cc5e750f599d70eb9c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.ts @@ -0,0 +1,23 @@ +import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.js"; + +//#region src/compat/array/flattenDepth.d.ts +/** + * Recursively flattens array up to depth times. + * + * @template T + * @param array - The array to flatten. + * @param [depth=1] - The maximum recursion depth. + * @returns 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[]; +//#endregion +export { flattenDepth }; \ No newline at end of file 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..a187a2da984a4176ca6bd216b84ad123436c34fa --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.js @@ -0,0 +1,40 @@ +const require_isArray = require("../predicate/isArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isArguments = require("../predicate/isArguments.js"); +//#region src/compat/array/flattenDepth.ts +/** +* Recursively flattens array up to depth times. +* +* @template T +* @param array - The array to flatten. +* @param [depth=1] - The maximum recursion depth. +* @returns 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] +*/ +function flattenDepth(array, depth = 1) { + if (!require_isArrayLike.isArrayLike(array)) return []; + const result = []; + const flooredDepth = Math.floor(depth); + const recursive = (arr, currentDepth) => { + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (isFlattenable(item) && currentDepth < flooredDepth) recursive(item, currentDepth + 1); + else result.push(item); + } + }; + recursive(Array.from(array), 0); + return result; +} +function isFlattenable(value) { + return require_isArray.isArray(value) || require_isArguments.isArguments(value) || Boolean(value && value[Symbol.isConcatSpreadable]); +} +//#endregion +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..49e77b3e57d49dc95a3794acddafc308439275b1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/flattenDepth.mjs @@ -0,0 +1,40 @@ +import { isArray } from "../predicate/isArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isArguments } from "../predicate/isArguments.mjs"; +//#region src/compat/array/flattenDepth.ts +/** +* Recursively flattens array up to depth times. +* +* @template T +* @param array - The array to flatten. +* @param [depth=1] - The maximum recursion depth. +* @returns 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] +*/ +function flattenDepth(array, depth = 1) { + if (!isArrayLike(array)) return []; + const result = []; + const flooredDepth = Math.floor(depth); + const recursive = (arr, currentDepth) => { + for (let i = 0; i < arr.length; i++) { + const item = arr[i]; + if (isFlattenable(item) && currentDepth < flooredDepth) recursive(item, currentDepth + 1); + else result.push(item); + } + }; + recursive(Array.from(array), 0); + return result; +} +function isFlattenable(value) { + return isArray(value) || isArguments(value) || Boolean(value && value[Symbol.isConcatSpreadable]); +} +//#endregion +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..2af30e69f05ee24339dcad59f15f68578e45cbb6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.d.mts @@ -0,0 +1,111 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.mjs"; +import { ListIterator } from "../_internal/ListIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { StringIterator } from "../_internal/StringIterator.mjs"; + +//#region src/compat/array/forEach.d.ts +/** + * Iterates over elements of array and invokes iteratee for each element. + * + * @template T + * @param collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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; +//#endregion +export { forEach }; \ No newline at end of file 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..982de3d321d263cc1dd94663bcb4d87fb3cc69f5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.d.ts @@ -0,0 +1,111 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.js"; +import { ListIterator } from "../_internal/ListIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { StringIterator } from "../_internal/StringIterator.js"; + +//#region src/compat/array/forEach.d.ts +/** + * Iterates over elements of array and invokes iteratee for each element. + * + * @template T + * @param collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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; +//#endregion +export { forEach }; \ No newline at end of file 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..cabf2ce173c536c187460bd2c4097f24108df898 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.js @@ -0,0 +1,34 @@ +const require_identity = require("../../function/identity.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/forEach.ts +/** +* Iterates over each element of the object invoking the provided callback function for each property. +* +* @template T - The type of object. +* @param object - The object to iterate over. +* @param [callback] - The function invoked for each property. +* The callback function receives three arguments: +* - 'value': The current property being processed in the object. +* - 'key': The key of the current property being processed in the object. +* - 'object': The object 'forEach' was called upon. +* @returns Returns the original object. +* +* @example +* forEach({'a': 1, 'b': 2 }, (value, key, object) => console.log(value, key)); +* // Output: +* // 1 'a' +* // 2 'b' +*/ +function forEach(collection, callback = require_identity.identity) { + if (!collection) return collection; + const keys = require_isArrayLike.isArrayLike(collection) || Array.isArray(collection) ? require_range.range(0, collection.length) : Object.keys(collection); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + if (callback(value, key, collection) === false) break; + } + return collection; +} +//#endregion +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..6004786ee37ae71ec2483c0b94b37b549bb925fe --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEach.mjs @@ -0,0 +1,34 @@ +import { identity } from "../../function/identity.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/forEach.ts +/** +* Iterates over each element of the object invoking the provided callback function for each property. +* +* @template T - The type of object. +* @param object - The object to iterate over. +* @param [callback] - The function invoked for each property. +* The callback function receives three arguments: +* - 'value': The current property being processed in the object. +* - 'key': The key of the current property being processed in the object. +* - 'object': The object 'forEach' was called upon. +* @returns Returns the original object. +* +* @example +* forEach({'a': 1, 'b': 2 }, (value, key, object) => console.log(value, key)); +* // Output: +* // 1 'a' +* // 2 'b' +*/ +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]; + if (callback(value, key, collection) === false) break; + } + return collection; +} +//#endregion +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..8a0bcf5933e492116e76d8edbba478f04049ca2e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.d.mts @@ -0,0 +1,111 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.mjs"; +import { ListIterator } from "../_internal/ListIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { StringIterator } from "../_internal/StringIterator.mjs"; + +//#region src/compat/array/forEachRight.d.ts +/** + * Iterates over elements of array from right to left and invokes iteratee for each element. + * + * @template T + * @param collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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; +//#endregion +export { forEachRight }; \ No newline at end of file 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..fb4ed7b7e9bc93675db1e82d6334b1476e6c1f14 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.d.ts @@ -0,0 +1,111 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.js"; +import { ListIterator } from "../_internal/ListIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { StringIterator } from "../_internal/StringIterator.js"; + +//#region src/compat/array/forEachRight.d.ts +/** + * Iterates over elements of array from right to left and invokes iteratee for each element. + * + * @template T + * @param collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The array to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The string to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The function invoked per iteration. + * @returns 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; +//#endregion +export { forEachRight }; \ No newline at end of file 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..245cc9b10c35bf1ad3c0c947a8dcab3a46a045cc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.js @@ -0,0 +1,34 @@ +const require_identity = require("../../function/identity.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/forEachRight.ts +/** +* Iterates over elements of 'array' from right to left and invokes 'callback' for each element. +* +* @template T - The type of object. +* @param object - The object to iterate over. +* @param [callback] - The function invoked for each property. +* The callback function receives three arguments: +* - 'value': The current property being processed in the object. +* - 'key': The key of the current property being processed in the object. +* - 'object': The object 'forEachRight' was called upon. +* @returns Returns the original object. +* +* @example +* forEachRight({'a': 1, 'b': 2 }, (value, key, object) => console.log(value, key)); +* // Output: +* // 2 'b' +* // 1 'a' +*/ +function forEachRight(collection, callback = require_identity.identity) { + if (!collection) return collection; + const keys = require_isArrayLike.isArrayLike(collection) ? require_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]; + if (callback(value, key, collection) === false) break; + } + return collection; +} +//#endregion +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..9a124a139aa3a593fe469c47824c1b0bd945b953 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/forEachRight.mjs @@ -0,0 +1,34 @@ +import { identity } from "../../function/identity.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/forEachRight.ts +/** +* Iterates over elements of 'array' from right to left and invokes 'callback' for each element. +* +* @template T - The type of object. +* @param object - The object to iterate over. +* @param [callback] - The function invoked for each property. +* The callback function receives three arguments: +* - 'value': The current property being processed in the object. +* - 'key': The key of the current property being processed in the object. +* - 'object': The object 'forEachRight' was called upon. +* @returns Returns the original object. +* +* @example +* forEachRight({'a': 1, 'b': 2 }, (value, key, object) => console.log(value, key)); +* // Output: +* // 2 'b' +* // 1 'a' +*/ +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]; + if (callback(value, key, collection) === false) break; + } + return collection; +} +//#endregion +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..c68e3b975d6940fbe0bcd5c3047587e87b92f519 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.d.mts @@ -0,0 +1,36 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/groupBy.d.ts +/** + * 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 collection - The collection to iterate over + * @param [iteratee=identity] - The iteratee to transform keys + * @returns 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 collection - The object to iterate over + * @param [iteratee=identity] - The iteratee to transform keys + * @returns 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>; +//#endregion +export { groupBy }; \ No newline at end of file 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..06b81c362fe7abaecfffcda9718a531f324234f0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.d.ts @@ -0,0 +1,36 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/groupBy.d.ts +/** + * 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 collection - The collection to iterate over + * @param [iteratee=identity] - The iteratee to transform keys + * @returns 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 collection - The object to iterate over + * @param [iteratee=identity] - The iteratee to transform keys + * @returns 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>; +//#endregion +export { groupBy }; \ No newline at end of file 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..411c891071374eb0d5362de308736bed1a7981ec --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.js @@ -0,0 +1,44 @@ +const require_groupBy = require("../../array/groupBy.js"); +const require_identity = require("../../function/identity.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/groupBy.ts +/** +* Groups the elements of an array or object based on a provided key-generating function. +* +* This function takes an array or object and a function that generates a key from each element or value. +* 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 or values in the object. +* @template K - The type of keys. +* @param source - The collection to group. +* @param [_getKeyFromItem=identity] - The iteratee to transform keys. +* - If a function is provided, it's invoked for each element in the collection. +* - If a property name (string) is provided, that property of each element is used as the key. +* - If a property-value pair (array) is provided, elements with matching property values are used. +* - If a partial object is provided, elements with matching properties are used. +* @returns An object where each key is associated with an array of elements that +* share that key. +* +* @example +* // Using an array +* const array = [6.1, 4.2, 6.3]; +* const result = groupBy(array, Math.floor); +* // => { 4: [4.2], 6: [6.1, 6.3] } +* +* @example +* // Using a property name +* const array = ['one', 'two', 'three']; +* const result = groupBy(array, 'length'); +* // => { 3: ['one', 'two'], 5: ['three'] } +*/ +function groupBy(source, _getKeyFromItem = require_identity.identity) { + if (source == null) return {}; + const items = require_isArrayLike.isArrayLike(source) ? require_toArray.toArray(source) : Object.values(source); + const getKeyFromItem = require_iteratee.iteratee(_getKeyFromItem); + return require_groupBy.groupBy(items, getKeyFromItem); +} +//#endregion +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..8a70fe213cd28121c1810684e3d5e0ebe9033767 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/groupBy.mjs @@ -0,0 +1,42 @@ +import { groupBy as groupBy$1 } from "../../array/groupBy.mjs"; +import { identity } from "../../function/identity.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/groupBy.ts +/** +* Groups the elements of an array or object based on a provided key-generating function. +* +* This function takes an array or object and a function that generates a key from each element or value. +* 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 or values in the object. +* @template K - The type of keys. +* @param source - The collection to group. +* @param [_getKeyFromItem=identity] - The iteratee to transform keys. +* - If a function is provided, it's invoked for each element in the collection. +* - If a property name (string) is provided, that property of each element is used as the key. +* - If a property-value pair (array) is provided, elements with matching property values are used. +* - If a partial object is provided, elements with matching properties are used. +* @returns An object where each key is associated with an array of elements that +* share that key. +* +* @example +* // Using an array +* const array = [6.1, 4.2, 6.3]; +* const result = groupBy(array, Math.floor); +* // => { 4: [4.2], 6: [6.1, 6.3] } +* +* @example +* // Using a property name +* const array = ['one', 'two', 'three']; +* const result = groupBy(array, 'length'); +* // => { 3: ['one', 'two'], 5: ['three'] } +*/ +function groupBy(source, _getKeyFromItem = identity) { + if (source == null) return {}; + return groupBy$1(isArrayLike(source) ? toArray(source) : Object.values(source), iteratee(_getKeyFromItem)); +} +//#endregion +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..7a5053eb4c8c626c6139e58bedbc32a710d3b889 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.d.mts @@ -0,0 +1,33 @@ +//#region src/compat/array/head.d.ts +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * @template T - The type of elements in the array. + * @param array - A non-empty tuple with at least one element. + * @returns 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 array - The array from which to get the first element. + * @returns 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; +//#endregion +export { head }; \ No newline at end of file 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..7a5053eb4c8c626c6139e58bedbc32a710d3b889 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.d.ts @@ -0,0 +1,33 @@ +//#region src/compat/array/head.d.ts +/** + * Returns the first element of an array or `undefined` if the array is empty. + * + * @template T - The type of elements in the array. + * @param array - A non-empty tuple with at least one element. + * @returns 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 array - The array from which to get the first element. + * @returns 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; +//#endregion +export { head }; \ No newline at end of file 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..16645d869881191fe3bfc0c7f59f9327e175047a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.js @@ -0,0 +1,25 @@ +const require_head = require("../../array/head.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/head.ts +/** +* 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 arr - The array from which to get the first element. +* @returns 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 +*/ +function head(arr) { + if (!require_isArrayLike.isArrayLike(arr)) return; + return require_head.head(require_toArray.toArray(arr)); +} +//#endregion +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..838f3edfa6618ea3ff70b660aaa54ea7ef6b2b00 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/head.mjs @@ -0,0 +1,25 @@ +import { head as head$1 } from "../../array/head.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/head.ts +/** +* 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 arr - The array from which to get the first element. +* @returns 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 +*/ +function head(arr) { + if (!isArrayLike(arr)) return; + return head$1(toArray(arr)); +} +//#endregion +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..aa218e098830171699dca6fb8035412142b97090 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/array/includes.d.ts +/** + * 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; +//#endregion +export { includes }; \ No newline at end of file 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..aa218e098830171699dca6fb8035412142b97090 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/array/includes.d.ts +/** + * 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; +//#endregion +export { includes }; \ No newline at end of file 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..7b1ff2c25584d415e79da79282e964eebcc406eb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.js @@ -0,0 +1,46 @@ +const require_eq = require("../util/eq.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +const require_isString = require("../predicate/isString.js"); +//#region src/compat/array/includes.ts +/** +* Checks if a specified value exists within a given source, which can be an array, an object, or a string. +* +* The comparison uses SameValueZero to check for inclusion. +* +* @param source - The source to search in. It can be an array, an object, or a string. +* @param [target] - The value to search for in the source. +* @param [fromIndex=0] - The index to start searching from. If negative, it is treated as an offset from the end of the source. +* @returns `true` if the value is found in the source, `false` otherwise. +* +* @example +* includes([1, 2, 3], 2); // true +* includes({ a: 1, b: 'a', c: NaN }, 'a'); // true +* includes('hello world', 'world'); // true +* includes('hello world', 'test'); // false +*/ +function includes(source, target, fromIndex, guard) { + if (source == null) return false; + if (guard || !fromIndex) fromIndex = 0; + else fromIndex = require_toInteger.toInteger(fromIndex); + if (require_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); + if (require_isArrayLike.isArrayLike(source)) { + if (fromIndex < 0) fromIndex = Math.max(0, source.length + fromIndex); + for (let i = fromIndex; i < source.length; i++) if (require_eq.eq(source[i], target)) return true; + return false; + } + 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 (require_eq.eq(value, target)) return true; + } + return false; +} +//#endregion +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..f644eedbf0c6c96686c07e22792f6f118501308b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/includes.mjs @@ -0,0 +1,43 @@ +import { eq } from "../util/eq.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +import { isString } from "../predicate/isString.mjs"; +//#region src/compat/array/includes.ts +/** +* Checks if a specified value exists within a given source, which can be an array, an object, or a string. +* +* The comparison uses SameValueZero to check for inclusion. +* +* @param source - The source to search in. It can be an array, an object, or a string. +* @param [target] - The value to search for in the source. +* @param [fromIndex=0] - The index to start searching from. If negative, it is treated as an offset from the end of the source. +* @returns `true` if the value is found in the source, `false` otherwise. +* +* @example +* includes([1, 2, 3], 2); // true +* includes({ a: 1, b: 'a', c: NaN }, 'a'); // true +* includes('hello world', 'world'); // true +* includes('hello world', 'test'); // false +*/ +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); + if (isArrayLike(source)) { + if (fromIndex < 0) fromIndex = Math.max(0, source.length + fromIndex); + for (let i = fromIndex; i < source.length; i++) if (eq(source[i], target)) return true; + return false; + } + const keys = Object.keys(source); + if (fromIndex < 0) fromIndex = Math.max(0, keys.length + fromIndex); + for (let i = fromIndex; i < keys.length; i++) if (eq(Reflect.get(source, keys[i]), target)) return true; + return false; +} +//#endregion +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..3e1cbb840ef79bdfad79cc5212914d62807b0b17 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/array/indexOf.d.ts +/** + * 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 array - The array to search. + * @param searchElement - The value to search for. + * @param [fromIndex] - The index to start the search at. + * @returns 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; +//#endregion +export { indexOf }; \ No newline at end of file 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..3e1cbb840ef79bdfad79cc5212914d62807b0b17 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/array/indexOf.d.ts +/** + * 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 array - The array to search. + * @param searchElement - The value to search for. + * @param [fromIndex] - The index to start the search at. + * @returns 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; +//#endregion +export { indexOf }; \ No newline at end of file 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..783e9473c6282a0aa577bd7b944d55d44d05b734 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.js @@ -0,0 +1,31 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/indexOf.ts +/** +* 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 array - The array to search. +* @param searchElement - The value to search for. +* @param [fromIndex] - The index to start the search at. +* @returns 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 +*/ +function indexOf(array, searchElement, fromIndex) { + if (!require_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); +} +//#endregion +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..7ee6b21d7be5fbbc1f8a94b43afcbf28e89bd5ad --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/indexOf.mjs @@ -0,0 +1,31 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/indexOf.ts +/** +* 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 array - The array to search. +* @param searchElement - The value to search for. +* @param [fromIndex] - The index to start the search at. +* @returns 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 +*/ +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); +} +//#endregion +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..241991fd814388106cfbaedb161271e9f32077ef --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/array/initial.d.ts +/** + * 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 arr - The input array. + * @returns 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[]; +//#endregion +export { initial }; \ No newline at end of file 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..241991fd814388106cfbaedb161271e9f32077ef --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/array/initial.d.ts +/** + * 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 arr - The input array. + * @returns 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[]; +//#endregion +export { initial }; \ No newline at end of file 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..e1971736bf615eecb6eb74f9c18b03f69a356e57 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.js @@ -0,0 +1,22 @@ +const require_initial = require("../../array/initial.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/initial.ts +/** +* 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 arr - The input array. +* @returns 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] +*/ +function initial(arr) { + if (!require_isArrayLike.isArrayLike(arr)) return []; + return require_initial.initial(Array.from(arr)); +} +//#endregion +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..7c85154b41dde0351976c41fae10ceeb79390ca2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/initial.mjs @@ -0,0 +1,22 @@ +import { initial as initial$1 } from "../../array/initial.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/initial.ts +/** +* 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 arr - The input array. +* @returns 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] +*/ +function initial(arr) { + if (!isArrayLike(arr)) return []; + return initial$1(Array.from(arr)); +} +//#endregion +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..213f685d986e1d05f2a859b668b1c9ca8e46bbc1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/array/intersection.d.ts +/** + * 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 arrays - The arrays to compare. + * @returns 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[]; +//#endregion +export { intersection }; \ No newline at end of file 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..213f685d986e1d05f2a859b668b1c9ca8e46bbc1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/array/intersection.d.ts +/** + * 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 arrays - The arrays to compare. + * @returns 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[]; +//#endregion +export { intersection }; \ No newline at end of file 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..95516967bdb499f7d917b2bbba4a22c19b0733ed --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.js @@ -0,0 +1,34 @@ +const require_intersection = require("../../array/intersection.js"); +const require_uniq = require("../../array/uniq.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/intersection.ts +/** +* 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 arrays - The arrays to compare. +* @returns 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. +*/ +function intersection(...arrays) { + if (arrays.length === 0) return []; + if (!require_isArrayLikeObject.isArrayLikeObject(arrays[0])) return []; + let result = require_uniq.uniq(Array.from(arrays[0])); + for (let i = 1; i < arrays.length; i++) { + const array = arrays[i]; + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + result = require_intersection.intersection(result, Array.from(array)); + } + return result; +} +//#endregion +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..505b62b53bb54756192833513d59926228a9d46d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersection.mjs @@ -0,0 +1,34 @@ +import { intersection as intersection$1 } from "../../array/intersection.mjs"; +import { uniq } from "../../array/uniq.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/intersection.ts +/** +* 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 arrays - The arrays to compare. +* @returns 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. +*/ +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; +} +//#endregion +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..d18671b1592ed3febf67f180faa0f8414542f3b6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.mts @@ -0,0 +1,74 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/intersectionBy.d.ts +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U + * @param array - The array to inspect. + * @param values - The values to compare. + * @param iteratee - The iteratee invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param iteratee - The iteratee invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param values - The other arrays to compare, and the iteratee to use. + * @returns 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 [array] - The array to inspect. + * @param values - The values to compare. + * @returns 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 values - The arrays to compare and the iteratee to use. + * @returns 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[]; +//#endregion +export { intersectionBy }; \ No newline at end of file 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..0d8ce07e13e382c1de72d7593d82b8bed3e1b650 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.d.ts @@ -0,0 +1,74 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/intersectionBy.d.ts +/** + * Creates an array of unique values that are included in all given arrays, using an iteratee to compute equality. + * + * @template T, U + * @param array - The array to inspect. + * @param values - The values to compare. + * @param iteratee - The iteratee invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param iteratee - The iteratee invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param values - The other arrays to compare, and the iteratee to use. + * @returns 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 [array] - The array to inspect. + * @param values - The values to compare. + * @returns 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 values - The arrays to compare and the iteratee to use. + * @returns 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[]; +//#endregion +export { intersectionBy }; \ No newline at end of file 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..abcc60aac063faebe5bd0df0eadddb6f6ba04162 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.js @@ -0,0 +1,59 @@ +const require_intersectionBy = require("../../array/intersectionBy.js"); +const require_last = require("../../array/last.js"); +const require_uniq = require("../../array/uniq.js"); +const require_uniqBy = require("../../array/uniqBy.js"); +const require_identity = require("../../function/identity.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_property = require("../object/property.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/intersectionBy.ts +/** +* Returns the intersection of multiple arrays after applying the iteratee function to their elements. +* +* This function takes multiple arrays and an optional iteratee function (or property key) +* to compare the elements after transforming them. It returns a new array containing the elements from +* the first array that are present in all subsequent arrays after applying the iteratee to each element. +* If no iteratee is provided, the identity function is used. +* +* If the first array is `null` or `undefined`, an empty array is returned. +* +* @template T +* @param array - The first array to compare. +* @param values - The arrays to compare, or the iteratee function. +* @returns A new array containing the elements from the first array that are present +* in all subsequent arrays after applying the iteratee. +* +* @example +* const array1 = [{ x: 1 }, { x: 2 }, { x: 3 }]; +* const array2 = [{ x: 2 }, { x: 3 }]; +* const result = intersectionBy(array1, array2, 'x'); +* // result will be [{ x: 2 }, { x: 3 }] since these elements have the same `x` property. +* +* @example +* const array1 = [1.1, 2.2, 3.3]; +* const array2 = [2.3, 3.3]; +* const result = intersectionBy(array1, array2, Math.floor); +* // result will be [2.3, 3.3] since it shares the same integer part when `Math.floor` is applied. +*/ +function intersectionBy(array, ...values) { + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + const lastValue = require_last.last(values); + const count = require_isArrayLikeObject.isArrayLikeObject(lastValue) ? values.length : values.length - 1; + const iteratee = getIteratee(lastValue); + if (count <= 0) return require_uniqBy.uniqBy(require_toArray.toArray(array), iteratee ?? require_identity.identity); + let result = require_uniq.uniq(require_toArray.toArray(array)); + for (let i = 0; i < count; ++i) { + const value = values[i]; + if (!require_isArrayLikeObject.isArrayLikeObject(value)) return []; + if (iteratee) result = require_intersectionBy.intersectionBy(result, require_toArray.toArray(value), iteratee); + } + return result; +} +function getIteratee(value) { + if (require_isArrayLikeObject.isArrayLikeObject(value)) return require_identity.identity; + if (typeof value === "function") return (item) => value(item); + if (typeof value === "string") return require_property.property(value); + return null; +} +//#endregion +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..0069121f02d166ebfa85e47c1460381b74a59b13 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionBy.mjs @@ -0,0 +1,59 @@ +import { intersectionBy as intersectionBy$1 } from "../../array/intersectionBy.mjs"; +import { last } from "../../array/last.mjs"; +import { uniq } from "../../array/uniq.mjs"; +import { uniqBy } from "../../array/uniqBy.mjs"; +import { identity } from "../../function/identity.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { property } from "../object/property.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/intersectionBy.ts +/** +* Returns the intersection of multiple arrays after applying the iteratee function to their elements. +* +* This function takes multiple arrays and an optional iteratee function (or property key) +* to compare the elements after transforming them. It returns a new array containing the elements from +* the first array that are present in all subsequent arrays after applying the iteratee to each element. +* If no iteratee is provided, the identity function is used. +* +* If the first array is `null` or `undefined`, an empty array is returned. +* +* @template T +* @param array - The first array to compare. +* @param values - The arrays to compare, or the iteratee function. +* @returns A new array containing the elements from the first array that are present +* in all subsequent arrays after applying the iteratee. +* +* @example +* const array1 = [{ x: 1 }, { x: 2 }, { x: 3 }]; +* const array2 = [{ x: 2 }, { x: 3 }]; +* const result = intersectionBy(array1, array2, 'x'); +* // result will be [{ x: 2 }, { x: 3 }] since these elements have the same `x` property. +* +* @example +* const array1 = [1.1, 2.2, 3.3]; +* const array2 = [2.3, 3.3]; +* const result = intersectionBy(array1, array2, Math.floor); +* // result will be [2.3, 3.3] since it shares the same integer part when `Math.floor` is applied. +*/ +function intersectionBy(array, ...values) { + if (!isArrayLikeObject(array)) return []; + const lastValue = last(values); + const count = isArrayLikeObject(lastValue) ? values.length : values.length - 1; + const iteratee = getIteratee(lastValue); + if (count <= 0) return uniqBy(toArray(array), iteratee ?? identity); + let result = uniq(toArray(array)); + for (let i = 0; i < count; ++i) { + const value = values[i]; + if (!isArrayLikeObject(value)) return []; + if (iteratee) result = intersectionBy$1(result, toArray(value), iteratee); + } + return result; +} +function getIteratee(value) { + if (isArrayLikeObject(value)) return identity; + if (typeof value === "function") return (item) => value(item); + if (typeof value === "string") return property(value); + return null; +} +//#endregion +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..0287d3a55431e5648b8f7b5561b0a4bb448b12b8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.mts @@ -0,0 +1,69 @@ +//#region src/compat/array/intersectionWith.d.ts +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U + * @param array - The array to inspect. + * @param values - The values to compare. + * @param comparator - The comparator invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param comparator - The comparator invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param values - The other arrays to compare, and the comparator to use. + * @returns 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 [array] - The array to inspect. + * @param values - The values to compare. + * @returns 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[]; +//#endregion +export { intersectionWith }; \ No newline at end of file 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..0287d3a55431e5648b8f7b5561b0a4bb448b12b8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.d.ts @@ -0,0 +1,69 @@ +//#region src/compat/array/intersectionWith.d.ts +/** + * Creates an array of unique values that are included in all given arrays, using a comparator function for equality comparisons. + * + * @template T, U + * @param array - The array to inspect. + * @param values - The values to compare. + * @param comparator - The comparator invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param comparator - The comparator invoked per element. + * @returns 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 array - The array to inspect. + * @param values1 - The first values to compare. + * @param values2 - The second values to compare. + * @param values - The other arrays to compare, and the comparator to use. + * @returns 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 [array] - The array to inspect. + * @param values - The values to compare. + * @returns 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[]; +//#endregion +export { intersectionWith }; \ No newline at end of file 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..ffd7e1c38908c65fb7e971307ca06911886d5015 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.js @@ -0,0 +1,53 @@ +const require_intersectionWith = require("../../array/intersectionWith.js"); +const require_eq = require("../util/eq.js"); +const require_last = require("./last.js"); +const require_uniq = require("./uniq.js"); +//#region src/compat/array/intersectionWith.ts +/** +* Returns the intersection of multiple arrays based on a custom equality function. +* +* @template T - The type of elements in the arrays +* @param firstArr - The first array to compare +* @param otherArrs - Additional arrays and optional equality function +* @returns Elements from first array that match in all arrays +* +* @example +* const arr1 = [{id: 1}, {id: 2}]; +* const arr2 = [{id: 2}, {id: 3}]; +* const result = intersectionWith(arr1, arr2, (a, b) => a.id === b.id); +* // result is [{id: 2}] +*/ +function intersectionWith(firstArr, ...otherArrs) { + if (firstArr == null) return []; + const _comparator = require_last.last(otherArrs); + let comparator = require_eq.eq; + let uniq$1 = require_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 = require_intersectionWith.intersectionWith(result, Array.from(otherArr), comparator); + } + return result; +} +/** +* This function is to preserve the sign of `-0`, which is a behavior in lodash. +*/ +function uniqPreserve0(arr) { + const result = []; + const added = /* @__PURE__ */ 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; +} +//#endregion +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..845915dbd4b81f902d94835c39275c0905f79d3e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/intersectionWith.mjs @@ -0,0 +1,53 @@ +import { intersectionWith as intersectionWith$1 } from "../../array/intersectionWith.mjs"; +import { eq } from "../util/eq.mjs"; +import { last } from "./last.mjs"; +import { uniq } from "./uniq.mjs"; +//#region src/compat/array/intersectionWith.ts +/** +* Returns the intersection of multiple arrays based on a custom equality function. +* +* @template T - The type of elements in the arrays +* @param firstArr - The first array to compare +* @param otherArrs - Additional arrays and optional equality function +* @returns Elements from first array that match in all arrays +* +* @example +* const arr1 = [{id: 1}, {id: 2}]; +* const arr2 = [{id: 2}, {id: 3}]; +* const result = intersectionWith(arr1, arr2, (a, b) => a.id === b.id); +* // result is [{id: 2}] +*/ +function intersectionWith(firstArr, ...otherArrs) { + if (firstArr == null) return []; + const _comparator = last(otherArrs); + let comparator = eq; + 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; +} +/** +* This function is to preserve the sign of `-0`, which is a behavior in lodash. +*/ +function uniqPreserve0(arr) { + const result = []; + const added = /* @__PURE__ */ 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; +} +//#endregion +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..f1505f4903ef1244cf34478668282fedd098c8dd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.d.mts @@ -0,0 +1,33 @@ +//#region src/compat/array/invokeMap.d.ts +/** + * Invokes the method at path of each element in collection. + * + * @param collection - The collection to iterate over. + * @param methodName - The name of the method to invoke. + * @param args - The arguments to invoke each method with. + * @returns 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 collection - The collection to iterate over. + * @param method - The method to invoke. + * @param args - The arguments to invoke each method with. + * @returns 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[]; +//#endregion +export { invokeMap }; \ No newline at end of file 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..f1505f4903ef1244cf34478668282fedd098c8dd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.d.ts @@ -0,0 +1,33 @@ +//#region src/compat/array/invokeMap.d.ts +/** + * Invokes the method at path of each element in collection. + * + * @param collection - The collection to iterate over. + * @param methodName - The name of the method to invoke. + * @param args - The arguments to invoke each method with. + * @returns 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 collection - The collection to iterate over. + * @param method - The method to invoke. + * @param args - The arguments to invoke each method with. + * @returns 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[]; +//#endregion +export { invokeMap }; \ No newline at end of file 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..94035ddd12fe850c80fa756392bae5f64a70a8f4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.js @@ -0,0 +1,40 @@ +const require_isFunction = require("../../predicate/isFunction.js"); +const require_isNil = require("../../predicate/isNil.js"); +require("../../predicate/index.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toPath = require("../util/toPath.js"); +const require_get = require("../object/get.js"); +//#region src/compat/array/invokeMap.ts +/** +* Invokes the method at path of each element in collection. +* +* @template T, R +* @param collection - The collection to iterate over. +* @param path - The path of the method to invoke or the method to invoke. +* @param args - The arguments to invoke each method with. +* @returns Returns the array of results. +* +* @example +* invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); +* // => [[1, 5, 7], [1, 2, 3]] +*/ +function invokeMap(collection, path, ...args) { + if (require_isNil.isNil(collection)) return []; + const values = require_isArrayLike.isArrayLike(collection) ? Array.from(collection) : Object.values(collection); + const result = []; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (require_isFunction.isFunction(path)) { + result.push(path.apply(value, args)); + continue; + } + const method = require_get.get(value, path); + let thisContext = value; + const keys = Array.isArray(path) ? path : require_toPath.toPath(path); + if (keys.length > 1) thisContext = require_get.get(value, keys.slice(0, -1)); + result.push(method == null ? void 0 : method.apply(thisContext, args)); + } + return result; +} +//#endregion +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..25a52f29848ec884d29a79bf5ac5b5753aad00ac --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/invokeMap.mjs @@ -0,0 +1,40 @@ +import { isFunction } from "../../predicate/isFunction.mjs"; +import { isNil } from "../../predicate/isNil.mjs"; +import "../../predicate/index.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { get } from "../object/get.mjs"; +//#region src/compat/array/invokeMap.ts +/** +* Invokes the method at path of each element in collection. +* +* @template T, R +* @param collection - The collection to iterate over. +* @param path - The path of the method to invoke or the method to invoke. +* @param args - The arguments to invoke each method with. +* @returns Returns the array of results. +* +* @example +* invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); +* // => [[1, 5, 7], [1, 2, 3]] +*/ +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; + const keys = Array.isArray(path) ? path : toPath(path); + if (keys.length > 1) thisContext = get(value, keys.slice(0, -1)); + result.push(method == null ? void 0 : method.apply(thisContext, args)); + } + return result; +} +//#endregion +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..1a1077cb3874b90a638b0a717380cb932fd2a953 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/array/join.d.ts +/** + * Joins elements of an array into a string. + * + * @param array - The array to join. + * @param [separator=','] - The separator used to join the elements, default is common separator `,`. + * @returns 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; +//#endregion +export { join }; \ No newline at end of file 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..1a1077cb3874b90a638b0a717380cb932fd2a953 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/array/join.d.ts +/** + * Joins elements of an array into a string. + * + * @param array - The array to join. + * @param [separator=','] - The separator used to join the elements, default is common separator `,`. + * @returns 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; +//#endregion +export { join }; \ No newline at end of file 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..7aeb6e02948f4ab4a92dab7b3b20c858aff6a70f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.js @@ -0,0 +1,20 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/join.ts +/** +* Joins elements of an array into a string. +* +* @param array - The array to join. +* @param [separator=','] - The separator used to join the elements, default is common separator `,`. +* @returns 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" +*/ +function join(array, separator) { + if (!require_isArrayLike.isArrayLike(array)) return ""; + return Array.from(array).join(separator); +} +//#endregion +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..8cd678e0abd1dd5d192ab7677418b3f41ef0d24f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/join.mjs @@ -0,0 +1,20 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/join.ts +/** +* Joins elements of an array into a string. +* +* @param array - The array to join. +* @param [separator=','] - The separator used to join the elements, default is common separator `,`. +* @returns 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" +*/ +function join(array, separator) { + if (!isArrayLike(array)) return ""; + return Array.from(array).join(separator); +} +//#endregion +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..2698da4b9353c3c917a3379328a60348c7d51390 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.d.mts @@ -0,0 +1,40 @@ +import { ValueIterateeCustom } from "../_internal/ValueIterateeCustom.mjs"; + +//#region src/compat/array/keyBy.d.ts +/** + * Creates an object composed of keys generated from the results of running each element of collection thru iteratee. + * + * @template T + * @param collection - The collection to iterate over. + * @param [iteratee] - The iteratee to transform keys. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The iteratee to transform keys. + * @returns 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; +//#endregion +export { keyBy }; \ No newline at end of file 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..695541c151940062958b8495d91ceb9c0e16f548 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.d.ts @@ -0,0 +1,40 @@ +import { ValueIterateeCustom } from "../_internal/ValueIterateeCustom.js"; + +//#region src/compat/array/keyBy.d.ts +/** + * Creates an object composed of keys generated from the results of running each element of collection thru iteratee. + * + * @template T + * @param collection - The collection to iterate over. + * @param [iteratee] - The iteratee to transform keys. + * @returns 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 collection - The object to iterate over. + * @param [iteratee] - The iteratee to transform keys. + * @returns 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; +//#endregion +export { keyBy }; \ No newline at end of file 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..7f55884d5e8e6903e810f94abe02d3a2fa83f7a1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.js @@ -0,0 +1,44 @@ +const require_identity = require("../../function/identity.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isObjectLike = require("../predicate/isObjectLike.js"); +const require_reduce = require("./reduce.js"); +//#region src/compat/array/keyBy.ts +/** +* Maps each element of an array or an object based on a provided key-generating function. +* +* This function takes an array or object and a function that generates a key from each element or value. It returns +* an object where the keys are the generated keys and the values are the corresponding elements or values. +* If there are multiple elements or values generating the same key, the last one among them is used +* as the value. +* +* @param collection - The collection to iterate over. +* @param [iteratee] - The iteratee to transform keys. +* - If a function is provided, it's invoked for each element in the collection. +* - If a property name (string) is provided, that property of each element is used as the key. +* - If a property-value pair (array) is provided, elements with matching property values are used. +* - If a partial object is provided, elements with matching properties are used. +* - If omitted, the identity function is used. +* @returns Returns the composed aggregate object. +* +* @example +* // Using an array of objects +* keyBy([{ id: 'a' }, { id: 'b' }], 'id'); +* // => { a: { id: 'a' }, b: { id: 'b' } } +* +* @example +* // Using a function iteratee +* keyBy(['a', 'b', 'c'], val => val.toUpperCase()); +* // => { A: 'a', B: 'b', C: 'c' } +*/ +function keyBy(collection, iteratee$1) { + if (!require_isArrayLike.isArrayLike(collection) && !require_isObjectLike.isObjectLike(collection)) return {}; + const keyFn = require_iteratee.iteratee(iteratee$1 ?? require_identity.identity); + return require_reduce.reduce(collection, (result, value) => { + const key = keyFn(value); + result[key] = value; + return result; + }, {}); +} +//#endregion +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..cec299fe060db5aa781d2f96eac7b2a48640c77c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/keyBy.mjs @@ -0,0 +1,44 @@ +import { identity } from "../../function/identity.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isObjectLike } from "../predicate/isObjectLike.mjs"; +import { reduce } from "./reduce.mjs"; +//#region src/compat/array/keyBy.ts +/** +* Maps each element of an array or an object based on a provided key-generating function. +* +* This function takes an array or object and a function that generates a key from each element or value. It returns +* an object where the keys are the generated keys and the values are the corresponding elements or values. +* If there are multiple elements or values generating the same key, the last one among them is used +* as the value. +* +* @param collection - The collection to iterate over. +* @param [iteratee] - The iteratee to transform keys. +* - If a function is provided, it's invoked for each element in the collection. +* - If a property name (string) is provided, that property of each element is used as the key. +* - If a property-value pair (array) is provided, elements with matching property values are used. +* - If a partial object is provided, elements with matching properties are used. +* - If omitted, the identity function is used. +* @returns Returns the composed aggregate object. +* +* @example +* // Using an array of objects +* keyBy([{ id: 'a' }, { id: 'b' }], 'id'); +* // => { a: { id: 'a' }, b: { id: 'b' } } +* +* @example +* // Using a function iteratee +* keyBy(['a', 'b', 'c'], val => val.toUpperCase()); +* // => { A: 'a', B: 'b', C: 'c' } +*/ +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; + }, {}); +} +//#endregion +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..470451984360a283756096101975c493063ecbb8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.d.mts @@ -0,0 +1,26 @@ +//#region src/compat/array/last.d.ts +/** + * 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 arr - The array from which to get the last element. + * @returns 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; +//#endregion +export { last }; \ No newline at end of file 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..470451984360a283756096101975c493063ecbb8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.d.ts @@ -0,0 +1,26 @@ +//#region src/compat/array/last.d.ts +/** + * 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 arr - The array from which to get the last element. + * @returns 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; +//#endregion +export { last }; \ No newline at end of file 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..a5568178fd575414adbb12733a8c0938612cdd76 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.js @@ -0,0 +1,32 @@ +const require_last = require("../../array/last.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/last.ts +/** +* 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 arr - The array from which to get the last element. +* @returns 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 +*/ +function last(array) { + if (!require_isArrayLike.isArrayLike(array)) return; + return require_last.last(require_toArray.toArray(array)); +} +//#endregion +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..4285bf001e0e1d67bb6184d440381511d1fb1bde --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/last.mjs @@ -0,0 +1,32 @@ +import { last as last$1 } from "../../array/last.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/last.ts +/** +* 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 arr - The array from which to get the last element. +* @returns 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 +*/ +function last(array) { + if (!isArrayLike(array)) return; + return last$1(toArray(array)); +} +//#endregion +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..9148fcc65204086acd842029b9e4f0f63c09d999 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/array/lastIndexOf.d.ts +/** + * Gets the index at which the last occurrence of value is found in array. + * + * @template T + * @param array - The array to inspect. + * @param value - The value to search for. + * @param [fromIndex] - The index to search from or true to search from the end. + * @returns 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); + * // => 1 + */ +declare function lastIndexOf(array: ArrayLike | null | undefined, searchElement: T, fromIndex?: true | number): number; +//#endregion +export { lastIndexOf }; \ No newline at end of file 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..9148fcc65204086acd842029b9e4f0f63c09d999 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/array/lastIndexOf.d.ts +/** + * Gets the index at which the last occurrence of value is found in array. + * + * @template T + * @param array - The array to inspect. + * @param value - The value to search for. + * @param [fromIndex] - The index to search from or true to search from the end. + * @returns 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); + * // => 1 + */ +declare function lastIndexOf(array: ArrayLike | null | undefined, searchElement: T, fromIndex?: true | number): number; +//#endregion +export { lastIndexOf }; \ No newline at end of file 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..4ddaad4f84f04ad59971761070f2718e86d8c867 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.js @@ -0,0 +1,15 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/array/lastIndexOf.ts +function lastIndexOf(array, searchElement, fromIndex) { + if (!require_isArrayLike.isArrayLike(array) || array.length === 0) return -1; + const length = array.length; + let index = fromIndex === void 0 ? length - 1 : require_toInteger.toInteger(fromIndex); + if (fromIndex !== void 0) 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); +} +//#endregion +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..df2963b5508d72e96b2369f895d7851d23830667 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/lastIndexOf.mjs @@ -0,0 +1,15 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +//#region src/compat/array/lastIndexOf.ts +function lastIndexOf(array, searchElement, fromIndex) { + if (!isArrayLike(array) || array.length === 0) return -1; + const length = array.length; + let index = fromIndex === void 0 ? length - 1 : toInteger(fromIndex); + if (fromIndex !== void 0) 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); +} +//#endregion +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..56bd2c0d03c4a3f96e5ae8c0c21a24286598f199 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.d.mts @@ -0,0 +1,111 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.mjs"; +import { ListIterator } from "../_internal/ListIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { TupleIterator } from "../_internal/TupleIterator.mjs"; + +//#region src/compat/array/map.d.ts +/** + * Maps each element in a tuple to a new tuple of values using an iteratee. + * + * @param collection - The tuple to iterate over + * @param iteratee - The function invoked per iteration + * @returns} - 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 collection - The array to iterate over + * @param iteratee - The function invoked per iteration + * @returns 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 collection - The array-like object to iterate over + * @param iteratee - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @returns 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 collection - The object to iterate over + * @param iteratee - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @param iteratee - The property to pluck from each element + * @returns 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 collection - The object to iterate over + * @param [iteratee] - The string property to pluck from each element + * @returns 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 collection - The object to iterate over + * @param [iteratee] - The object to match against + * @returns 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[]; +//#endregion +export { map }; \ No newline at end of file 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..181d373c6866e70251619ad486d09ccc70e66262 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.d.ts @@ -0,0 +1,111 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.js"; +import { ListIterator } from "../_internal/ListIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { TupleIterator } from "../_internal/TupleIterator.js"; + +//#region src/compat/array/map.d.ts +/** + * Maps each element in a tuple to a new tuple of values using an iteratee. + * + * @param collection - The tuple to iterate over + * @param iteratee - The function invoked per iteration + * @returns} - 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 collection - The array to iterate over + * @param iteratee - The function invoked per iteration + * @returns 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 collection - The array-like object to iterate over + * @param iteratee - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @returns 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 collection - The object to iterate over + * @param iteratee - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @param iteratee - The property to pluck from each element + * @returns 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 collection - The object to iterate over + * @param [iteratee] - The string property to pluck from each element + * @returns 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 collection - The object to iterate over + * @param [iteratee] - The object to match against + * @returns 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[]; +//#endregion +export { map }; \ No newline at end of file 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..75b2909975267e4401b311a5350f9c776e99795e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.js @@ -0,0 +1,19 @@ +const require_identity = require("../../function/identity.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/map.ts +function map(collection, _iteratee) { + if (!collection) return []; + const keys = require_isArrayLike.isArrayLike(collection) || Array.isArray(collection) ? require_range.range(0, collection.length) : Object.keys(collection); + const iteratee$1 = require_iteratee.iteratee(_iteratee ?? require_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; +} +//#endregion +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..634a388fb31c2a46405ad0b1c3ab0ff27cc66f52 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/map.mjs @@ -0,0 +1,19 @@ +import { identity } from "../../function/identity.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/map.ts +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; +} +//#endregion +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..2e2891bbde049cbc5c2a864a5612205ddae9289f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/array/nth.d.ts +/** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array - The array to query. + * @param [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; +//#endregion +export { nth }; \ No newline at end of file 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..2e2891bbde049cbc5c2a864a5612205ddae9289f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/array/nth.d.ts +/** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array - The array to query. + * @param [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; +//#endregion +export { nth }; \ No newline at end of file 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..e5d4731724b3d6c556243407c2ebad1f7ea94fce --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.js @@ -0,0 +1,22 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/array/nth.ts +/** +* Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. +* +* @param array - The array to query. +* @param [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 +*/ +function nth(array, n = 0) { + if (!require_isArrayLike.isArrayLike(array) || array.length === 0) return; + n = require_toInteger.toInteger(n); + if (n < 0) n += array.length; + return array[n]; +} +//#endregion +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..09f6d805124e1450d1b9694db4aaf0a4681dfb1b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/nth.mjs @@ -0,0 +1,22 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +//#region src/compat/array/nth.ts +/** +* Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. +* +* @param array - The array to query. +* @param [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 +*/ +function nth(array, n = 0) { + if (!isArrayLike(array) || array.length === 0) return; + n = toInteger(n); + if (n < 0) n += array.length; + return array[n]; +} +//#endregion +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..442f1245c547fc17797ce0915045c222f539364a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.d.mts @@ -0,0 +1,86 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; +import { ListIterator } from "../_internal/ListIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.mjs"; +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/array/orderBy.d.ts +type Criterion = ((item: T) => unknown) | PropertyKey | PropertyKey[] | null | undefined; +/** + * 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 collection The array to sort + * @param iteratees The iteratee functions to sort by + * @param orders The sort orders + * @returns 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 collection The array to sort + * @param iteratees The property names/paths to sort by + * @param orders The sort orders + * @returns 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 collection The object to sort values from + * @param iteratees The iteratee functions to sort by + * @param orders The sort orders + * @returns 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 collection The object to sort values from + * @param iteratees The property names/paths to sort by + * @param orders The sort orders + * @returns 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; +//#endregion +export { orderBy }; \ No newline at end of file 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..830a227c89a5bccd44a8c2d7fb26a3f54b01f5ef --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.d.ts @@ -0,0 +1,86 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; +import { ListIterator } from "../_internal/ListIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.js"; +import { Many } from "../_internal/Many.js"; + +//#region src/compat/array/orderBy.d.ts +type Criterion = ((item: T) => unknown) | PropertyKey | PropertyKey[] | null | undefined; +/** + * 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 collection The array to sort + * @param iteratees The iteratee functions to sort by + * @param orders The sort orders + * @returns 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 collection The array to sort + * @param iteratees The property names/paths to sort by + * @param orders The sort orders + * @returns 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 collection The object to sort values from + * @param iteratees The iteratee functions to sort by + * @param orders The sort orders + * @returns 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 collection The object to sort values from + * @param iteratees The property names/paths to sort by + * @param orders The sort orders + * @returns 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; +//#endregion +export { orderBy }; \ No newline at end of file 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..16090b77254ebe4f28f389e99e501bdeae368edf --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.js @@ -0,0 +1,80 @@ +const require_toPath = require("../util/toPath.js"); +const require_compareValues = require("../_internal/compareValues.js"); +const require_isKey = require("../_internal/isKey.js"); +//#region src/compat/array/orderBy.ts +/** +* 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, and an array of order directions. +* It returns the sorted array, ordering by each key according to its corresponding direction ('asc' for ascending or 'desc' for descending). +* 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 collection - The array of objects to be sorted. +* @param criteria - An array of criteria (property names or property paths or custom key functions) to sort by. +* @param orders - An array of order directions ('asc' for ascending or 'desc' for descending). +* @param [guard] Enables use as an iteratee for methods like `_.reduce`. +* @returns 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, ['user', (item) => item.age], ['asc', 'desc']); +* // result will be: +* // [ +* // { user: 'barney', age: 36 }, +* // { user: 'barney', age: 34 }, +* // { user: 'fred', age: 48 }, +* // { user: 'fred', age: 40 }, +* // ] +*/ +function orderBy(collection, criteria, orders, guard) { + if (collection == null) return []; + orders = guard ? void 0 : 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) || require_isKey.isKey(criterion)) return criterion; + return { + key: criterion, + path: require_toPath.toPath(criterion) + }; + }); + return collection.map((item) => ({ + original: item, + criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item)) + })).slice().sort((a, b) => { + for (let i = 0; i < preparedCriteria.length; i++) { + const comparedResult = require_compareValues.compareValues(a.criteria[i], b.criteria[i], orders[i]); + if (comparedResult !== 0) return comparedResult; + } + return 0; + }).map((item) => item.original); +} +//#endregion +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..e326e1c7f3561aa4548792e5b933f76f2e513c1e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/orderBy.mjs @@ -0,0 +1,80 @@ +import { toPath } from "../util/toPath.mjs"; +import { compareValues } from "../_internal/compareValues.mjs"; +import { isKey } from "../_internal/isKey.mjs"; +//#region src/compat/array/orderBy.ts +/** +* 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, and an array of order directions. +* It returns the sorted array, ordering by each key according to its corresponding direction ('asc' for ascending or 'desc' for descending). +* 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 collection - The array of objects to be sorted. +* @param criteria - An array of criteria (property names or property paths or custom key functions) to sort by. +* @param orders - An array of order directions ('asc' for ascending or 'desc' for descending). +* @param [guard] Enables use as an iteratee for methods like `_.reduce`. +* @returns 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, ['user', (item) => item.age], ['asc', 'desc']); +* // result will be: +* // [ +* // { user: 'barney', age: 36 }, +* // { user: 'barney', age: 34 }, +* // { user: 'fred', age: 48 }, +* // { user: 'fred', age: 40 }, +* // ] +*/ +function orderBy(collection, criteria, orders, guard) { + if (collection == null) return []; + orders = guard ? void 0 : 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) + }; + }); + return collection.map((item) => ({ + original: item, + criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item)) + })).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); +} +//#endregion +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..8da48f3f8e697dfe31f20e7df41ea10cea4e11be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.d.mts @@ -0,0 +1,51 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; +import { ValueIteratorTypeGuard } from "../_internal/ValueIteratorTypeGuard.mjs"; + +//#region src/compat/array/partition.d.ts +/** + * 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 collection - The collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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]; +//#endregion +export { partition }; \ No newline at end of file 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..c7db99dcaf45ae0dee76a154917d7aa534f7f388 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.d.ts @@ -0,0 +1,51 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; +import { ValueIteratorTypeGuard } from "../_internal/ValueIteratorTypeGuard.js"; + +//#region src/compat/array/partition.d.ts +/** + * 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 collection - The collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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]; +//#endregion +export { partition }; \ No newline at end of file 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..5686a66572df65c129c08b1ec9c2566d4fb9d8be --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.js @@ -0,0 +1,42 @@ +const require_identity = require("../../function/identity.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/partition.ts +/** +* Creates an array of elements split into two groups, the first of which contains elements +* `predicate` returns truthy for, the second of which contains elements +* `predicate` returns falsy for. The predicate is invoked with one argument: (value). +* +* @template T +* @param source - The array or object to iterate over. +* @param [predicate=identity] - The function invoked per iteration. +* @returns Returns the array of grouped elements. +* +* @example +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [[{ a: 1 }, { a: 2 }], [{ b: 1 }]] +* +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [[{ b: 1 }], [{ a: 1 }, { a: 2 }]] +* +* partition({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [[{ a: 2, b: false }], [{ a: 0, b: true }, { a: 1, b: true }]] +* +* partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]] +*/ +function partition(source, predicate = require_identity.identity) { + if (!source) return [[], []]; + const collection = require_isArrayLike.isArrayLike(source) ? source : Object.values(source); + predicate = require_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]; +} +//#endregion +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..e736b26946365103607ee4680a0f26c03abaed31 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/partition.mjs @@ -0,0 +1,42 @@ +import { identity } from "../../function/identity.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/partition.ts +/** +* Creates an array of elements split into two groups, the first of which contains elements +* `predicate` returns truthy for, the second of which contains elements +* `predicate` returns falsy for. The predicate is invoked with one argument: (value). +* +* @template T +* @param source - The array or object to iterate over. +* @param [predicate=identity] - The function invoked per iteration. +* @returns Returns the array of grouped elements. +* +* @example +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [[{ a: 1 }, { a: 2 }], [{ b: 1 }]] +* +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [[{ b: 1 }], [{ a: 1 }, { a: 2 }]] +* +* partition({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [[{ a: 2, b: false }], [{ a: 0, b: true }, { a: 1, b: true }]] +* +* partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]] +*/ +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]; +} +//#endregion +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..4f6ce2ca75625191e07e27d0166e17d9364ec8d1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.d.mts @@ -0,0 +1,39 @@ +//#region src/compat/array/pull.d.ts +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template T + * @param array - The array to modify. + * @param values - The values to remove. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @returns 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; +//#endregion +export { pull }; \ No newline at end of file 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..4f6ce2ca75625191e07e27d0166e17d9364ec8d1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.d.ts @@ -0,0 +1,39 @@ +//#region src/compat/array/pull.d.ts +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template T + * @param array - The array to modify. + * @param values - The values to remove. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @returns 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; +//#endregion +export { pull }; \ No newline at end of file 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..d4267470c544c039421a43afbfd7d9a747990a05 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.js @@ -0,0 +1,23 @@ +const require_pull = require("../../array/pull.js"); +//#region src/compat/array/pull.ts +/** +* 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 +* @param arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @returns 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] +*/ +function pull(arr, ...valuesToRemove) { + return require_pull.pull(arr, valuesToRemove); +} +//#endregion +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..2c88ddb24ca6f7333aace179f23a8cb97dd4c09c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pull.mjs @@ -0,0 +1,23 @@ +import { pull as pull$1 } from "../../array/pull.mjs"; +//#region src/compat/array/pull.ts +/** +* 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 +* @param arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @returns 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] +*/ +function pull(arr, ...valuesToRemove) { + return pull$1(arr, valuesToRemove); +} +//#endregion +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..2e432e1fb06024790de20f5942fe842d9cded2d2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts @@ -0,0 +1,42 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/pullAll.d.ts +/** + * 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 array - The array to modify. + * @param [values] - The values to remove. + * @returns 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 array - The array to modify. + * @param [values] - The values to remove. + * @returns 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; +//#endregion +export { pullAll }; \ No newline at end of file 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..090e24f26e829863e1e23d48965ee3af5564b9e7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts @@ -0,0 +1,42 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/pullAll.d.ts +/** + * 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 array - The array to modify. + * @param [values] - The values to remove. + * @returns 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 array - The array to modify. + * @param [values] - The values to remove. + * @returns 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; +//#endregion +export { pullAll }; \ No newline at end of file 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..d07e7d7574361e5a99579faa6b9d91a4859591ad --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.js @@ -0,0 +1,23 @@ +const require_pull = require("../../array/pull.js"); +//#region src/compat/array/pullAll.ts +/** +* 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 +* @param arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @returns The modified array with the specified values removed. +* +* @example +* const numbers = [1, 2, 3, 4, 5, 2, 4]; +* pullAll(numbers, [2, 4]); +* console.log(numbers); // [1, 3, 5] +*/ +function pullAll(arr, valuesToRemove = []) { + return require_pull.pull(arr, Array.from(valuesToRemove)); +} +//#endregion +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..9a3c37d0dc837a7a1360e8e78d266d1492935c59 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAll.mjs @@ -0,0 +1,23 @@ +import { pull } from "../../array/pull.mjs"; +//#region src/compat/array/pullAll.ts +/** +* 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 +* @param arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @returns The modified array with the specified values removed. +* +* @example +* const numbers = [1, 2, 3, 4, 5, 2, 4]; +* pullAll(numbers, [2, 4]); +* console.log(numbers); // [1, 3, 5] +*/ +function pullAll(arr, valuesToRemove = []) { + return pull(arr, Array.from(valuesToRemove)); +} +//#endregion +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..d50f002256d068986393f43734211537992937d6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts @@ -0,0 +1,87 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/pullAllBy.d.ts +/** + * 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param iteratee - The iteratee invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param iteratee - The iteratee invoked per element. + * @returns 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; +//#endregion +export { pullAllBy }; \ No newline at end of file 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..7c7e269ad4d7203cd5cb30105485f88642c6e7b5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts @@ -0,0 +1,87 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/pullAllBy.d.ts +/** + * 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param iteratee - The iteratee invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param iteratee - The iteratee invoked per element. + * @returns 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; +//#endregion +export { pullAllBy }; \ No newline at end of file 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..6e4ac8af22daf7fde1f8679d90af76b68da75e83 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.js @@ -0,0 +1,43 @@ +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/pullAllBy.ts +/** +* 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 arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @param getValue - The key of the property to match against each element. +* @returns The modified array with the specified values removed. +* +* @example +* // Using a iteratee function +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], obj => obj.value); +* console.log(result); // [{ value: 2 }] +* +* // Using a property name +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], 'value'); +* console.log(result); // [{ value: 2 }] +*/ +function pullAllBy(arr, valuesToRemove, _getValue) { + const getValue = require_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; +} +//#endregion +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..cd7bd2fed387bd831e6c857ce378f7a34c2420cc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs @@ -0,0 +1,43 @@ +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/pullAllBy.ts +/** +* 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 arr - The array to modify. +* @param valuesToRemove - The values to remove from the array. +* @param getValue - The key of the property to match against each element. +* @returns The modified array with the specified values removed. +* +* @example +* // Using a iteratee function +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], obj => obj.value); +* console.log(result); // [{ value: 2 }] +* +* // Using a property name +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], 'value'); +* console.log(result); // [{ value: 2 }] +*/ +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; +} +//#endregion +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..402056c84b58be5b2ea475ee3b15cb5f003b894b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts @@ -0,0 +1,90 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/pullAllWith.d.ts +/** + * 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [comparator] - The comparator invoked per element. + * @returns 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [comparator] - The comparator invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param comparator - The comparator invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param comparator - The comparator invoked per element. + * @returns 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; +//#endregion +export { pullAllWith }; \ No newline at end of file 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..23594e7f4ec9d65504b05bc4ad923d124c841371 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts @@ -0,0 +1,90 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/pullAllWith.d.ts +/** + * 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [comparator] - The comparator invoked per element. + * @returns 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 array - The array to modify. + * @param [values] - The values to remove. + * @param [comparator] - The comparator invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param comparator - The comparator invoked per element. + * @returns 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 array - The array to modify. + * @param values - The values to remove. + * @param comparator - The comparator invoked per element. + * @returns 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; +//#endregion +export { pullAllWith }; \ No newline at end of file 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..00c85c0d56bf1af703ff6d17c56b4d43aebfeb66 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.js @@ -0,0 +1,43 @@ +const require_eq = require("../util/eq.js"); +const require_copyArray = require("../_internal/copyArray.js"); +//#region src/compat/array/pullAllWith.ts +/** +* Removes and returns elements from an array using a provided comparison function to determine which elements to remove. +* +* @template T +* @param array - The array to modify. +* @param values - The values to remove from the array. +* @param comparator - The function to compare elements of `array` with elements of `values`. Should return `true` if the two elements are considered equal. +* @returns The array with specified values removed. +* +* @example +* import pullAllWith from './pullAllWith'; +* import isEqual from '../predicate'; +* +* const array = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }]; +* const valuesToRemove = [{ x: 3, y: 4 }]; +* +* const result = pullAllWith(array, valuesToRemove, isEqual); +* +* console.log(result); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +* console.log(array); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +*/ +function pullAllWith(array, values, comparator) { + if (array?.length == null || values?.length == null) return array; + if (array === values) values = require_copyArray.default(values); + let resultLength = 0; + if (comparator == null) comparator = (a, b) => require_eq.eq(a, b); + const valuesArray = Array.isArray(values) ? values : Array.from(values); + const hasUndefined = valuesArray.includes(void 0); + for (let i = 0; i < array.length; i++) { + if (i in array) { + if (!valuesArray.some((value) => comparator(array[i], value))) array[resultLength++] = array[i]; + continue; + } + if (!hasUndefined) delete array[resultLength++]; + } + array.length = resultLength; + return array; +} +//#endregion +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..2d711fe0c7a95c276b13d584b5320b1665e47c13 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs @@ -0,0 +1,43 @@ +import { eq } from "../util/eq.mjs"; +import copyArray from "../_internal/copyArray.mjs"; +//#region src/compat/array/pullAllWith.ts +/** +* Removes and returns elements from an array using a provided comparison function to determine which elements to remove. +* +* @template T +* @param array - The array to modify. +* @param values - The values to remove from the array. +* @param comparator - The function to compare elements of `array` with elements of `values`. Should return `true` if the two elements are considered equal. +* @returns The array with specified values removed. +* +* @example +* import pullAllWith from './pullAllWith'; +* import isEqual from '../predicate'; +* +* const array = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }]; +* const valuesToRemove = [{ x: 3, y: 4 }]; +* +* const result = pullAllWith(array, valuesToRemove, isEqual); +* +* console.log(result); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +* console.log(array); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +*/ +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) => eq(a, b); + const valuesArray = Array.isArray(values) ? values : Array.from(values); + const hasUndefined = valuesArray.includes(void 0); + for (let i = 0; i < array.length; i++) { + if (i in array) { + if (!valuesArray.some((value) => comparator(array[i], value))) array[resultLength++] = array[i]; + continue; + } + if (!hasUndefined) delete array[resultLength++]; + } + array.length = resultLength; + return array; +} +//#endregion +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..ef1a5104bebb54723f010053d8288dbe6baab92e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts @@ -0,0 +1,51 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/array/pullAt.d.ts +/** + * 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 array - The array to modify. + * @param indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns 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 array - The array to modify. + * @param indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns 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; +//#endregion +export { pullAt }; \ No newline at end of file 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..3cdb4a80631d6428cc1db7639b3e4a629e45a36f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts @@ -0,0 +1,51 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; +import { Many } from "../_internal/Many.js"; + +//#region src/compat/array/pullAt.d.ts +/** + * 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 array - The array to modify. + * @param indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns 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 array - The array to modify. + * @param indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns 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; +//#endregion +export { pullAt }; \ No newline at end of file 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..8286151b242edadc3cc14eee2fca11cc34b0d9ed --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.js @@ -0,0 +1,44 @@ +const require_isArray = require("../predicate/isArray.js"); +const require_toKey = require("../_internal/toKey.js"); +const require_toPath = require("../util/toPath.js"); +const require_isIndex = require("../_internal/isIndex.js"); +const require_flattenDepth = require("./flattenDepth.js"); +const require_isKey = require("../_internal/isKey.js"); +const require_at = require("../object/at.js"); +const require_unset = require("../object/unset.js"); +//#region src/compat/array/pullAt.ts +/** +* Removes elements from an array at specified indices and returns the removed elements. +* +* @template T +* @param array - The array from which elements will be removed. +* @param _indices - An array of indices specifying the positions of elements to remove. +* @returns 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] +*/ +function pullAt(array, ..._indices) { + const indices = require_flattenDepth.flattenDepth(_indices, 1); + if (!array) return Array(indices.length); + const result = require_at.at(array, indices); + const indicesToPull = indices.map((index) => require_isIndex.isIndex(index, array.length) ? Number(index) : index).sort((a, b) => b - a); + for (const index of new Set(indicesToPull)) { + if (require_isIndex.isIndex(index, array.length)) { + Array.prototype.splice.call(array, index, 1); + continue; + } + if (require_isKey.isKey(index, array)) { + delete array[require_toKey.toKey(index)]; + continue; + } + const path = require_isArray.isArray(index) ? index : require_toPath.toPath(index); + require_unset.unset(array, path); + } + return result; +} +//#endregion +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..5b2a7db121ca93ff4a57733b1ddee902cd9bf192 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/pullAt.mjs @@ -0,0 +1,43 @@ +import { isArray } from "../predicate/isArray.mjs"; +import { toKey } from "../_internal/toKey.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { isIndex } from "../_internal/isIndex.mjs"; +import { flattenDepth } from "./flattenDepth.mjs"; +import { isKey } from "../_internal/isKey.mjs"; +import { at } from "../object/at.mjs"; +import { unset } from "../object/unset.mjs"; +//#region src/compat/array/pullAt.ts +/** +* Removes elements from an array at specified indices and returns the removed elements. +* +* @template T +* @param array - The array from which elements will be removed. +* @param _indices - An array of indices specifying the positions of elements to remove. +* @returns 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] +*/ +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; + } + unset(array, isArray(index) ? index : toPath(index)); + } + return result; +} +//#endregion +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..9dc85bb16e5a6b929e99f2cb4f740d0c04f2153a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.d.mts @@ -0,0 +1,81 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.mjs"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.mjs"; + +//#region src/compat/array/reduce.d.ts +/** + * Reduces an array to a single value using an iteratee function. + * + * @param collection - The array to iterate over + * @param callback - The function invoked per iteration + * @param accumulator - The initial value + * @returns 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 collection - The array-like object to iterate over + * @param callback - The function invoked per iteration + * @param accumulator - The initial value + * @returns 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 collection - The object to iterate over + * @param callback - The function invoked per iteration + * @param accumulator - The initial value + * @returns 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 collection - The array to iterate over + * @param callback - The function invoked per iteration + * @returns 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 collection - The array-like object to iterate over + * @param callback - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @param callback - The function invoked per iteration + * @returns 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; +//#endregion +export { reduce }; \ No newline at end of file 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..0cfd2a921ead8c879ea4a6f1e16e9e25d04e73a0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.d.ts @@ -0,0 +1,81 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.js"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.js"; + +//#region src/compat/array/reduce.d.ts +/** + * Reduces an array to a single value using an iteratee function. + * + * @param collection - The array to iterate over + * @param callback - The function invoked per iteration + * @param accumulator - The initial value + * @returns 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 collection - The array-like object to iterate over + * @param callback - The function invoked per iteration + * @param accumulator - The initial value + * @returns 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 collection - The object to iterate over + * @param callback - The function invoked per iteration + * @param accumulator - The initial value + * @returns 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 collection - The array to iterate over + * @param callback - The function invoked per iteration + * @returns 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 collection - The array-like object to iterate over + * @param callback - The function invoked per iteration + * @returns 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 collection - The object to iterate over + * @param callback - The function invoked per iteration + * @returns 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; +//#endregion +export { reduce }; \ No newline at end of file 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..a79792af3628f9944b4f3af0e0cef8198db493b6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.js @@ -0,0 +1,54 @@ +const require_identity = require("../../function/identity.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/reduce.ts +/** +* Reduces a collection to a single value using an iteratee function. +* +* @param collection - The collection to iterate over. +* @param iteratee - The function invoked per iteration or the key to reduce over. +* @param initialValue - The initial value. +* @returns Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduce(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduce(collection, iteratee = require_identity.identity, accumulator) { + const hasAccumulator = arguments.length >= 3; + if (!collection) return accumulator; + let keys; + let startIndex = 0; + if (require_isArrayLike.isArrayLike(collection)) { + keys = require_range.range(0, collection.length); + if (!hasAccumulator && collection.length > 0) { + accumulator = collection[0]; + startIndex += 1; + } + } else { + keys = Object.keys(collection); + if (!hasAccumulator && keys.length > 0) { + 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; +} +//#endregion +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..432aa5b03667b92d48fa3c095d1e54b74fa77b37 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduce.mjs @@ -0,0 +1,54 @@ +import { identity } from "../../function/identity.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/reduce.ts +/** +* Reduces a collection to a single value using an iteratee function. +* +* @param collection - The collection to iterate over. +* @param iteratee - The function invoked per iteration or the key to reduce over. +* @param initialValue - The initial value. +* @returns Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduce(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduce(collection, iteratee = identity, accumulator) { + const hasAccumulator = arguments.length >= 3; + if (!collection) return accumulator; + let keys; + let startIndex = 0; + if (isArrayLike(collection)) { + keys = range(0, collection.length); + if (!hasAccumulator && collection.length > 0) { + accumulator = collection[0]; + startIndex += 1; + } + } else { + keys = Object.keys(collection); + if (!hasAccumulator && keys.length > 0) { + 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; +} +//#endregion +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..e390fffc69fcb1a3023f3bfae7b1156e21f37666 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts @@ -0,0 +1,119 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.mjs"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.mjs"; + +//#region src/compat/array/reduceRight.d.ts +/** + * 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 collection - The array to iterate over. + * @param callback - The function invoked per iteration. + * @param accumulator - The initial value. + * @returns 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 collection - The array-like collection to iterate over. + * @param callback - The function invoked per iteration. + * @param accumulator - The initial value. + * @returns 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 collection - The object to iterate over. + * @param callback - The function invoked per iteration. + * @param accumulator - The initial value. + * @returns 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 collection - The array to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The array-like collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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; +//#endregion +export { reduceRight }; \ No newline at end of file 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..e1f6aa1be8b2268532567305ea48bc9f7a5e9399 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts @@ -0,0 +1,119 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.js"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.js"; + +//#region src/compat/array/reduceRight.d.ts +/** + * 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 collection - The array to iterate over. + * @param callback - The function invoked per iteration. + * @param accumulator - The initial value. + * @returns 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 collection - The array-like collection to iterate over. + * @param callback - The function invoked per iteration. + * @param accumulator - The initial value. + * @returns 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 collection - The object to iterate over. + * @param callback - The function invoked per iteration. + * @param accumulator - The initial value. + * @returns 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 collection - The array to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The array-like collection to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param callback - The function invoked per iteration. + * @returns 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; +//#endregion +export { reduceRight }; \ No newline at end of file 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..e9136c9db94a4ff1d871df19244dea9104ab0ddb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.js @@ -0,0 +1,54 @@ +const require_identity = require("../../function/identity.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/reduceRight.ts +/** +* Reduces a collection to a single value using an iteratee function, starting from the right. +* +* @param collection - The collection to iterate over. +* @param iteratee - The function invoked per iteration or the key to reduce over. +* @param initialValue - The initial value. +* @returns Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduceRight(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduceRight(collection, iteratee = require_identity.identity, accumulator) { + const hasAccumulator = arguments.length >= 3; + if (!collection) return accumulator; + let keys; + let startIndex; + if (require_isArrayLike.isArrayLike(collection)) { + keys = require_range.range(0, collection.length).reverse(); + if (!hasAccumulator && collection.length > 0) { + accumulator = collection[collection.length - 1]; + startIndex = 1; + } else startIndex = 0; + } else { + keys = Object.keys(collection).reverse(); + if (!hasAccumulator && keys.length > 0) { + 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; +} +//#endregion +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..4123e3c8338137599295ce54466cf006b015d32c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs @@ -0,0 +1,54 @@ +import { identity } from "../../function/identity.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/reduceRight.ts +/** +* Reduces a collection to a single value using an iteratee function, starting from the right. +* +* @param collection - The collection to iterate over. +* @param iteratee - The function invoked per iteration or the key to reduce over. +* @param initialValue - The initial value. +* @returns Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduceRight(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduceRight(collection, iteratee = identity, accumulator) { + const hasAccumulator = arguments.length >= 3; + if (!collection) return accumulator; + let keys; + let startIndex; + if (isArrayLike(collection)) { + keys = range(0, collection.length).reverse(); + if (!hasAccumulator && collection.length > 0) { + accumulator = collection[collection.length - 1]; + startIndex = 1; + } else startIndex = 0; + } else { + keys = Object.keys(collection).reverse(); + if (!hasAccumulator && keys.length > 0) { + 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; +} +//#endregion +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..d5512db552519012e3cc99c3bb1dec914da97acc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.d.mts @@ -0,0 +1,51 @@ +import { StringIterator } from "../_internal/StringIterator.mjs"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/array/reject.d.ts +/** + * 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 collection The string to iterate over + * @param [predicate] The function invoked per iteration + * @returns 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 collection The array-like to iterate over + * @param [predicate] The function invoked per iteration + * @returns 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 collection The object to iterate over + * @param [predicate] The function invoked per iteration + * @returns 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; +//#endregion +export { reject }; \ No newline at end of file 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..8f09da720c8166f801f9786bad606c33b1127546 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.d.ts @@ -0,0 +1,51 @@ +import { StringIterator } from "../_internal/StringIterator.js"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/array/reject.d.ts +/** + * 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 collection The string to iterate over + * @param [predicate] The function invoked per iteration + * @returns 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 collection The array-like to iterate over + * @param [predicate] The function invoked per iteration + * @returns 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 collection The object to iterate over + * @param [predicate] The function invoked per iteration + * @returns 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; +//#endregion +export { reject }; \ No newline at end of file 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..94ae19bf43680d511e62ad8bd61c652429aaa407 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.js @@ -0,0 +1,32 @@ +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_filter = require("./filter.js"); +const require_negate = require("../function/negate.js"); +//#region src/compat/array/reject.ts +/** +* 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 source - The array or object to iterate over. +* @param [predicate=identity] - The function invoked per iteration. +* @returns Returns a new array of elements that do not satisfy the predicate. +* +* @example +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [{ b: 1 }] +* +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [{ a: 1 }, { a: 2 }] +* +* 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 }] +* +* reject([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [{ a: 1 }, { a: 3 }] +*/ +function reject(source, predicate = require_identity.identity) { + return require_filter.filter(source, require_negate.negate(require_iteratee.iteratee(predicate))); +} +//#endregion +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..c0bf1991b60ce819b48171db58069bd81bd483ef --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reject.mjs @@ -0,0 +1,32 @@ +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { filter } from "./filter.mjs"; +import { negate } from "../function/negate.mjs"; +//#region src/compat/array/reject.ts +/** +* 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 source - The array or object to iterate over. +* @param [predicate=identity] - The function invoked per iteration. +* @returns Returns a new array of elements that do not satisfy the predicate. +* +* @example +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [{ b: 1 }] +* +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [{ a: 1 }, { a: 2 }] +* +* 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 }] +* +* reject([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [{ a: 1 }, { a: 3 }] +*/ +function reject(source, predicate = identity) { + return filter(source, negate(iteratee(predicate))); +} +//#endregion +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..b1d3915e1b0dd32f01849f07ee766c97945870ef --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.d.mts @@ -0,0 +1,22 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/remove.d.ts +/** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. + * + * @template L + * @param array - The array to modify. + * @param [predicate] - The function invoked per iteration. + * @returns 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; +//#endregion +export { remove }; \ No newline at end of file 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..a9313237eda05b2f5bb72fe20afc4e4822e98773 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.d.ts @@ -0,0 +1,22 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/remove.d.ts +/** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. + * + * @template L + * @param array - The array to modify. + * @param [predicate] - The function invoked per iteration. + * @returns 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; +//#endregion +export { remove }; \ No newline at end of file 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..7ea9e7e26e6b8748340d457a4c2d852fe481e91e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.js @@ -0,0 +1,36 @@ +const require_remove = require("../../array/remove.js"); +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/remove.ts +/** +* Removes elements from an array based on various criteria. +* +* @param arr - The array to iterate over. +* @param shouldRemoveElement - The function invoked per iteration, a partial object, a property-value pair, or a key to match against each element. +* @returns Returns the modified array with the specified elements removed. +* +* @example +* // Using a predicate function +* const numbers = [1, 2, 3, 4, 5]; +* remove(numbers, value => value % 2 === 0); // => [1, 3, 5] +* +* @example +* // Using a partial object +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property-value pair +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property key +* const objects = [{ a: 0 }, { a: 1 }]; +* remove(objects, 'a'); // => [{ a: 0 }] +*/ +function remove(arr, shouldRemoveElement = require_identity.identity) { + return require_remove.remove(arr, require_iteratee.iteratee(shouldRemoveElement)); +} +//#endregion +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..655366ca3e338ce7b2a54bffafdcad80aa609f34 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/remove.mjs @@ -0,0 +1,36 @@ +import { remove as remove$1 } from "../../array/remove.mjs"; +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/remove.ts +/** +* Removes elements from an array based on various criteria. +* +* @param arr - The array to iterate over. +* @param shouldRemoveElement - The function invoked per iteration, a partial object, a property-value pair, or a key to match against each element. +* @returns Returns the modified array with the specified elements removed. +* +* @example +* // Using a predicate function +* const numbers = [1, 2, 3, 4, 5]; +* remove(numbers, value => value % 2 === 0); // => [1, 3, 5] +* +* @example +* // Using a partial object +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property-value pair +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property key +* const objects = [{ a: 0 }, { a: 1 }]; +* remove(objects, 'a'); // => [{ a: 0 }] +*/ +function remove(arr, shouldRemoveElement = identity) { + return remove$1(arr, iteratee(shouldRemoveElement)); +} +//#endregion +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..573cd50d90a2ee9943a1b6cc373b5930b6bf3ed8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.d.mts @@ -0,0 +1,19 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/reverse.d.ts +/** + * Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on. + * + * @template L + * @param array - The array to reverse. + * @returns Returns `array`. + * + * @example + * const array = [1, 2, 3]; + * reverse(array); + * // => [3, 2, 1] + */ +declare function reverse>(array: RejectReadonly): L; +//#endregion +export { reverse }; \ No newline at end of file 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..d54f266b82a795ff623f5bd53e4c8fd68061549f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.d.ts @@ -0,0 +1,19 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/reverse.d.ts +/** + * Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on. + * + * @template L + * @param array - The array to reverse. + * @returns Returns `array`. + * + * @example + * const array = [1, 2, 3]; + * reverse(array); + * // => [3, 2, 1] + */ +declare function reverse>(array: RejectReadonly): L; +//#endregion +export { reverse }; \ No newline at end of file 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..e3e600b59c6e695fbbe736582ea0f68c3d0f9268 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.js @@ -0,0 +1,28 @@ +//#region src/compat/array/reverse.ts +/** +* Reverses the elements of an array in place. +* +* This function takes an array and reverses its elements in place, modifying the original array. +* If the input is `null` or `undefined`, it returns the input as is. +* +* @template T - The type of elements in the array. +* @param array - The array to reverse. If `null` or `undefined`, the input is returned as is. +* @returns The reversed array, or `null`/`undefined` if the input was `null`/`undefined`. +* +* @example +* const array = [1, 2, 3, 4, 5]; +* const reversedArray = reverse(array); +* // reversedArray is [5, 4, 3, 2, 1], and array is also modified to [5, 4, 3, 2, 1]. +* +* const emptyArray = reverse([]); +* // emptyArray is []. +* +* const nullArray = reverse(null); +* // nullArray is null. +*/ +function reverse(array) { + if (array == null) return array; + return array.reverse(); +} +//#endregion +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..8ec993211272eba46df7b3f995713bcc9af6cc5b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/reverse.mjs @@ -0,0 +1,28 @@ +//#region src/compat/array/reverse.ts +/** +* Reverses the elements of an array in place. +* +* This function takes an array and reverses its elements in place, modifying the original array. +* If the input is `null` or `undefined`, it returns the input as is. +* +* @template T - The type of elements in the array. +* @param array - The array to reverse. If `null` or `undefined`, the input is returned as is. +* @returns The reversed array, or `null`/`undefined` if the input was `null`/`undefined`. +* +* @example +* const array = [1, 2, 3, 4, 5]; +* const reversedArray = reverse(array); +* // reversedArray is [5, 4, 3, 2, 1], and array is also modified to [5, 4, 3, 2, 1]. +* +* const emptyArray = reverse([]); +* // emptyArray is []. +* +* const nullArray = reverse(null); +* // nullArray is null. +*/ +function reverse(array) { + if (array == null) return array; + return array.reverse(); +} +//#endregion +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..7c8f318515717682f58d85d5fd38a20afa7d0e96 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.d.mts @@ -0,0 +1,39 @@ +//#region src/compat/array/sample.d.ts +/** + * Gets a random element from collection. + * + * @template T + * @param collection - The collection to sample. + * @returns 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 collection - The collection to sample. + * @returns 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 collection - The collection to sample. + * @returns Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: T | null | undefined): T[keyof T] | undefined; +//#endregion +export { sample }; \ No newline at end of file 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..7c8f318515717682f58d85d5fd38a20afa7d0e96 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.d.ts @@ -0,0 +1,39 @@ +//#region src/compat/array/sample.d.ts +/** + * Gets a random element from collection. + * + * @template T + * @param collection - The collection to sample. + * @returns 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 collection - The collection to sample. + * @returns 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 collection - The collection to sample. + * @returns Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: T | null | undefined): T[keyof T] | undefined; +//#endregion +export { sample }; \ No newline at end of file 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..06be3cecec8a24113679c79fbc674cbbfca16de6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.js @@ -0,0 +1,21 @@ +const require_sample = require("../../array/sample.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/sample.ts +/** +* The implementation for the overloaded sample function. +* +* This function takes an array, string, or object and returns a single element selected randomly. +* If the input is empty, or if it's null or undefined, the function returns `undefined`. +* +* @template T - The type of elements in the collection. +* @param collection - The collection to sample from. +* @returns A random element from the collection, or `undefined` if the collection is empty or invalid. +*/ +function sample(collection) { + if (collection == null) return; + if (require_isArrayLike.isArrayLike(collection)) return require_sample.sample(require_toArray.toArray(collection)); + return require_sample.sample(Object.values(collection)); +} +//#endregion +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..afb315703236e72f8f6c1b48624c2ba45338dd9f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sample.mjs @@ -0,0 +1,21 @@ +import { sample as sample$1 } from "../../array/sample.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/sample.ts +/** +* The implementation for the overloaded sample function. +* +* This function takes an array, string, or object and returns a single element selected randomly. +* If the input is empty, or if it's null or undefined, the function returns `undefined`. +* +* @template T - The type of elements in the collection. +* @param collection - The collection to sample from. +* @returns A random element from the collection, or `undefined` if the collection is empty or invalid. +*/ +function sample(collection) { + if (collection == null) return; + if (isArrayLike(collection)) return sample$1(toArray(collection)); + return sample$1(Object.values(collection)); +} +//#endregion +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..3543f4abfc0496061d74fa5df33a33ef7a04b4bc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts @@ -0,0 +1,29 @@ +//#region src/compat/array/sampleSize.d.ts +/** + * Returns a sample element array of a specified size from a collection. + * + * @template T + * @param collection - The collection to sample from. + * @param [n] - The size of sample. + * @returns 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 collection - The object to sample from. + * @param [n] - The size of sample. + * @returns 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; +//#endregion +export { sampleSize }; \ No newline at end of file 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..3543f4abfc0496061d74fa5df33a33ef7a04b4bc --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts @@ -0,0 +1,29 @@ +//#region src/compat/array/sampleSize.d.ts +/** + * Returns a sample element array of a specified size from a collection. + * + * @template T + * @param collection - The collection to sample from. + * @param [n] - The size of sample. + * @returns 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 collection - The object to sample from. + * @param [n] - The size of sample. + * @returns 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; +//#endregion +export { sampleSize }; \ No newline at end of file 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..c80ae5337c2d43125be8cec715c9987c8f68d5c4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.js @@ -0,0 +1,31 @@ +const require_sampleSize = require("../../array/sampleSize.js"); +const require_toInteger = require("../util/toInteger.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +const require_clamp = require("../math/clamp.js"); +const require_toArray = require("../util/toArray.js"); +//#region src/compat/array/sampleSize.ts +/** +* 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 collection - The array to sample from. +* @param size - The size of sample. +* @returns A new array with sample size applied. +* +* @example +* const result = sampleSize([1, 2, 3], 2) +* // result will be an array containing two of the elements from the collection. +* // [1, 2] or [1, 3] or [2, 3] +*/ +function sampleSize(collection, size, guard) { + const arrayCollection = require_toArray.toArray(collection); + if (guard ? require_isIterateeCall.isIterateeCall(collection, size, guard) : size === void 0) size = 1; + else size = require_clamp.clamp(require_toInteger.toInteger(size), 0, arrayCollection.length); + return require_sampleSize.sampleSize(arrayCollection, size); +} +//#endregion +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..1f45e680c076c4e1c3b3ab779f8fef163ac35f45 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sampleSize.mjs @@ -0,0 +1,31 @@ +import { sampleSize as sampleSize$1 } from "../../array/sampleSize.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +import { clamp } from "../math/clamp.mjs"; +import { toArray } from "../util/toArray.mjs"; +//#region src/compat/array/sampleSize.ts +/** +* 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 collection - The array to sample from. +* @param size - The size of sample. +* @returns A new array with sample size applied. +* +* @example +* const result = sampleSize([1, 2, 3], 2) +* // result will be an array containing two of the elements from the collection. +* // [1, 2] or [1, 3] or [2, 3] +*/ +function sampleSize(collection, size, guard) { + const arrayCollection = toArray(collection); + if (guard ? isIterateeCall(collection, size, guard) : size === void 0) size = 1; + else size = clamp(toInteger(size), 0, arrayCollection.length); + return sampleSize$1(arrayCollection, size); +} +//#endregion +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..614d009fa50ad79ed2a2c8f87895a79eb1aab197 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/array/shuffle.d.ts +/** + * 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 array - The `array` to shuffle. + * @returns 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 object - The `object` to shuffle. + * @returns A new `Array` with the values of the `object` shuffled in a random order. + */ +declare function shuffle(object: T | null | undefined): Array; +//#endregion +export { shuffle }; \ No newline at end of file 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..614d009fa50ad79ed2a2c8f87895a79eb1aab197 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/array/shuffle.d.ts +/** + * 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 array - The `array` to shuffle. + * @returns 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 object - The `object` to shuffle. + * @returns A new `Array` with the values of the `object` shuffled in a random order. + */ +declare function shuffle(object: T | null | undefined): Array; +//#endregion +export { shuffle }; \ No newline at end of file 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..40102d28a903e4aed5c111e34718b6a18d036f04 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.js @@ -0,0 +1,25 @@ +const require_shuffle = require("../../array/shuffle.js"); +const require_isArray = require("../predicate/isArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isObjectLike = require("../predicate/isObjectLike.js"); +const require_values = require("../object/values.js"); +const require_isNil = require("../predicate/isNil.js"); +//#region src/compat/array/shuffle.ts +/** +* Randomizes the order of elements in an `collection` using the Fisher-Yates algorithm. +* +* This function takes an `collection` and returns a new `collection` with its elements shuffled in a random order. +* +* @template T - The type of elements in the `collection`. +* @param collection - The `collection` to shuffle. +* @returns A new `collection` with its elements shuffled in random order. +*/ +function shuffle(collection) { + if (require_isNil.isNil(collection)) return []; + if (require_isArray.isArray(collection)) return require_shuffle.shuffle(collection); + if (require_isArrayLike.isArrayLike(collection)) return require_shuffle.shuffle(Array.from(collection)); + if (require_isObjectLike.isObjectLike(collection)) return require_shuffle.shuffle(require_values.values(collection)); + return []; +} +//#endregion +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..90f9cac9b7d200e3b211dd8b03a94c4b3e4d17c6 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/shuffle.mjs @@ -0,0 +1,25 @@ +import { shuffle as shuffle$1 } from "../../array/shuffle.mjs"; +import { isArray } from "../predicate/isArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isObjectLike } from "../predicate/isObjectLike.mjs"; +import { values } from "../object/values.mjs"; +import { isNil } from "../predicate/isNil.mjs"; +//#region src/compat/array/shuffle.ts +/** +* Randomizes the order of elements in an `collection` using the Fisher-Yates algorithm. +* +* This function takes an `collection` and returns a new `collection` with its elements shuffled in a random order. +* +* @template T - The type of elements in the `collection`. +* @param collection - The `collection` to shuffle. +* @returns A new `collection` with its elements shuffled in random order. +*/ +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 []; +} +//#endregion +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..c5f3529dbc24042b724bf392df7131881d3525dd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.d.mts @@ -0,0 +1,44 @@ +//#region src/compat/array/size.d.ts +/** + * 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 target - The value whose size is to be determined. It can be an array, string, or object. + * @returns 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 + * + * const arrayLike = { length: 3 }; + * const arrayLikeSize = size(arrayLike); + * // arrayLikeSize will be 3 + */ +declare function size(collection: object | string | null | undefined): number; +//#endregion +export { size }; \ No newline at end of file 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..c5f3529dbc24042b724bf392df7131881d3525dd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.d.ts @@ -0,0 +1,44 @@ +//#region src/compat/array/size.d.ts +/** + * 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 target - The value whose size is to be determined. It can be an array, string, or object. + * @returns 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 + * + * const arrayLike = { length: 3 }; + * const arrayLikeSize = size(arrayLike); + * // arrayLikeSize will be 3 + */ +declare function size(collection: object | string | null | undefined): number; +//#endregion +export { size }; \ No newline at end of file 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..3c9c1e76321347d8346e14b7460e209fbf99b7c7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.js @@ -0,0 +1,13 @@ +const require_isNil = require("../../predicate/isNil.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_regexMultiByte = require("../_internal/regexMultiByte.js"); +//#region src/compat/array/size.ts +function size(target) { + if (require_isNil.isNil(target)) return 0; + if (typeof target === "string") return require_regexMultiByte.regexMultiByte.test(target) ? Array.from(target).length : target.length; + if (require_isArrayLike.isArrayLike(target)) return target.length; + if (target instanceof Map || target instanceof Set) return target.size; + return Object.keys(target).length; +} +//#endregion +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..67f8d0878850451effee7b76ae8de949f416995e --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/size.mjs @@ -0,0 +1,13 @@ +import { isNil } from "../../predicate/isNil.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { regexMultiByte } from "../_internal/regexMultiByte.mjs"; +//#region src/compat/array/size.ts +function size(target) { + if (isNil(target)) return 0; + if (typeof target === "string") return regexMultiByte.test(target) ? Array.from(target).length : target.length; + if (isArrayLike(target)) return target.length; + if (target instanceof Map || target instanceof Set) return target.size; + return Object.keys(target).length; +} +//#endregion +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..cbc759793a34f105514675c97aff3b20ce35b3f9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/array/slice.d.ts +/** + * 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 array - The array to slice. + * @param [start=0] - The start position. + * @param [end=array.length] - The end position. + * @returns 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[]; +//#endregion +export { slice }; \ No newline at end of file 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..cbc759793a34f105514675c97aff3b20ce35b3f9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/array/slice.d.ts +/** + * 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 array - The array to slice. + * @param [start=0] - The start position. + * @param [end=array.length] - The end position. + * @returns 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[]; +//#endregion +export { slice }; \ No newline at end of file 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..246c855cdf3feeb83186dcd3a756690135ad9388 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.js @@ -0,0 +1,40 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +//#region src/compat/array/slice.ts +/** +* 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 array - The array to slice. +* @param [start=0] - The start position. +* @param [end=array.length] - The end position. +* @returns Returns the slice of `array`. +* +* @example +* slice([1, 2, 3], 1, 2); // => [2] +* slice(new Array(3)); // => [undefined, undefined, undefined] +*/ +function slice(array, start, end) { + if (!require_isArrayLike.isArrayLike(array)) return []; + const length = array.length; + if (end === void 0) end = length; + else if (typeof end !== "number" && require_isIterateeCall.isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + start = require_toInteger.toInteger(start); + end = require_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; +} +//#endregion +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..23f601c1fd3f45c7185124ae3c77ddfaf05d9b99 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/slice.mjs @@ -0,0 +1,40 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +//#region src/compat/array/slice.ts +/** +* 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 array - The array to slice. +* @param [start=0] - The start position. +* @param [end=array.length] - The end position. +* @returns Returns the slice of `array`. +* +* @example +* slice([1, 2, 3], 1, 2); // => [2] +* slice(new Array(3)); // => [undefined, undefined, undefined] +*/ +function slice(array, start, end) { + if (!isArrayLike(array)) return []; + const length = array.length; + if (end === void 0) 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; +} +//#endregion +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..dbca2ea728ea940fa8d0f823e40f93a5f136c9ce --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.d.mts @@ -0,0 +1,32 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/array/some.d.ts +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param collection - The collection to iterate over. + * @param [predicate] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [predicate] - The function invoked per iteration. + * @returns 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; +//#endregion +export { some }; \ No newline at end of file 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..61ac3d2a7c595a58b84bd496ab506041f67f9a95 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.d.ts @@ -0,0 +1,32 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/array/some.d.ts +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param collection - The collection to iterate over. + * @param [predicate] - The function invoked per iteration. + * @returns 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 collection - The object to iterate over. + * @param [predicate] - The function invoked per iteration. + * @returns 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; +//#endregion +export { some }; \ No newline at end of file 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..7668fda7176d83216b3c5d2600f868fd324c3fae --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.js @@ -0,0 +1,90 @@ +const require_identity = require("../../function/identity.js"); +const require_property = require("../object/property.js"); +const require_matches = require("../predicate/matches.js"); +const require_matchesProperty = require("../predicate/matchesProperty.js"); +//#region src/compat/array/some.ts +/** +* Checks if there is an element in an array that matches the given predicate. +* +* Iteration is stopped once there is an element that matches `predicate`. +* +* @template T +* @param source The source to iterate over. +* @param [predicate=identity] The function invoked per iteration. +* If a property name or an object is provided it will be used to create a predicate function. +* @returns Returns `true` if any element passes the predicate check, else `false`. +* +* @example +* some([1, 2, 3, 4], n => n % 2 === 0); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], { a: 2 }); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], 'a'); +* // => true +* +* some({ a: 1, b: 2, c: 3 }, n => n % 2 === 0); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, { name: 'Bob' }); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, ['name', 'Alice']); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, 'name'); +* // => true +*/ +function some(source, predicate, guard) { + if (!source) return false; + if (guard != null) predicate = void 0; + if (predicate == null) predicate = require_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 = require_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 = require_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 = require_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); + } + } +} +//#endregion +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..65b62fee36464b9bdd0ddbd97a38e974ecb585ab --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/some.mjs @@ -0,0 +1,90 @@ +import { identity } from "../../function/identity.mjs"; +import { property } from "../object/property.mjs"; +import { matches } from "../predicate/matches.mjs"; +import { matchesProperty } from "../predicate/matchesProperty.mjs"; +//#region src/compat/array/some.ts +/** +* Checks if there is an element in an array that matches the given predicate. +* +* Iteration is stopped once there is an element that matches `predicate`. +* +* @template T +* @param source The source to iterate over. +* @param [predicate=identity] The function invoked per iteration. +* If a property name or an object is provided it will be used to create a predicate function. +* @returns Returns `true` if any element passes the predicate check, else `false`. +* +* @example +* some([1, 2, 3, 4], n => n % 2 === 0); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], { a: 2 }); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], 'a'); +* // => true +* +* some({ a: 1, b: 2, c: 3 }, n => n % 2 === 0); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, { name: 'Bob' }); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, ['name', 'Alice']); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, 'name'); +* // => true +*/ +function some(source, predicate, guard) { + if (!source) return false; + if (guard != null) predicate = void 0; + 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); + } + } +} +//#endregion +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..884ae20f665e8b77077503206677da1d4bb4c847 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.d.mts @@ -0,0 +1,74 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.mjs"; +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/array/sortBy.d.ts +/** + * 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 collection - The array of objects to be sorted. + * @param criteria - An array of criteria (property names or property paths or custom key functions) to sort by. + * @returns he 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 collection - The collection to iterate over. + * @param iteratees - The iteratees to sort by. + * @returns 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 collection - The object to iterate over. + * @param iteratees - The iteratees to sort by. + * @returns 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; +//#endregion +export { sortBy }; \ No newline at end of file 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..d95f9ec7fa6cfc20ae6f86de9406b077adc67311 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.d.ts @@ -0,0 +1,74 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.js"; +import { Many } from "../_internal/Many.js"; + +//#region src/compat/array/sortBy.d.ts +/** + * 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 collection - The array of objects to be sorted. + * @param criteria - An array of criteria (property names or property paths or custom key functions) to sort by. + * @returns he 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 collection - The collection to iterate over. + * @param iteratees - The iteratees to sort by. + * @returns 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 collection - The object to iterate over. + * @param iteratees - The iteratees to sort by. + * @returns 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; +//#endregion +export { sortBy }; \ No newline at end of file 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..f475602cbb2853982dd164371de2d95edca3a8f5 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.js @@ -0,0 +1,12 @@ +const require_flatten = require("../../array/flatten.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +const require_orderBy = require("./orderBy.js"); +//#region src/compat/array/sortBy.ts +function sortBy(collection, ...criteria) { + const length = criteria.length; + if (length > 1 && require_isIterateeCall.isIterateeCall(collection, criteria[0], criteria[1])) criteria = []; + else if (length > 2 && require_isIterateeCall.isIterateeCall(criteria[0], criteria[1], criteria[2])) criteria = [criteria[0]]; + return require_orderBy.orderBy(collection, require_flatten.flatten(criteria), ["asc"]); +} +//#endregion +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..98a4da582f6a1028a1ae01bcbf5a9a9d18c717a8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortBy.mjs @@ -0,0 +1,12 @@ +import { flatten } from "../../array/flatten.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +import { orderBy } from "./orderBy.mjs"; +//#region src/compat/array/sortBy.ts +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"]); +} +//#endregion +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..377a413a95ab2f834af48fba57b991f607e0de87 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/array/sortedIndex.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to evaluate. + * @returns 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 array The sorted array to inspect. + * @param value The value to evaluate. + * @returns 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; +//#endregion +export { sortedIndex }; \ No newline at end of file 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..377a413a95ab2f834af48fba57b991f607e0de87 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/array/sortedIndex.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to evaluate. + * @returns 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 array The sorted array to inspect. + * @param value The value to evaluate. + * @returns 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; +//#endregion +export { sortedIndex }; \ No newline at end of file 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..a000a60a63971d3c2de9ad6ae1a42a646d3b0a49 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.js @@ -0,0 +1,36 @@ +const require_isNil = require("../../predicate/isNil.js"); +const require_isNull = require("../../predicate/isNull.js"); +const require_isSymbol = require("../../predicate/isSymbol.js"); +const require_isNumber = require("../predicate/isNumber.js"); +const require_sortedIndexBy = require("./sortedIndexBy.js"); +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* 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 array The sorted array to inspect. +* @param value The value to evaluate. +* @returns Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedIndex([30, 50], 40) +* // => 1 +*/ +function sortedIndex(array, value) { + if (require_isNil.isNil(array)) return 0; + let low = 0; + let high = array.length; + if (require_isNumber.isNumber(value) && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + const mid = low + high >>> 1; + const compute = array[mid]; + if (!require_isNull.isNull(compute) && !require_isSymbol.isSymbol(compute) && compute < value) low = mid + 1; + else high = mid; + } + return high; + } + return require_sortedIndexBy.sortedIndexBy(array, value, (value) => value); +} +//#endregion +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..a5a02b2059d267c5f4425a94f2cfe2bdb408ae5b --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndex.mjs @@ -0,0 +1,36 @@ +import { isNil } from "../../predicate/isNil.mjs"; +import { isNull } from "../../predicate/isNull.mjs"; +import { isSymbol } from "../../predicate/isSymbol.mjs"; +import { isNumber } from "../predicate/isNumber.mjs"; +import { sortedIndexBy } from "./sortedIndexBy.mjs"; +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* 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 array The sorted array to inspect. +* @param value The value to evaluate. +* @returns Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedIndex([30, 50], 40) +* // => 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); +} +//#endregion +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..0a258baa348e852bbdeddb499e46bfed9b5fdecb --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.mts @@ -0,0 +1,26 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/sortedIndexBy.d.ts +/** + * 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 array - The sorted array to inspect. + * @param value - The value to evaluate. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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; +//#endregion +export { sortedIndexBy }; \ No newline at end of file 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..4818d72886d1e334d8ad601dbc32a9e4f8ff6b13 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.ts @@ -0,0 +1,26 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/sortedIndexBy.d.ts +/** + * 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 array - The sorted array to inspect. + * @param value - The value to evaluate. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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; +//#endregion +export { sortedIndexBy }; \ No newline at end of file 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..e8de54f71daf0f68d1223c5f2aa6f3084d0cd2f3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js @@ -0,0 +1,54 @@ +const require_isNull = require("../../predicate/isNull.js"); +const require_isUndefined = require("../../predicate/isUndefined.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isSymbol = require("../predicate/isSymbol.js"); +const require_identity = require("../function/identity.js"); +const require_isNil = require("../predicate/isNil.js"); +const require_isNaN = require("../predicate/isNaN.js"); +const MAX_ARRAY_INDEX = 4294967294; +/** +* 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). +* +* @param array The sorted array to inspect. +* @param value The value to evaluate. +* @param iteratee The iteratee invoked per element. +* @returns Returns the index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 0 +*/ +function sortedIndexBy(array, value, iteratee$1 = require_identity.identity, retHighest) { + if (require_isNil.isNil(array) || array.length === 0) return 0; + let low = 0; + let high = array.length; + const iterateeFunction = require_iteratee.iteratee(iteratee$1); + const transformedValue = iterateeFunction(value); + const valIsNaN = require_isNaN.isNaN(transformedValue); + const valIsNull = require_isNull.isNull(transformedValue); + const valIsSymbol = require_isSymbol.isSymbol(transformedValue); + const valIsUndefined = require_isUndefined.isUndefined(transformedValue); + while (low < high) { + let setLow; + const mid = Math.floor((low + high) / 2); + const computed = iterateeFunction(array[mid]); + const othIsDefined = !require_isUndefined.isUndefined(computed); + const othIsNull = require_isNull.isNull(computed); + const othIsReflexive = !require_isNaN.isNaN(computed); + const othIsSymbol = require_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); +} +//#endregion +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..8cd10ac035122b7d435c14aa7fc8c503952afa86 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs @@ -0,0 +1,54 @@ +import { isNull } from "../../predicate/isNull.mjs"; +import { isUndefined } from "../../predicate/isUndefined.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isSymbol } from "../predicate/isSymbol.mjs"; +import { identity } from "../function/identity.mjs"; +import { isNil } from "../predicate/isNil.mjs"; +import { isNaN } from "../predicate/isNaN.mjs"; +const MAX_ARRAY_INDEX = 4294967294; +/** +* 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). +* +* @param array The sorted array to inspect. +* @param value The value to evaluate. +* @param iteratee The iteratee invoked per element. +* @returns Returns the index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 0 +*/ +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); +} +//#endregion +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..1835ef325d674805c8bfffe593f118cd804e339d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.mts @@ -0,0 +1,35 @@ +//#region src/compat/array/sortedIndexOf.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to search for. + * @returns 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; +//#endregion +export { sortedIndexOf }; \ No newline at end of file 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..1835ef325d674805c8bfffe593f118cd804e339d --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.ts @@ -0,0 +1,35 @@ +//#region src/compat/array/sortedIndexOf.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to search for. + * @returns 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; +//#endregion +export { sortedIndexOf }; \ No newline at end of file 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..8b0139ffb614b7640a48d3f4146e8978852c0284 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.js @@ -0,0 +1,42 @@ +const require_eq = require("../util/eq.js"); +const require_sortedIndex = require("./sortedIndex.js"); +//#region src/compat/array/sortedIndexOf.ts +/** +* 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 array The sorted array to inspect. +* @param value The value to search for. +* @returns 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 +*/ +function sortedIndexOf(array, value) { + if (!array?.length) return -1; + const index = require_sortedIndex.sortedIndex(array, value); + if (index < array.length && require_eq.eq(array[index], value)) return index; + return -1; +} +//#endregion +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..918845e75a157c85f2cc0f57aeeb15d2dd15590c --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.mjs @@ -0,0 +1,42 @@ +import { eq } from "../util/eq.mjs"; +import { sortedIndex } from "./sortedIndex.mjs"; +//#region src/compat/array/sortedIndexOf.ts +/** +* 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 array The sorted array to inspect. +* @param value The value to search for. +* @returns 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 +*/ +function sortedIndexOf(array, value) { + if (!array?.length) return -1; + const index = sortedIndex(array, value); + if (index < array.length && eq(array[index], value)) return index; + return -1; +} +//#endregion +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..cbdd7316542407cfe8bf3df0c44826a5b18916ed --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/array/sortedLastIndex.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedLastIndex([4, 5, 5, 5, 6], 5) + * // => 4 + */ +declare function sortedLastIndex(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedLastIndex }; \ No newline at end of file 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..cbdd7316542407cfe8bf3df0c44826a5b18916ed --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/array/sortedLastIndex.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedLastIndex([4, 5, 5, 5, 6], 5) + * // => 4 + */ +declare function sortedLastIndex(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedLastIndex }; \ No newline at end of file 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..94163e48031d26101f83c607823d0f9cc2cbda8a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.js @@ -0,0 +1,34 @@ +const require_isNil = require("../../predicate/isNil.js"); +const require_isNull = require("../../predicate/isNull.js"); +const require_isSymbol = require("../../predicate/isSymbol.js"); +const require_isNumber = require("../predicate/isNumber.js"); +const require_sortedLastIndexBy = require("./sortedLastIndexBy.js"); +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* 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 array The sorted array to inspect. +* @param value The value to evaluate. +* @returns Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedLastIndex([4, 5, 5, 5, 6], 5) +* // => 4 +*/ +function sortedLastIndex(array, value) { + if (require_isNil.isNil(array)) return 0; + let high = array.length; + if (!require_isNumber.isNumber(value) || Number.isNaN(value) || high > HALF_MAX_ARRAY_LENGTH) return require_sortedLastIndexBy.sortedLastIndexBy(array, value, (value) => value); + let low = 0; + while (low < high) { + const mid = low + high >>> 1; + const compute = array[mid]; + if (!require_isNull.isNull(compute) && !require_isSymbol.isSymbol(compute) && compute <= value) low = mid + 1; + else high = mid; + } + return high; +} +//#endregion +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..94ebf415d0c5b8274331bf26a9d183bff550bbf3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.mjs @@ -0,0 +1,34 @@ +import { isNil } from "../../predicate/isNil.mjs"; +import { isNull } from "../../predicate/isNull.mjs"; +import { isSymbol } from "../../predicate/isSymbol.mjs"; +import { isNumber } from "../predicate/isNumber.mjs"; +import { sortedLastIndexBy } from "./sortedLastIndexBy.mjs"; +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* 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 array The sorted array to inspect. +* @param value The value to evaluate. +* @returns Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedLastIndex([4, 5, 5, 5, 6], 5) +* // => 4 +*/ +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; +} +//#endregion +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..81499a6b4c814d08a73c80ecd677c8d7e453d4ab --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.mts @@ -0,0 +1,21 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/sortedLastIndexBy.d.ts +/** + * 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 array - The sorted array to inspect. + * @param value - The value to evaluate. + * @param iteratee - The iteratee invoked per element. + * @returns 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; +//#endregion +export { sortedLastIndexBy }; \ No newline at end of file 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..9933fa23eea7789f11f5f9e754d1a59afe48b1c8 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.ts @@ -0,0 +1,21 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/sortedLastIndexBy.d.ts +/** + * 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 array - The sorted array to inspect. + * @param value - The value to evaluate. + * @param iteratee - The iteratee invoked per element. + * @returns 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; +//#endregion +export { sortedLastIndexBy }; \ No newline at end of file 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..9466aa7ff6b4010f2199f911fa2ca16778c265bd --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.js @@ -0,0 +1,22 @@ +const require_sortedIndexBy = require("./sortedIndexBy.js"); +//#region src/compat/array/sortedLastIndexBy.ts +/** +* 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). +* +* @param array The sorted array to inspect. +* @param value The value to evaluate. +* @param iteratee The iteratee invoked per element. +* @returns Returns the highest index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedLastIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 1 +*/ +function sortedLastIndexBy(array, value, iteratee) { + return require_sortedIndexBy.sortedIndexBy(array, value, iteratee, true); +} +//#endregion +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..c948e84cb521d38c38db3ddc6ec82412397d6d02 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs @@ -0,0 +1,22 @@ +import { sortedIndexBy } from "./sortedIndexBy.mjs"; +//#region src/compat/array/sortedLastIndexBy.ts +/** +* 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). +* +* @param array The sorted array to inspect. +* @param value The value to evaluate. +* @param iteratee The iteratee invoked per element. +* @returns Returns the highest index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedLastIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 1 +*/ +function sortedLastIndexBy(array, value, iteratee) { + return sortedIndexBy(array, value, iteratee, true); +} +//#endregion +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..e5166fb381669f1dea36ae8782d319c4ef573d63 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.mts @@ -0,0 +1,36 @@ +//#region src/compat/array/sortedLastIndexOf.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to search for. + * @returns 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; +//#endregion +export { sortedLastIndexOf }; \ No newline at end of file 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..e5166fb381669f1dea36ae8782d319c4ef573d63 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.ts @@ -0,0 +1,36 @@ +//#region src/compat/array/sortedLastIndexOf.d.ts +/** + * 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 array The sorted array to inspect. + * @param value The value to search for. + * @returns 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; +//#endregion +export { sortedLastIndexOf }; \ No newline at end of file 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..dcc8b837b658f99ee173d94b5cfd92d836124c42 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.js @@ -0,0 +1,43 @@ +const require_eq = require("../util/eq.js"); +const require_sortedLastIndex = require("./sortedLastIndex.js"); +//#region src/compat/array/sortedLastIndexOf.ts +/** +* 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 array The sorted array to inspect. +* @param value The value to search for. +* @returns 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 +*/ +function sortedLastIndexOf(array, value) { + if (!array?.length) return -1; + const index = require_sortedLastIndex.sortedLastIndex(array, value) - 1; + if (index >= 0 && require_eq.eq(array[index], value)) return index; + return -1; +} +//#endregion +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..0f52fa3673ffceb9ce619a6602f670c02a0d9331 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs @@ -0,0 +1,43 @@ +import { eq } from "../util/eq.mjs"; +import { sortedLastIndex } from "./sortedLastIndex.mjs"; +//#region src/compat/array/sortedLastIndexOf.ts +/** +* 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 array The sorted array to inspect. +* @param value The value to search for. +* @returns 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 +*/ +function sortedLastIndexOf(array, value) { + if (!array?.length) return -1; + const index = sortedLastIndex(array, value) - 1; + if (index >= 0 && eq(array[index], value)) return index; + return -1; +} +//#endregion +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..56b5e01d5f6ca3e79670ad2edb69dcbe67b4c7f7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/array/tail.d.ts +/** + * Gets all but the first element of array. + * + * @template T + * @param array - The array to query. + * @returns 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 array - The array to query. + * @returns Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: ArrayLike | null | undefined): T[]; +//#endregion +export { tail }; \ No newline at end of file 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..56b5e01d5f6ca3e79670ad2edb69dcbe67b4c7f7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/array/tail.d.ts +/** + * Gets all but the first element of array. + * + * @template T + * @param array - The array to query. + * @returns 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 array - The array to query. + * @returns Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: ArrayLike | null | undefined): T[]; +//#endregion +export { tail }; \ No newline at end of file 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..db7129b02c548fb9c516731c4d6e118c51655221 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.js @@ -0,0 +1,34 @@ +const require_tail = require("../../array/tail.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/tail.ts +/** +* 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 arr - The array to get the tail of. +* @returns 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 [] +*/ +function tail(arr) { + if (!require_isArrayLike.isArrayLike(arr)) return []; + return require_tail.tail(require_toArray.toArray(arr)); +} +//#endregion +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..aab4e9b18df3720c1b50c4aa0629616410571787 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/tail.mjs @@ -0,0 +1,34 @@ +import { tail as tail$1 } from "../../array/tail.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/tail.ts +/** +* 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 arr - The array to get the tail of. +* @returns 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 [] +*/ +function tail(arr) { + if (!isArrayLike(arr)) return []; + return tail$1(toArray(arr)); +} +//#endregion +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..d6ce922c6f41fcd92c818980f69e16c933889ea3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/array/take.d.ts +/** + * Creates a slice of array with n elements taken from the beginning. + * + * @template T + * @param array - The array to query. + * @param [n=1] - The number of elements to take. + * @returns 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[]; +//#endregion +export { take }; \ No newline at end of file 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..d6ce922c6f41fcd92c818980f69e16c933889ea3 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/array/take.d.ts +/** + * Creates a slice of array with n elements taken from the beginning. + * + * @template T + * @param array - The array to query. + * @param [n=1] - The number of elements to take. + * @returns 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[]; +//#endregion +export { take }; \ No newline at end of file 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..d867b115a47a7f145008718ccd779948df3b8c59 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.js @@ -0,0 +1,35 @@ +const require_take = require("../../array/take.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/array/take.ts +/** +* 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 arr - The array to take elements from. +* @param [count=1] - The number of elements to take. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns 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); +*/ +function take(arr, count = 1, guard) { + count = guard || count === void 0 ? 1 : require_toInteger.toInteger(count); + if (count < 1 || !require_isArrayLike.isArrayLike(arr)) return []; + return require_take.take(require_toArray.toArray(arr), count); +} +//#endregion +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..d6d9e17b2b751b8271970459546768339a0d6cf2 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/take.mjs @@ -0,0 +1,35 @@ +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"; +//#region src/compat/array/take.ts +/** +* 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 arr - The array to take elements from. +* @param [count=1] - The number of elements to take. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns 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); +*/ +function take(arr, count = 1, guard) { + count = guard || count === void 0 ? 1 : toInteger(count); + if (count < 1 || !isArrayLike(arr)) return []; + return take$1(toArray(arr), count); +} +//#endregion +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..6f5498981845116569b71b15a14f8dd0b262cd7a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/array/takeRight.d.ts +/** + * Creates a slice of array with n elements taken from the end. + * + * @template T + * @param array - The array to query. + * @param [n=1] - The number of elements to take. + * @returns 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[]; +//#endregion +export { takeRight }; \ No newline at end of file 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..6f5498981845116569b71b15a14f8dd0b262cd7a --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/array/takeRight.d.ts +/** + * Creates a slice of array with n elements taken from the end. + * + * @template T + * @param array - The array to query. + * @param [n=1] - The number of elements to take. + * @returns 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[]; +//#endregion +export { takeRight }; \ No newline at end of file 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..8b8f0c1d109b46188f6ffa7965b619e4c3fe3065 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.js @@ -0,0 +1,34 @@ +const require_takeRight = require("../../array/takeRight.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/array/takeRight.ts +/** +* 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 arr - The array to take elements from. +* @param [count=1] - The number of elements to take. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns 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); +*/ +function takeRight(arr, count = 1, guard) { + count = guard ? 1 : require_toInteger.toInteger(count); + if (count <= 0 || !require_isArrayLike.isArrayLike(arr)) return []; + return require_takeRight.takeRight(require_toArray.toArray(arr), count); +} +//#endregion +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..ae2b5a84afc9c75851de3ac0347cb0e3191673af --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRight.mjs @@ -0,0 +1,34 @@ +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"; +//#region src/compat/array/takeRight.ts +/** +* 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 arr - The array to take elements from. +* @param [count=1] - The number of elements to take. +* @param [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns 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); +*/ +function takeRight(arr, count = 1, guard) { + count = guard ? 1 : toInteger(count); + if (count <= 0 || !isArrayLike(arr)) return []; + return takeRight$1(toArray(arr), count); +} +//#endregion +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..ad7a4fa65bb168c83a950533fff9c73c2ba67821 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.mts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; + +//#region src/compat/array/takeRightWhile.d.ts +/** + * 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 array - The array to query. + * @param [predicate] - The function invoked per iteration. + * @returns 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[]; +//#endregion +export { takeRightWhile }; \ No newline at end of file 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..16cd73b95ed5d6c183904e669c81863528322dec --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; + +//#region src/compat/array/takeRightWhile.d.ts +/** + * 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 array - The array to query. + * @param [predicate] - The function invoked per iteration. + * @returns 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[]; +//#endregion +export { takeRightWhile }; \ No newline at end of file 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..feb333b0004e8af74aa60aeff0d5a9271482bb27 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js @@ -0,0 +1,59 @@ +const require_identity = require("../../function/identity.js"); +const require_negate = require("../../function/negate.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/takeRightWhile.ts +/** +* Creates a slice of the array with elements taken from the end while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param array - The array to process. +* @param [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns A slice of the array with elements taken from the end or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeRightWhile(items, (item) => item > 3); +* console.log(result); // [4, 5] +* +* // Using a partial object +* const items2 = [{ id: 10 }, { id: 20 }, { id: 30 }]; +* const result2 = takeRightWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeRightWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: false }, { active: true }, { active: true }]; +* const result4 = takeRightWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [false, true]; +* const result5 = takeRightWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeRightWhile(null); +* console.log(result6); // [] +*/ +function takeRightWhile(_array, predicate) { + if (!require_isArrayLikeObject.isArrayLikeObject(_array)) return []; + const array = require_toArray.toArray(_array); + const index = array.findLastIndex(require_negate.negate(require_iteratee.iteratee(predicate ?? require_identity.identity))); + return array.slice(index + 1); +} +//#endregion +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..e75eaacb08a6055e2732d4bdf1066474b4f05d48 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs @@ -0,0 +1,59 @@ +import { identity } from "../../function/identity.mjs"; +import { negate } from "../../function/negate.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/takeRightWhile.ts +/** +* Creates a slice of the array with elements taken from the end while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param array - The array to process. +* @param [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns A slice of the array with elements taken from the end or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeRightWhile(items, (item) => item > 3); +* console.log(result); // [4, 5] +* +* // Using a partial object +* const items2 = [{ id: 10 }, { id: 20 }, { id: 30 }]; +* const result2 = takeRightWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeRightWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: false }, { active: true }, { active: true }]; +* const result4 = takeRightWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [false, true]; +* const result5 = takeRightWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeRightWhile(null); +* console.log(result6); // [] +*/ +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); +} +//#endregion +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..593691a153c97898c26baefc67d784a7c45f0c7f --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.d.mts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; + +//#region src/compat/array/takeWhile.d.ts +/** + * 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 array - The array to query. + * @param [predicate] - The function invoked per iteration. + * @returns 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[]; +//#endregion +export { takeWhile }; \ No newline at end of file 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..9d58d0d1f0f81d83121ac2f6f1a18f8ee76c0343 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.d.ts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; + +//#region src/compat/array/takeWhile.d.ts +/** + * 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 array - The array to query. + * @param [predicate] - The function invoked per iteration. + * @returns 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[]; +//#endregion +export { takeWhile }; \ No newline at end of file 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..fc026d971bdf836538cf605b5f9ce8b827a62ada --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.js @@ -0,0 +1,59 @@ +const require_toArray = require("../_internal/toArray.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_identity = require("../function/identity.js"); +const require_negate = require("../function/negate.js"); +//#region src/compat/array/takeWhile.ts +/** +* Creates a slice of the array with elements taken from the beginning while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param array - The array to process. +* @param [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns A slice of the array with elements taken from the beginning or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeWhile(items, (item) => item < 3); +* console.log(result); // [1, 2] +* +* // Using a partial object +* const items2 = [{ id: 30 }, { id: 20 }, { id: 10 }]; +* const result2 = takeWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: true }, { active: true }, { active: false }]; +* const result4 = takeWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [true, false]; +* const result5 = takeWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeWhile(null); +* console.log(result6); // [] +**/ +function takeWhile(array, predicate) { + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + const _array = require_toArray.toArray(array); + const index = _array.findIndex(require_negate.negate(require_iteratee.iteratee(predicate ?? require_identity.identity))); + return index === -1 ? _array : _array.slice(0, index); +} +//#endregion +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..6e5e07cb9de349741da6102841f03e781a2f8fd1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/takeWhile.mjs @@ -0,0 +1,59 @@ +import { toArray } from "../_internal/toArray.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { identity } from "../function/identity.mjs"; +import { negate } from "../function/negate.mjs"; +//#region src/compat/array/takeWhile.ts +/** +* Creates a slice of the array with elements taken from the beginning while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param array - The array to process. +* @param [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns A slice of the array with elements taken from the beginning or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeWhile(items, (item) => item < 3); +* console.log(result); // [1, 2] +* +* // Using a partial object +* const items2 = [{ id: 30 }, { id: 20 }, { id: 10 }]; +* const result2 = takeWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: true }, { active: true }, { active: false }]; +* const result4 = takeWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [true, false]; +* const result5 = takeWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeWhile(null); +* console.log(result6); // [] +**/ +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); +} +//#endregion +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..3f65dd97c7102686bd471beb5eaf736c95c74fb0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/array/union.d.ts +/** + * 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 arrays - The arrays to inspect. + * @returns 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[]; +//#endregion +export { union }; \ No newline at end of file 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..3f65dd97c7102686bd471beb5eaf736c95c74fb0 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/array/union.d.ts +/** + * 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 arrays - The arrays to inspect. + * @returns 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[]; +//#endregion +export { union }; \ No newline at end of file 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..41b7608b65cd6ecf1ff38057cab2dea490d57df7 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.js @@ -0,0 +1,38 @@ +const require_uniq = require("../../array/uniq.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_flatMapDepth = require("./flatMapDepth.js"); +//#region src/compat/array/union.ts +/** +* 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 arrays - The arrays to inspect. +* @returns 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]); +*/ +function union(...arrays) { + const validArrays = arrays.filter(require_isArrayLikeObject.isArrayLikeObject); + const flattened = require_flatMapDepth.flatMapDepth(validArrays, (v) => Array.from(v), 1); + return require_uniq.uniq(flattened); +} +//#endregion +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..95640db09b9854bdf446a4ec5890d49a7cf02c19 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/union.mjs @@ -0,0 +1,36 @@ +import { uniq } from "../../array/uniq.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { flatMapDepth } from "./flatMapDepth.mjs"; +//#region src/compat/array/union.ts +/** +* 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 arrays - The arrays to inspect. +* @returns 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]); +*/ +function union(...arrays) { + return uniq(flatMapDepth(arrays.filter(isArrayLikeObject), (v) => Array.from(v), 1)); +} +//#endregion +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..85590f6a3a97ad5b146aac138d0a4555b30838ff --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.d.mts @@ -0,0 +1,94 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/unionBy.d.ts +/** + * 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 arrays - The arrays to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param arrays4 - The fourth array to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param arrays4 - The fourth array to inspect. + * @param arrays5 - The fifth array to inspect. + * @param iteratee - The iteratee invoked per element. + * @returns 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[]; +//#endregion +export { unionBy }; \ No newline at end of file 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..3d4285220dd73159e34137e1ee83bf110f4b04e1 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.d.ts @@ -0,0 +1,94 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/unionBy.d.ts +/** + * 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 arrays - The arrays to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param arrays4 - The fourth array to inspect. + * @param [iteratee] - The iteratee invoked per element. + * @returns 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 arrays1 - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param arrays4 - The fourth array to inspect. + * @param arrays5 - The fifth array to inspect. + * @param iteratee - The iteratee invoked per element. + * @returns 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[]; +//#endregion +export { unionBy }; \ No newline at end of file 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..5f32ab0138582c863c453f5ddefd8c39fffe0a50 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.js @@ -0,0 +1,37 @@ +const require_last = require("../../array/last.js"); +const require_uniq = require("../../array/uniq.js"); +const require_uniqBy = require("../../array/uniqBy.js"); +const require_ary = require("../../function/ary.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_flattenArrayLike = require("../_internal/flattenArrayLike.js"); +//#region src/compat/array/unionBy.ts +/** +* 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. +* An iteratee function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param values - The arrays to inspect, or the iteratee function. +* @returns Returns the new array of combined unique values. +* +* @example +* // Returns [2.1, 1.2] +* unionBy([2.1], [1.2, 2.3], Math.floor); +* +* @example +* // Returns [{ x: 1 }, { x: 2 }] +* unionBy([{ x: 1 }], [{ x: 2 }, { x: 1 }], 'x'); +* +* @example +* // Returns [{ x: 1, y: 1 }] +* unionBy([{ x: 1, y: 1 }], [{ x: 1, y: 2 }], 'x'); +*/ +function unionBy(...values) { + const lastValue = require_last.last(values); + const flattened = require_flattenArrayLike.flattenArrayLike(values); + if (require_isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) return require_uniq.uniq(flattened); + return require_uniqBy.uniqBy(flattened, require_ary.ary(require_iteratee.iteratee(lastValue), 1)); +} +//#endregion +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..6b8c05359bea74e63001b995e32bb51b0dcd0ce9 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionBy.mjs @@ -0,0 +1,37 @@ +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 { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { flattenArrayLike } from "../_internal/flattenArrayLike.mjs"; +//#region src/compat/array/unionBy.ts +/** +* 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. +* An iteratee function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param values - The arrays to inspect, or the iteratee function. +* @returns Returns the new array of combined unique values. +* +* @example +* // Returns [2.1, 1.2] +* unionBy([2.1], [1.2, 2.3], Math.floor); +* +* @example +* // Returns [{ x: 1 }, { x: 2 }] +* unionBy([{ x: 1 }], [{ x: 2 }, { x: 1 }], 'x'); +* +* @example +* // Returns [{ x: 1, y: 1 }] +* unionBy([{ x: 1, y: 1 }], [{ x: 1, y: 2 }], 'x'); +*/ +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)); +} +//#endregion +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..6d5f3aeeadf03a012b6a542a78cfdec29f0fe135 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.d.mts @@ -0,0 +1,53 @@ +//#region src/compat/array/unionWith.d.ts +/** + * 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 arrays - The arrays to inspect. + * @param [comparator] - The comparator invoked per element. + * @returns 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 arrays - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param [comparator] - The comparator invoked per element. + * @returns 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 arrays - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param comparator - The comparator invoked per element. + * @returns 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[]; +//#endregion +export { unionWith }; \ No newline at end of file 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..6d5f3aeeadf03a012b6a542a78cfdec29f0fe135 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.d.ts @@ -0,0 +1,53 @@ +//#region src/compat/array/unionWith.d.ts +/** + * 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 arrays - The arrays to inspect. + * @param [comparator] - The comparator invoked per element. + * @returns 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 arrays - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param [comparator] - The comparator invoked per element. + * @returns 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 arrays - The first array to inspect. + * @param arrays2 - The second array to inspect. + * @param arrays3 - The third array to inspect. + * @param comparator - The comparator invoked per element. + * @returns 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[]; +//#endregion +export { unionWith }; \ No newline at end of file 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..3182e3e0b45d5b5356e58f611aca3142adc49cf4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.js @@ -0,0 +1,41 @@ +const require_last = require("../../array/last.js"); +const require_uniq = require("../../array/uniq.js"); +const require_uniqWith = require("../../array/uniqWith.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_flattenArrayLike = require("../_internal/flattenArrayLike.js"); +//#region src/compat/array/unionWith.ts +/** +* 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. +* A comparator function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param values - The arrays to inspect, or the comparator function. +* @returns Returns the new array of combined unique values. +* +* @example +* const objects = [ +* { x: 1, y: 2 }, +* { x: 2, y: 1 }, +* ]; +* const others = [ +* { x: 1, y: 1 }, +* { x: 1, y: 2 }, +* ]; +* // Returns [objects[0], objects[1], others[0]] +* unionWith(objects, others, isEqual); +* +* @example +* const objects = [{ x: 1, y: 1 }]; +* const others = [{ x: 1, y: 2 }]; +* // Returns [{ x: 1, y: 1 }] +* unionWith(objects, others, (a, b) => a.x === b.x); +*/ +function unionWith(...values) { + const lastValue = require_last.last(values); + const flattened = require_flattenArrayLike.flattenArrayLike(values); + if (require_isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) return require_uniq.uniq(flattened); + return require_uniqWith.uniqWith(flattened, lastValue); +} +//#endregion +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..18c1adabdd5a0a1f8d403c81fc612c03e90740d4 --- /dev/null +++ b/node_modules/es-toolkit/dist/compat/array/unionWith.mjs @@ -0,0 +1,41 @@ +import { last } from "../../array/last.mjs"; +import { uniq } from "../../array/uniq.mjs"; +import { uniqWith } from "../../array/uniqWith.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { flattenArrayLike } from "../_internal/flattenArrayLike.mjs"; +//#region src/compat/array/unionWith.ts +/** +* 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. +* A comparator function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param values - The arrays to inspect, or the comparator function. +* @returns Returns the new array of combined unique values. +* +* @example +* const objects = [ +* { x: 1, y: 2 }, +* { x: 2, y: 1 }, +* ]; +* const others = [ +* { x: 1, y: 1 }, +* { x: 1, y: 2 }, +* ]; +* // Returns [objects[0], objects[1], others[0]] +* unionWith(objects, others, isEqual); +* +* @example +* const objects = [{ x: 1, y: 1 }]; +* const others = [{ x: 1, y: 2 }]; +* // Returns [{ x: 1, y: 1 }] +* unionWith(objects, others, (a, b) => a.x === b.x); +*/ +function unionWith(...values) { + const lastValue = last(values); + const flattened = flattenArrayLike(values); + if (isArrayLikeObject(lastValue) || lastValue == null) return uniq(flattened); + return uniqWith(flattened, lastValue); +} +//#endregion +export { unionWith };