Skip to content

Commit

Permalink
fix: remove iterable-operator dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackGlory committed Jan 21, 2023
1 parent ee13e25 commit 857f19f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 61 deletions.
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -54,7 +54,6 @@
},
"dependencies": {
"@blackglory/pass": "^1.1.0",
"@blackglory/types": "^1.4.0",
"iterable-operator": "^2.5.0 || ^3.0.0"
"@blackglory/types": "^1.4.0"
}
}
13 changes: 12 additions & 1 deletion src/custom-error.ts
@@ -1,4 +1,5 @@
import { first, toArray } from 'iterable-operator'
// 由于可能出现循环引用, 禁止在本项目导入iterable-operator

import { getErrorNames } from './get-error-names'
import { isError } from './is-error'
import { isSerializableError } from './serializable-error'
Expand Down Expand Up @@ -27,3 +28,13 @@ export class CustomError extends Error {
}
}
}

function first<T>(iterable: Iterable<T>): T | undefined {
for (const element of iterable) {
return element
}
}

function toArray<T>(iterable: Iterable<T>): T[] {
return Array.from(iterable)
}
59 changes: 1 addition & 58 deletions yarn.lock
Expand Up @@ -669,15 +669,6 @@
"@blackglory/types" "^1.4.0"
iterable-operator "^2.1.0"

"@blackglory/errors@^2.4.1":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@blackglory/errors/-/errors-2.4.1.tgz#593ddeba0164e6a7f405a476da7d810159b258f0"
integrity sha512-Bx7FL9SeRFc05fF1qwvl9mF5J2ORjuLzPOKBT3n8XxP43n/iNNvXiFojmGgZdqL3qAzZCUGLJ0Kay3mr/kltJw==
dependencies:
"@blackglory/pass" "^1.1.0"
"@blackglory/types" "^1.4.0"
iterable-operator "^2.5.0"

"@blackglory/go@^0.1.0":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@blackglory/go/-/go-0.1.1.tgz#c0c766a1381a72a1d1557f54e11208b4b287fb28"
Expand Down Expand Up @@ -768,18 +759,6 @@
iterable-operator "^2.5.0"
justypes "^3.1.2"

"@blackglory/structures@^0.11.6":
version "0.11.8"
resolved "https://registry.yarnpkg.com/@blackglory/structures/-/structures-0.11.8.tgz#086f7285484e626374ed76881e2ccb21e9491ecf"
integrity sha512-52LPP5F9QsuyUmkQhzdWPKhX+bRhbQHMNVZy4KjNZCuSlbWu++RgXSSt6Z5DUk/Xpkhd4HtNU1IfMtZ3tg1nIw==
dependencies:
"@blackglory/errors" "^2.4.1"
"@blackglory/go" "^1.1.2"
extra-timers "^0.2.5"
extra-utils "^4.0.0"
iterable-operator "^2.5.0"
justypes "^4.0.0"

"@blackglory/types@^0.6.5":
version "0.6.5"
resolved "https://registry.yarnpkg.com/@blackglory/types/-/types-0.6.5.tgz#5f01c142ce4a98ff32f5b6fd7ea396f6e0132fea"
Expand Down Expand Up @@ -2854,16 +2833,6 @@ extglob@^2.0.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"

extra-abort@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/extra-abort/-/extra-abort-0.2.1.tgz#430bb76db3038d816c1af3e05b9db1fa8cb1b3a0"
integrity sha512-JgD7i1T9YP/qtqnRcB8cqJPZJCRFkQwLlne8G9ylfKDKhbjLf/TCudKWpICg0rWVhaADSZivTmX9wqUDc/f2bQ==
dependencies:
"@blackglory/errors" "^2.2.3"
"@blackglory/types" "^1.4.0"
iterable-operator "^2.1.0 || ^3.0.0"
justypes "^3.0.0"

extra-compatible@^0.1.0:
version "0.1.4"
resolved "https://registry.yarnpkg.com/extra-compatible/-/extra-compatible-0.1.4.tgz#41b0f3b559ffeb5ea80dcdd8223ca59f3b6c4a66"
Expand Down Expand Up @@ -2908,7 +2877,7 @@ extra-lazy@^1.3.1:
resolved "https://registry.yarnpkg.com/extra-lazy/-/extra-lazy-1.3.1.tgz#f8d74084e8806a6c1906ef292b4d6834e0b35517"
integrity sha512-C55Cr/dQWQHdwuMTF+ySNMYqydVclmKdgFHoC/8gTu5Zoe1Nrx6jgArwfZ+7jKU78VjDfhrkGAJ38ucf0lozeQ==

extra-promise@^4.1.0, extra-promise@^4.4.0:
extra-promise@^4.1.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/extra-promise/-/extra-promise-4.4.0.tgz#5aa7011b14a4a69fd834c454f27a2a928668dc09"
integrity sha512-TbizIl9ko60GDiTCOviTtZL/uF3Y9sJMSdYw4U7N7bT0AY+I+E5dbzfugEmVmlOmzrRttKUg6gF3ov88PAhs9w==
Expand Down Expand Up @@ -2948,14 +2917,6 @@ extra-utils@^3.0.0, extra-utils@^3.3.0, extra-utils@^3.4.0, extra-utils@^3.5.1:
justypes "^3.1.2"
lodash "^4.17.21"

extra-utils@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/extra-utils/-/extra-utils-4.0.0.tgz#97cb38f3d28c9b9b94c01e37eb448cd09d55a6d1"
integrity sha512-tww4VSzqWz7O2+yTL+nPIUHFTIcYfgkkDzxj3YWZZbfMe2ERWF6mi2QsmiEgDt9AHmWZrao+fuZJFK27pEBcoA==
dependencies:
justypes "^4.0.0"
lodash "^4.17.21"

fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
Expand Down Expand Up @@ -3856,19 +3817,6 @@ iterable-operator@^2.1.0:
"@blackglory/types" "^1.3.0"
justypes "^3.0.0"

"iterable-operator@^2.1.0 || ^3.0.0", "iterable-operator@^2.5.0 || ^3.0.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/iterable-operator/-/iterable-operator-3.1.0.tgz#5f5551bc0e923b3974d45e8fe77b8c4762fcdbc6"
integrity sha512-A05TBt/g7n7xu5hS8zeIgnwyhc5QAFNvAtcoaolMaBZiqTIPx1a7xIMeZ/8vC+9/5Flw4SG/kdCFtlEeSy3whQ==
dependencies:
"@blackglory/errors" "^2.4.1"
"@blackglory/go" "^1.1.2"
"@blackglory/structures" "^0.11.6"
extra-abort "^0.2.0"
extra-promise "^4.4.0"
extra-utils "^4.0.0"
justypes "^4.0.0"

iterable-operator@^2.2.0, iterable-operator@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/iterable-operator/-/iterable-operator-2.5.0.tgz#b0221a85973900ef1b76dd5b83f3c4d9cab0162c"
Expand Down Expand Up @@ -4347,11 +4295,6 @@ justypes@^3.1.2:
resolved "https://registry.yarnpkg.com/justypes/-/justypes-3.1.2.tgz#f4cbdeeab5cca7c5e609f4db30480381961bbf99"
integrity sha512-XPx3j+Og45DhqXqROKgmUzZ7DMBKL7xQbAfwTjouXVYUY72ydc1BEpO2ygIj1K674UPmSq8YQpkoq/B7RrtuSA==

justypes@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/justypes/-/justypes-4.1.0.tgz#f47a45fffe42d52ad0a1c7f3a69fc88f2490183f"
integrity sha512-eVBz2A+aA9GnQ1/RRcyIt74UwNb9cgcWioXYDD/5JhCy37W//Hy/85DuN7ID5nKhS/E/AMpMTFRBmBDdVghe7w==

kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
Expand Down

0 comments on commit 857f19f

Please sign in to comment.