@mainsail/utils 0.0.1-evm.4 → 0.0.1-evm.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distribution/assert.d.ts +14 -0
- package/distribution/assert.d.ts.map +1 -0
- package/distribution/assert.js +18 -0
- package/distribution/assert.js.map +1 -0
- package/distribution/assign.d.ts +1 -1
- package/distribution/assign.d.ts.map +1 -1
- package/distribution/assign.js +1 -2
- package/distribution/assign.js.map +1 -1
- package/distribution/at.d.ts +1 -1
- package/distribution/at.d.ts.map +1 -1
- package/distribution/at.js +2 -2
- package/distribution/at.js.map +1 -1
- package/distribution/big-number.d.ts +1 -2
- package/distribution/big-number.d.ts.map +1 -1
- package/distribution/big-number.js +5 -4
- package/distribution/big-number.js.map +1 -1
- package/distribution/byte-buffer.d.ts +0 -1
- package/distribution/byte-buffer.d.ts.map +1 -1
- package/distribution/byte-buffer.js +37 -51
- package/distribution/byte-buffer.js.map +1 -1
- package/distribution/camel-case.d.ts.map +1 -1
- package/distribution/capped-map.js +7 -20
- package/distribution/capped-map.js.map +1 -1
- package/distribution/capped-set.d.ts.map +1 -1
- package/distribution/capped-set.js +10 -21
- package/distribution/capped-set.js.map +1 -1
- package/distribution/cast-array.d.ts +1 -1
- package/distribution/cast-array.d.ts.map +1 -1
- package/distribution/cast-array.js.map +1 -1
- package/distribution/chars.d.ts.map +1 -1
- package/distribution/chunk.d.ts.map +1 -1
- package/distribution/clone-array.d.ts.map +1 -1
- package/distribution/clone-deep.d.ts.map +1 -1
- package/distribution/clone-object.d.ts +1 -1
- package/distribution/clone-object.d.ts.map +1 -1
- package/distribution/clone-object.js.map +1 -1
- package/distribution/clone.d.ts +1 -1
- package/distribution/clone.d.ts.map +1 -1
- package/distribution/clone.js.map +1 -1
- package/distribution/collection.js +12 -27
- package/distribution/collection.js.map +1 -1
- package/distribution/concat.d.ts.map +1 -1
- package/distribution/constant-case.d.ts.map +1 -1
- package/distribution/dot-case.d.ts.map +1 -1
- package/distribution/dot-env.d.ts +1 -1
- package/distribution/dot-env.d.ts.map +1 -1
- package/distribution/every.d.ts +1 -1
- package/distribution/every.d.ts.map +1 -1
- package/distribution/expand-tilde.d.ts.map +1 -1
- package/distribution/extension.d.ts.map +1 -1
- package/distribution/fill.d.ts.map +1 -1
- package/distribution/filter-array.d.ts +2 -2
- package/distribution/filter-array.d.ts.map +1 -1
- package/distribution/filter-array.js +3 -2
- package/distribution/filter-array.js.map +1 -1
- package/distribution/filter-object.d.ts +2 -2
- package/distribution/filter-object.d.ts.map +1 -1
- package/distribution/filter-object.js +8 -6
- package/distribution/filter-object.js.map +1 -1
- package/distribution/filter.d.ts +2 -2
- package/distribution/filter.d.ts.map +1 -1
- package/distribution/filter.js +9 -1
- package/distribution/filter.js.map +1 -1
- package/distribution/find-index.d.ts +1 -1
- package/distribution/find-index.d.ts.map +1 -1
- package/distribution/find-key.d.ts +2 -2
- package/distribution/find-key.d.ts.map +1 -1
- package/distribution/find-key.js +5 -1
- package/distribution/find-key.js.map +1 -1
- package/distribution/find.d.ts +1 -1
- package/distribution/find.d.ts.map +1 -1
- package/distribution/first-map-entry.d.ts.map +1 -1
- package/distribution/first-map-key.d.ts.map +1 -1
- package/distribution/first-map-value.d.ts.map +1 -1
- package/distribution/flatten.d.ts.map +1 -1
- package/distribution/flatten.js +6 -1
- package/distribution/flatten.js.map +1 -1
- package/distribution/format-ecdsa-signature.d.ts +2 -0
- package/distribution/format-ecdsa-signature.d.ts.map +1 -0
- package/distribution/format-ecdsa-signature.js +2 -0
- package/distribution/format-ecdsa-signature.js.map +1 -0
- package/distribution/format-number.d.ts.map +1 -1
- package/distribution/format-string.d.ts +1 -1
- package/distribution/format-string.d.ts.map +1 -1
- package/distribution/format-string.js +4 -5
- package/distribution/format-string.js.map +1 -1
- package/distribution/get-path-segments.d.ts.map +1 -1
- package/distribution/get-type.d.ts.map +1 -1
- package/distribution/get.d.ts.map +1 -1
- package/distribution/group-by.d.ts +2 -2
- package/distribution/group-by.d.ts.map +1 -1
- package/distribution/group-by.js +4 -4
- package/distribution/group-by.js.map +1 -1
- package/distribution/has-property.d.ts.map +1 -1
- package/distribution/has-some-property.d.ts.map +1 -1
- package/distribution/has.d.ts.map +1 -1
- package/distribution/hash-string.d.ts.map +1 -1
- package/distribution/head.d.ts.map +1 -1
- package/distribution/header-case.d.ts.map +1 -1
- package/distribution/http.d.ts +8 -8
- package/distribution/http.d.ts.map +1 -1
- package/distribution/http.js +22 -5
- package/distribution/http.js.map +1 -1
- package/distribution/immutable/order-by.d.ts +1 -1
- package/distribution/immutable/order-by.d.ts.map +1 -1
- package/distribution/immutable/sort-by-desc.d.ts +2 -2
- package/distribution/immutable/sort-by-desc.d.ts.map +1 -1
- package/distribution/immutable/sort-by-desc.js.map +1 -1
- package/distribution/immutable/sort-by.d.ts +2 -2
- package/distribution/immutable/sort-by.d.ts.map +1 -1
- package/distribution/immutable/sort-by.js.map +1 -1
- package/distribution/includes.d.ts.map +1 -1
- package/distribution/index-of.d.ts +1 -1
- package/distribution/index-of.d.ts.map +1 -1
- package/distribution/index-of.js.map +1 -1
- package/distribution/index.d.ts +6 -0
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +6 -0
- package/distribution/index.js.map +1 -1
- package/distribution/internal/compound-words.d.ts.map +1 -1
- package/distribution/internal/types.d.ts +2 -2
- package/distribution/internal/types.d.ts.map +1 -1
- package/distribution/intersection.d.ts.map +1 -1
- package/distribution/ip-address.d.ts +5 -0
- package/distribution/ip-address.d.ts.map +1 -0
- package/distribution/ip-address.js +18 -0
- package/distribution/ip-address.js.map +1 -0
- package/distribution/is-arguments.d.ts.map +1 -1
- package/distribution/is-array-of-type.d.ts.map +1 -1
- package/distribution/is-array.d.ts.map +1 -1
- package/distribution/is-async-function.d.ts.map +1 -1
- package/distribution/is-between.d.ts.map +1 -1
- package/distribution/is-bigint.d.ts +1 -1
- package/distribution/is-bigint.d.ts.map +1 -1
- package/distribution/is-blacklisted.d.ts +2 -0
- package/distribution/is-blacklisted.d.ts.map +1 -0
- package/distribution/is-blacklisted.js +17 -0
- package/distribution/is-blacklisted.js.map +1 -0
- package/distribution/is-boolean-array.d.ts.map +1 -1
- package/distribution/is-boolean.d.ts.map +1 -1
- package/distribution/is-buffer.d.ts.map +1 -1
- package/distribution/is-constructor.d.ts +1 -1
- package/distribution/is-constructor.d.ts.map +1 -1
- package/distribution/is-constructor.js +1 -1
- package/distribution/is-constructor.js.map +1 -1
- package/distribution/is-date.d.ts.map +1 -1
- package/distribution/is-empty-array.d.ts.map +1 -1
- package/distribution/is-empty-map.d.ts.map +1 -1
- package/distribution/is-empty-object.d.ts.map +1 -1
- package/distribution/is-empty-set.d.ts.map +1 -1
- package/distribution/is-empty.d.ts +1 -1
- package/distribution/is-empty.d.ts.map +1 -1
- package/distribution/is-empty.js +7 -4
- package/distribution/is-empty.js.map +1 -1
- package/distribution/is-enumerable.d.ts.map +1 -1
- package/distribution/is-equal.d.ts +0 -1
- package/distribution/is-equal.d.ts.map +1 -1
- package/distribution/is-error.d.ts.map +1 -1
- package/distribution/is-false.d.ts +1 -1
- package/distribution/is-false.d.ts.map +1 -1
- package/distribution/is-false.js.map +1 -1
- package/distribution/is-function.d.ts.map +1 -1
- package/distribution/is-git.d.ts.map +1 -1
- package/distribution/is-git.js +1 -1
- package/distribution/is-git.js.map +1 -1
- package/distribution/is-greater-than-or-equal.d.ts.map +1 -1
- package/distribution/is-greater-than.d.ts.map +1 -1
- package/distribution/is-less-than-or-equal.d.ts.map +1 -1
- package/distribution/is-less-than.d.ts.map +1 -1
- package/distribution/is-map.d.ts.map +1 -1
- package/distribution/is-match.d.ts +1 -1
- package/distribution/is-match.d.ts.map +1 -1
- package/distribution/is-match.js.map +1 -1
- package/distribution/is-negative-zero.d.ts.map +1 -1
- package/distribution/is-negative.d.ts.map +1 -1
- package/distribution/is-nil.d.ts.map +1 -1
- package/distribution/is-not-between.d.ts +1 -1
- package/distribution/is-not-between.d.ts.map +1 -1
- package/distribution/is-not-between.js.map +1 -1
- package/distribution/is-not-equal.d.ts.map +1 -1
- package/distribution/is-null.d.ts.map +1 -1
- package/distribution/is-number-array.d.ts.map +1 -1
- package/distribution/is-number.d.ts.map +1 -1
- package/distribution/is-object.d.ts.map +1 -1
- package/distribution/is-positive-zero.d.ts.map +1 -1
- package/distribution/is-positive.d.ts +1 -1
- package/distribution/is-positive.d.ts.map +1 -1
- package/distribution/is-promise.d.ts.map +1 -1
- package/distribution/is-reg-exp.d.ts.map +1 -1
- package/distribution/is-set.d.ts.map +1 -1
- package/distribution/is-ssh.d.ts.map +1 -1
- package/distribution/is-string-array.d.ts.map +1 -1
- package/distribution/is-string.d.ts.map +1 -1
- package/distribution/is-symbol.d.ts.map +1 -1
- package/distribution/is-sync-function.d.ts.map +1 -1
- package/distribution/is-true.d.ts +1 -1
- package/distribution/is-true.d.ts.map +1 -1
- package/distribution/is-true.js.map +1 -1
- package/distribution/is-undefined.d.ts.map +1 -1
- package/distribution/is-uri.d.ts.map +1 -1
- package/distribution/is-url.d.ts.map +1 -1
- package/distribution/is-weak-map.d.ts.map +1 -1
- package/distribution/is-weak-set.d.ts.map +1 -1
- package/distribution/is-whitelisted.d.ts +2 -0
- package/distribution/is-whitelisted.d.ts.map +1 -0
- package/distribution/is-whitelisted.js +17 -0
- package/distribution/is-whitelisted.js.map +1 -0
- package/distribution/kebab-case.d.ts.map +1 -1
- package/distribution/key-by.d.ts +2 -2
- package/distribution/key-by.d.ts.map +1 -1
- package/distribution/key-by.js +2 -1
- package/distribution/key-by.js.map +1 -1
- package/distribution/keys-in.d.ts.map +1 -1
- package/distribution/keys.d.ts +1 -1
- package/distribution/keys.d.ts.map +1 -1
- package/distribution/keys.js.map +1 -1
- package/distribution/last-index-of.d.ts.map +1 -1
- package/distribution/last-map-entry.d.ts.map +1 -1
- package/distribution/last-map-key.d.ts.map +1 -1
- package/distribution/last-map-value.d.ts.map +1 -1
- package/distribution/last.d.ts.map +1 -1
- package/distribution/lock.d.ts +6 -0
- package/distribution/lock.d.ts.map +1 -0
- package/distribution/lock.js +45 -0
- package/distribution/lock.js.map +1 -0
- package/distribution/lower-case.d.ts.map +1 -1
- package/distribution/lower-first.d.ts.map +1 -1
- package/distribution/map-array.d.ts +1 -2
- package/distribution/map-array.d.ts.map +1 -1
- package/distribution/map-array.js.map +1 -1
- package/distribution/map-object.d.ts +1 -2
- package/distribution/map-object.d.ts.map +1 -1
- package/distribution/map-object.js.map +1 -1
- package/distribution/map-values.d.ts +1 -2
- package/distribution/map-values.d.ts.map +1 -1
- package/distribution/map-values.js.map +1 -1
- package/distribution/map.d.ts +1 -2
- package/distribution/map.d.ts.map +1 -1
- package/distribution/map.js +7 -1
- package/distribution/map.js.map +1 -1
- package/distribution/match.d.ts.map +1 -1
- package/distribution/max-by.d.ts +2 -2
- package/distribution/max-by.d.ts.map +1 -1
- package/distribution/max-by.js.map +1 -1
- package/distribution/max.d.ts.map +1 -1
- package/distribution/min-by.d.ts +2 -2
- package/distribution/min-by.d.ts.map +1 -1
- package/distribution/min-by.js.map +1 -1
- package/distribution/min.d.ts.map +1 -1
- package/distribution/nsect.js +17 -30
- package/distribution/nsect.js.map +1 -1
- package/distribution/number-array.d.ts.map +1 -1
- package/distribution/number-to-hex.d.ts.map +1 -1
- package/distribution/omit-by.d.ts +2 -2
- package/distribution/omit-by.d.ts.map +1 -1
- package/distribution/omit-by.js.map +1 -1
- package/distribution/order-by.d.ts +2 -2
- package/distribution/order-by.d.ts.map +1 -1
- package/distribution/order-by.js +11 -12
- package/distribution/order-by.js.map +1 -1
- package/distribution/ordinal.d.ts.map +1 -1
- package/distribution/parse-git-url.d.ts.map +1 -1
- package/distribution/parse-git-url.js.map +1 -1
- package/distribution/parse-uri.d.ts.map +1 -1
- package/distribution/parse.d.ts.map +1 -1
- package/distribution/partition.d.ts +1 -1
- package/distribution/partition.d.ts.map +1 -1
- package/distribution/pascal-case.d.ts.map +1 -1
- package/distribution/path-case.d.ts.map +1 -1
- package/distribution/pick-by.d.ts +1 -2
- package/distribution/pick-by.d.ts.map +1 -1
- package/distribution/pick-by.js +13 -2
- package/distribution/pick-by.js.map +1 -1
- package/distribution/pick.d.ts.map +1 -1
- package/distribution/pluck.d.ts.map +1 -1
- package/distribution/pluralize.d.ts.map +1 -1
- package/distribution/pretty-bytes.d.ts.map +1 -1
- package/distribution/pretty-time.d.ts.map +1 -1
- package/distribution/protocols.d.ts.map +1 -1
- package/distribution/pull-all-by.d.ts +2 -2
- package/distribution/pull-all-by.d.ts.map +1 -1
- package/distribution/pull-all-by.js +6 -4
- package/distribution/pull-all-by.js.map +1 -1
- package/distribution/pull-all.d.ts +1 -1
- package/distribution/pull-all.d.ts.map +1 -1
- package/distribution/pull-all.js +1 -1
- package/distribution/pull-all.js.map +1 -1
- package/distribution/pull.d.ts +1 -1
- package/distribution/pull.d.ts.map +1 -1
- package/distribution/pull.js.map +1 -1
- package/distribution/random-base64.d.ts.map +1 -1
- package/distribution/random-bits.d.ts +0 -1
- package/distribution/random-bits.d.ts.map +1 -1
- package/distribution/random-hex.d.ts.map +1 -1
- package/distribution/random-number.d.ts.map +1 -1
- package/distribution/reduce-array.d.ts +1 -1
- package/distribution/reduce-array.d.ts.map +1 -1
- package/distribution/reduce-array.js.map +1 -1
- package/distribution/reduce-object.d.ts +2 -2
- package/distribution/reduce-object.d.ts.map +1 -1
- package/distribution/reduce-object.js +2 -1
- package/distribution/reduce-object.js.map +1 -1
- package/distribution/reduce-right-array.d.ts +2 -2
- package/distribution/reduce-right-array.d.ts.map +1 -1
- package/distribution/reduce-right-array.js.map +1 -1
- package/distribution/reduce-right-object.d.ts +2 -2
- package/distribution/reduce-right-object.d.ts.map +1 -1
- package/distribution/reduce-right-object.js +2 -1
- package/distribution/reduce-right-object.js.map +1 -1
- package/distribution/reduce-right.d.ts +5 -2
- package/distribution/reduce-right.d.ts.map +1 -1
- package/distribution/reduce-right.js +5 -3
- package/distribution/reduce-right.js.map +1 -1
- package/distribution/reduce.d.ts +2 -2
- package/distribution/reduce.d.ts.map +1 -1
- package/distribution/reduce.js +8 -1
- package/distribution/reduce.js.map +1 -1
- package/distribution/reject.d.ts +2 -2
- package/distribution/reject.d.ts.map +1 -1
- package/distribution/reject.js +1 -1
- package/distribution/reject.js.map +1 -1
- package/distribution/reverse.d.ts.map +1 -1
- package/distribution/sample.d.ts.map +1 -1
- package/distribution/semver.d.ts.map +1 -1
- package/distribution/semver.js +5 -5
- package/distribution/semver.js.map +1 -1
- package/distribution/set.d.ts.map +1 -1
- package/distribution/set.js +1 -0
- package/distribution/set.js.map +1 -1
- package/distribution/shuffle.d.ts.map +1 -1
- package/distribution/sleep.d.ts +0 -1
- package/distribution/sleep.d.ts.map +1 -1
- package/distribution/slice.d.ts.map +1 -1
- package/distribution/snake-case.d.ts.map +1 -1
- package/distribution/some.d.ts +2 -2
- package/distribution/some.d.ts.map +1 -1
- package/distribution/some.js.map +1 -1
- package/distribution/sort-by-desc.d.ts +2 -2
- package/distribution/sort-by-desc.d.ts.map +1 -1
- package/distribution/sort-by-desc.js.map +1 -1
- package/distribution/sort-by.d.ts +2 -2
- package/distribution/sort-by.d.ts.map +1 -1
- package/distribution/sort-by.js.map +1 -1
- package/distribution/start-case.d.ts.map +1 -1
- package/distribution/stringify.d.ts.map +1 -1
- package/distribution/tail.d.ts.map +1 -1
- package/distribution/take.d.ts.map +1 -1
- package/distribution/to-lower.d.ts.map +1 -1
- package/distribution/to-string.d.ts.map +1 -1
- package/distribution/to-upper.d.ts.map +1 -1
- package/distribution/trim-trailing-slash.d.ts.map +1 -1
- package/distribution/trim-trailing-slash.js +1 -1
- package/distribution/trim-trailing-slash.js.map +1 -1
- package/distribution/truncate.d.ts.map +1 -1
- package/distribution/union-by.d.ts +1 -1
- package/distribution/union-by.d.ts.map +1 -1
- package/distribution/union-by.js +3 -0
- package/distribution/union-by.js.map +1 -1
- package/distribution/union.d.ts.map +1 -1
- package/distribution/uniq-by.d.ts +2 -2
- package/distribution/uniq-by.d.ts.map +1 -1
- package/distribution/uniq-by.js.map +1 -1
- package/distribution/uniq.d.ts.map +1 -1
- package/distribution/unset.d.ts.map +1 -1
- package/distribution/upper-case.d.ts.map +1 -1
- package/distribution/upper-first.d.ts.map +1 -1
- package/distribution/validator-set-pack.d.ts.map +1 -1
- package/distribution/words.d.ts.map +1 -1
- package/distribution/words.js +1 -1
- package/distribution/words.js.map +1 -1
- package/distribution/zip-object.d.ts.map +1 -1
- package/package.json +17 -19
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _Collection_collection;
|
|
13
1
|
import { get } from "./get.js";
|
|
14
2
|
import { has } from "./has.js";
|
|
15
3
|
import { sample } from "./sample.js";
|
|
@@ -17,46 +5,44 @@ import { set } from "./set.js";
|
|
|
17
5
|
import { stringify } from "./stringify.js";
|
|
18
6
|
import { unset } from "./unset.js";
|
|
19
7
|
export class Collection {
|
|
20
|
-
|
|
21
|
-
_Collection_collection.set(this, {});
|
|
22
|
-
}
|
|
8
|
+
#collection = {};
|
|
23
9
|
all() {
|
|
24
|
-
return
|
|
10
|
+
return this.#collection;
|
|
25
11
|
}
|
|
26
12
|
entries() {
|
|
27
|
-
return Object.entries(
|
|
13
|
+
return Object.entries(this.#collection);
|
|
28
14
|
}
|
|
29
15
|
keys() {
|
|
30
|
-
return Object.keys(
|
|
16
|
+
return Object.keys(this.#collection);
|
|
31
17
|
}
|
|
32
18
|
values() {
|
|
33
|
-
return Object.values(
|
|
19
|
+
return Object.values(this.#collection);
|
|
34
20
|
}
|
|
35
21
|
pull(key) {
|
|
36
|
-
const item = get(
|
|
22
|
+
const item = get(this.#collection, key);
|
|
37
23
|
this.forget(key);
|
|
38
24
|
return item;
|
|
39
25
|
}
|
|
40
26
|
get(key) {
|
|
41
|
-
return get(
|
|
27
|
+
return get(this.#collection, key);
|
|
42
28
|
}
|
|
43
29
|
set(key, value) {
|
|
44
|
-
set(
|
|
30
|
+
set(this.#collection, key, value);
|
|
45
31
|
}
|
|
46
32
|
forget(key) {
|
|
47
|
-
unset(
|
|
33
|
+
unset(this.#collection, key);
|
|
48
34
|
}
|
|
49
35
|
flush() {
|
|
50
|
-
|
|
36
|
+
this.#collection = {};
|
|
51
37
|
}
|
|
52
38
|
has(key) {
|
|
53
|
-
return has(
|
|
39
|
+
return has(this.#collection, key);
|
|
54
40
|
}
|
|
55
41
|
missing(key) {
|
|
56
42
|
return !this.has(key);
|
|
57
43
|
}
|
|
58
44
|
count() {
|
|
59
|
-
return Object.keys(
|
|
45
|
+
return Object.keys(this.#collection).length;
|
|
60
46
|
}
|
|
61
47
|
isEmpty() {
|
|
62
48
|
return this.count() <= 0;
|
|
@@ -75,5 +61,4 @@ export class Collection {
|
|
|
75
61
|
return stringify(collection);
|
|
76
62
|
}
|
|
77
63
|
}
|
|
78
|
-
_Collection_collection = new WeakMap();
|
|
79
64
|
//# sourceMappingURL=collection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../source/collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../source/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,OAAO,UAAU;IACtB,WAAW,GAAsB,EAAE,CAAC;IAE7B,GAAG;QACT,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAEM,OAAO;QACb,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAEM,IAAI;QACV,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM;QACZ,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAEM,IAAI,CAAC,GAAW;QACtB,MAAM,IAAI,GAAG,GAAG,CAAuB,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAE9D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAEjB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,GAAG,CAAC,GAAW;QACrB,OAAO,GAAG,CAAuB,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC;IAEM,GAAG,CAAC,GAAW,EAAE,KAAQ;QAC/B,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAEM,MAAM,CAAC,GAAW;QACxB,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;IAEM,GAAG,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IAEM,OAAO,CAAC,GAAW;QACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAEM,KAAK;QACX,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;IAC7C,CAAC;IAEM,OAAO;QACb,OAAO,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAEM,UAAU;QAChB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAEM,MAAM;QACZ,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9B,CAAC;IAEM,MAAM;QACZ,MAAM,UAAU,GAAsB,EAAE,CAAC;QAEzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAC3C,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACzB,CAAC;QAED,OAAO,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../source/concat.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../source/concat.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAG,CAAC,EAgBnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant-case.d.ts","sourceRoot":"","sources":["../source/constant-case.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"constant-case.d.ts","sourceRoot":"","sources":["../source/constant-case.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,SAIpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-case.d.ts","sourceRoot":"","sources":["../source/dot-case.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"dot-case.d.ts","sourceRoot":"","sources":["../source/dot-case.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,SACyD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-env.d.ts","sourceRoot":"","sources":["../source/dot-env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dot-env.d.ts","sourceRoot":"","sources":["../source/dot-env.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA6C3C,eAAO,MAAM,MAAM;sBAzCM,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;sBA2BlC,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;uBAEjC,MAAM,KAAG,MAAM;CAYY,CAAC"}
|
package/distribution/every.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"every.d.ts","sourceRoot":"","sources":["../source/every.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"every.d.ts","sourceRoot":"","sources":["../source/every.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,UAAU,iBAAiB,KAAG,OAQpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand-tilde.d.ts","sourceRoot":"","sources":["../source/expand-tilde.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"expand-tilde.d.ts","sourceRoot":"","sources":["../source/expand-tilde.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAY1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../source/extension.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../source/extension.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,SAAgD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../source/fill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../source/fill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAgBxF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FunctionReturning } from "./internal/index.js";
|
|
2
|
-
export declare const filterArray: <T>(iterable: T[], iteratee: FunctionReturning) => T[];
|
|
1
|
+
import type { FunctionReturning } from "./internal/index.js";
|
|
2
|
+
export declare const filterArray: <T>(iterable: T[], iteratee: FunctionReturning<[T, number, T[]], unknown>) => T[];
|
|
3
3
|
//# sourceMappingURL=filter-array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-array.d.ts","sourceRoot":"","sources":["../source/filter-array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"filter-array.d.ts","sourceRoot":"","sources":["../source/filter-array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,iBAAiB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAG,CAAC,EAWvG,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export const filterArray = (iterable, iteratee) => {
|
|
2
2
|
const result = [];
|
|
3
3
|
for (let index = 0; index < iterable.length; index++) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const item = iterable[index];
|
|
5
|
+
if (iteratee(item, index, iterable)) {
|
|
6
|
+
result.push(item);
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
9
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-array.js","sourceRoot":"","sources":["../source/filter-array.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,QAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"filter-array.js","sourceRoot":"","sources":["../source/filter-array.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,QAAa,EAAE,QAAsD,EAAO,EAAE;IAC5G,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FunctionReturning } from "./internal/index.js";
|
|
2
|
-
export declare const filterObject: <T extends
|
|
1
|
+
import type { FunctionReturning } from "./internal/index.js";
|
|
2
|
+
export declare const filterObject: <T extends Record<string, T[keyof T]>>(iterable: T, iteratee: FunctionReturning<[T[keyof T], keyof T, T], unknown>) => T;
|
|
3
3
|
//# sourceMappingURL=filter-object.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-object.d.ts","sourceRoot":"","sources":["../source/filter-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"filter-object.d.ts","sourceRoot":"","sources":["../source/filter-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAChE,UAAU,CAAC,EACX,UAAU,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,KAC5D,CAiBF,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export const filterObject = (iterable, iteratee) => {
|
|
2
|
-
const keys = Object.keys(iterable);
|
|
3
|
-
const length = keys.length;
|
|
4
2
|
const result = {};
|
|
5
|
-
for (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
for (const key in iterable) {
|
|
4
|
+
if (!Object.prototype.hasOwnProperty.call(iterable, key)) {
|
|
5
|
+
continue;
|
|
6
|
+
}
|
|
7
|
+
const typedKey = key;
|
|
8
|
+
const value = iterable[typedKey];
|
|
9
|
+
if (iteratee(value, typedKey, iterable)) {
|
|
10
|
+
result[typedKey] = value;
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-object.js","sourceRoot":"","sources":["../source/filter-object.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"filter-object.js","sourceRoot":"","sources":["../source/filter-object.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC3B,QAAW,EACX,QAA8D,EAC1D,EAAE;IACN,MAAM,MAAM,GAAG,EAAO,CAAC;IAEvB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;YAC1D,SAAS;QACV,CAAC;QAED,MAAM,QAAQ,GAAG,GAAc,CAAC;QAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEjC,IAAI,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;YACzC,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC"}
|
package/distribution/filter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FunctionReturning } from "./internal/index.js";
|
|
2
|
-
export declare const filter: <T
|
|
1
|
+
import type { FunctionReturning } from "./internal/index.js";
|
|
2
|
+
export declare const filter: <T>(iterable: T[] | Record<string, T>, iteratee: FunctionReturning<[T, number | string, T[] | Record<string, T>], unknown>) => T[] | Record<string, T>;
|
|
3
3
|
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../source/filter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../source/filter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,eAAO,MAAM,MAAM,GAAI,CAAC,EACvB,UAAU,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EACjC,UAAU,iBAAiB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KACjF,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAgBxB,CAAC"}
|
package/distribution/filter.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { filterArray } from "./filter-array.js";
|
|
2
2
|
import { filterObject } from "./filter-object.js";
|
|
3
3
|
import { isArray } from "./is-array.js";
|
|
4
|
-
export const filter = (iterable, iteratee) =>
|
|
4
|
+
export const filter = (iterable, iteratee) => {
|
|
5
|
+
if (isArray(iterable)) {
|
|
6
|
+
// iterable is T[]
|
|
7
|
+
return filterArray(iterable, ((value, index, array) => iteratee(value, index, array)));
|
|
8
|
+
}
|
|
9
|
+
// iterable is Record<string, T>
|
|
10
|
+
const object = iterable;
|
|
11
|
+
return filterObject(object, ((value, key, object_) => iteratee(value, key, object_)));
|
|
12
|
+
};
|
|
5
13
|
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../source/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../source/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,MAAM,GAAG,CACrB,QAAiC,EACjC,QAAmF,EACzD,EAAE;IAC5B,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvB,kBAAkB;QAClB,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAGnF,CAAC,CAAC;IACJ,CAAC;IAED,gCAAgC;IAChC,MAAM,MAAM,GAAG,QAA6B,CAAC;IAE7C,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAGlF,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-index.d.ts","sourceRoot":"","sources":["../source/find-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"find-index.d.ts","sourceRoot":"","sources":["../source/find-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,iBAAiB,KAAG,MAQzE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FunctionReturning } from "./internal/index.js";
|
|
2
|
-
export declare const findKey: <T extends
|
|
1
|
+
import type { FunctionReturning } from "./internal/index.js";
|
|
2
|
+
export declare const findKey: <T extends Record<string, T[keyof T]>>(iterable: T, iteratee: FunctionReturning<[T[keyof T], keyof T, T], unknown>) => keyof T | undefined;
|
|
3
3
|
//# sourceMappingURL=find-key.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-key.d.ts","sourceRoot":"","sources":["../source/find-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"find-key.d.ts","sourceRoot":"","sources":["../source/find-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAC3D,UAAU,CAAC,EACX,UAAU,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,KAC5D,MAAM,CAAC,GAAG,SAKZ,CAAC"}
|
package/distribution/find-key.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { filterObject } from "./filter-object.js";
|
|
2
|
-
export const findKey = (iterable, iteratee) =>
|
|
2
|
+
export const findKey = (iterable, iteratee) => {
|
|
3
|
+
const filtered = filterObject(iterable, iteratee);
|
|
4
|
+
const keys = Object.keys(filtered);
|
|
5
|
+
return keys.length > 0 ? keys[0] : undefined;
|
|
6
|
+
};
|
|
3
7
|
//# sourceMappingURL=find-key.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-key.js","sourceRoot":"","sources":["../source/find-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"find-key.js","sourceRoot":"","sources":["../source/find-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,CAAC,MAAM,OAAO,GAAG,CACtB,QAAW,EACX,QAA8D,EACxC,EAAE;IACxB,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAgB,CAAC;IAElD,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC,CAAC"}
|
package/distribution/find.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../source/find.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../source/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,iBAAiB,KAAG,CAAC,GAAG,SAUxE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-map-entry.d.ts","sourceRoot":"","sources":["../source/first-map-entry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"first-map-entry.d.ts","sourceRoot":"","sources":["../source/first-map-entry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,CAAC,CAAC,EAAE,CAAC,CAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-map-key.d.ts","sourceRoot":"","sources":["../source/first-map-key.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"first-map-key.d.ts","sourceRoot":"","sources":["../source/first-map-key.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,CAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-map-value.d.ts","sourceRoot":"","sources":["../source/first-map-value.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"first-map-value.d.ts","sourceRoot":"","sources":["../source/first-map-value.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,CAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../source/flatten.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../source/flatten.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,UAAU,CAAC,EAAE,KAAG,CAAC,EAAwB,CAAC"}
|
package/distribution/flatten.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const flat = (iterable, stash) => {
|
|
2
2
|
for (const element of iterable) {
|
|
3
|
-
Array.isArray(element)
|
|
3
|
+
if (Array.isArray(element)) {
|
|
4
|
+
flat(element, stash);
|
|
5
|
+
}
|
|
6
|
+
else {
|
|
7
|
+
stash.push(element);
|
|
8
|
+
}
|
|
4
9
|
}
|
|
5
10
|
return stash;
|
|
6
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.js","sourceRoot":"","sources":["../source/flatten.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,CAAI,QAAa,EAAE,KAAU,EAAO,EAAE;IAClD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"flatten.js","sourceRoot":"","sources":["../source/flatten.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,CAAI,QAAa,EAAE,KAAU,EAAO,EAAE;IAClD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACP,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAI,QAAa,EAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-ecdsa-signature.d.ts","sourceRoot":"","sources":["../source/format-ecdsa-signature.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-ecdsa-signature.js","sourceRoot":"","sources":["../source/format-ecdsa-signature.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAU,EAAE,CAC/E,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-number.d.ts","sourceRoot":"","sources":["../source/format-number.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"format-number.d.ts","sourceRoot":"","sources":["../source/format-number.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,UAAU,MAAM,GAAG,MAAM,EAAE,EAAE,UAAU,IAAI,CAAC,mBAAmB,KAAG,MACxD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const formatString: (...
|
|
1
|
+
export declare const formatString: (template: string, ...values: unknown[]) => string;
|
|
2
2
|
//# sourceMappingURL=format-string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-string.d.ts","sourceRoot":"","sources":["../source/format-string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"format-string.d.ts","sourceRoot":"","sources":["../source/format-string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,EAAE,GAAG,QAAQ,OAAO,EAAE,KAAG,MAQrE,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export const formatString = (...
|
|
2
|
-
let output =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
output = output.replace(`{${index}}`, element);
|
|
1
|
+
export const formatString = (template, ...values) => {
|
|
2
|
+
let output = template;
|
|
3
|
+
for (const [index, value] of values.entries()) {
|
|
4
|
+
output = output.replace(`{${index}}`, String(value));
|
|
6
5
|
}
|
|
7
6
|
return output;
|
|
8
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-string.js","sourceRoot":"","sources":["../source/format-string.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"format-string.js","sourceRoot":"","sources":["../source/format-string.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,GAAG,MAAiB,EAAU,EAAE;IAC9E,IAAI,MAAM,GAAG,QAAQ,CAAC;IAEtB,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-path-segments.d.ts","sourceRoot":"","sources":["../source/get-path-segments.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"get-path-segments.d.ts","sourceRoot":"","sources":["../source/get-path-segments.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,GAAG,MAAM,EAAE,KAAG,MAAM,EAIhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-type.d.ts","sourceRoot":"","sources":["../source/get-type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"get-type.d.ts","sourceRoot":"","sources":["../source/get-type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,MAA+C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../source/get.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../source/get.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,eAAe,CAAC,KAAG,CAAC,GAAG,SAwBpF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FunctionReturning } from "./internal/index.js";
|
|
2
|
-
export declare const groupBy: <T>(iterable: T[], iteratee: FunctionReturning) =>
|
|
1
|
+
import type { FunctionReturning } from "./internal/index.js";
|
|
2
|
+
export declare const groupBy: <T, K extends PropertyKey>(iterable: T[], iteratee: FunctionReturning<[T], K>) => Record<K, T[]>;
|
|
3
3
|
//# sourceMappingURL=group-by.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-by.d.ts","sourceRoot":"","sources":["../source/group-by.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"group-by.d.ts","sourceRoot":"","sources":["../source/group-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,CAAC,SAAS,WAAW,EAC/C,UAAU,CAAC,EAAE,EACb,UAAU,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KACjC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAcf,CAAC"}
|
package/distribution/group-by.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const groupBy = (iterable, iteratee) => {
|
|
2
2
|
const groupedValues = {};
|
|
3
3
|
for (const value of iterable) {
|
|
4
|
-
const
|
|
5
|
-
if (!groupedValues[
|
|
6
|
-
groupedValues[
|
|
4
|
+
const key = iteratee(value);
|
|
5
|
+
if (!groupedValues[key]) {
|
|
6
|
+
groupedValues[key] = [];
|
|
7
7
|
}
|
|
8
|
-
groupedValues[
|
|
8
|
+
groupedValues[key].push(value);
|
|
9
9
|
}
|
|
10
10
|
return groupedValues;
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-by.js","sourceRoot":"","sources":["../source/group-by.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"group-by.js","sourceRoot":"","sources":["../source/group-by.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAG,CACtB,QAAa,EACb,QAAmC,EAClB,EAAE;IACnB,MAAM,aAAa,GAAG,EAAoB,CAAC;IAE3C,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE5B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;QAED,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,aAAa,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-property.d.ts","sourceRoot":"","sources":["../source/has-property.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"has-property.d.ts","sourceRoot":"","sources":["../source/has-property.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,UAAU,MAAM,KAAG,OACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-some-property.d.ts","sourceRoot":"","sources":["../source/has-some-property.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"has-some-property.d.ts","sourceRoot":"","sources":["../source/has-some-property.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,YAAY,MAAM,EAAE,KAAG,OACC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has.d.ts","sourceRoot":"","sources":["../source/has.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"has.d.ts","sourceRoot":"","sources":["../source/has.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,KAAG,OAoB3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-string.d.ts","sourceRoot":"","sources":["../source/hash-string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"hash-string.d.ts","sourceRoot":"","sources":["../source/hash-string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAS1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../source/head.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../source/head.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,KAAG,CAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-case.d.ts","sourceRoot":"","sources":["../source/header-case.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"header-case.d.ts","sourceRoot":"","sources":["../source/header-case.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,SAIlD,CAAC"}
|
package/distribution/http.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import type { RequestOptions } from "http";
|
|
2
|
+
import type { JsonArray, JsonObject, Primitive } from "type-fest";
|
|
3
|
+
export type HttpBody = Record<string, Primitive | JsonObject | JsonArray>;
|
|
4
4
|
export type HttpOptions = RequestOptions & {
|
|
5
5
|
maxContentLength?: number;
|
|
6
|
-
body?:
|
|
6
|
+
body?: HttpBody;
|
|
7
7
|
};
|
|
8
|
-
export type HttpResponse = {
|
|
8
|
+
export type HttpResponse<T = unknown> = {
|
|
9
9
|
method: string | undefined;
|
|
10
10
|
statusCode: number | undefined;
|
|
11
11
|
statusMessage: string | undefined;
|
|
12
|
-
data:
|
|
12
|
+
data: T;
|
|
13
13
|
headers: string[];
|
|
14
14
|
};
|
|
15
15
|
export declare class HttpError extends Error {
|
|
@@ -17,10 +17,10 @@ export declare class HttpError extends Error {
|
|
|
17
17
|
}
|
|
18
18
|
export declare const http: {
|
|
19
19
|
delete: (url: string, options?: HttpOptions) => Promise<HttpResponse>;
|
|
20
|
-
get: (url: string, options?: HttpOptions) => Promise<HttpResponse
|
|
20
|
+
get: <T>(url: string, options?: HttpOptions) => Promise<HttpResponse<T>>;
|
|
21
21
|
head: (url: string, options?: HttpOptions) => Promise<HttpResponse>;
|
|
22
22
|
patch: (url: string, options?: HttpOptions) => Promise<HttpResponse>;
|
|
23
|
-
post: (url: string, options?: HttpOptions) => Promise<HttpResponse
|
|
23
|
+
post: <T>(url: string, options?: HttpOptions) => Promise<HttpResponse<T>>;
|
|
24
24
|
put: (url: string, options?: HttpOptions) => Promise<HttpResponse>;
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../source/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../source/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkC,cAAc,EAAE,MAAM,MAAM,CAAC;AAG3E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA6GlE,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,CAAC;AAE1E,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG;IAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IACvC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,qBAAa,SAAU,SAAQ,KAAK;gBAChB,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,KAAK;CA2BxD;AAED,eAAO,MAAM,IAAI;kBACF,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC;UAC7D,CAAC,OAAO,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC1D,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC;iBACpD,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC;WAC3D,CAAC,OAAO,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;eAC5D,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC;CAChE,CAAC"}
|
package/distribution/http.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { globalAgent } from "http";
|
|
2
|
-
import { request } from "https";
|
|
3
|
-
import {
|
|
1
|
+
import { globalAgent as httpGlobalAgent, request as httpRequest } from "http";
|
|
2
|
+
import { globalAgent as httpsGlobalAgent, request as httpsRequest } from "https";
|
|
3
|
+
import { URL } from "url";
|
|
4
4
|
import { isObject } from "./is-object.js";
|
|
5
5
|
import { isUndefined } from "./is-undefined.js";
|
|
6
6
|
const sendRequest = (method, url, options) => new Promise((resolve, reject) => {
|
|
7
7
|
if (!isObject(options)) {
|
|
8
8
|
options = {};
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
const parsedUrl = new URL(url);
|
|
11
|
+
if (!parsedUrl) {
|
|
12
|
+
throw new Error("failed to parseURL");
|
|
13
|
+
}
|
|
14
|
+
const { globalAgent, request } = parsedUrl.protocol === "https:"
|
|
15
|
+
? { globalAgent: httpsGlobalAgent, request: httpsRequest }
|
|
16
|
+
: { globalAgent: httpGlobalAgent, request: httpRequest };
|
|
17
|
+
options = { ...options };
|
|
18
|
+
options.host = parsedUrl.host;
|
|
19
|
+
options.hostname = parsedUrl.hostname;
|
|
20
|
+
options.port = parsedUrl.port;
|
|
21
|
+
options.protocol = parsedUrl.protocol;
|
|
11
22
|
options.method = method.toLowerCase();
|
|
12
|
-
if (
|
|
23
|
+
if (parsedUrl.pathname) {
|
|
24
|
+
options.path = parsedUrl.pathname;
|
|
25
|
+
}
|
|
26
|
+
if (parsedUrl.search) {
|
|
27
|
+
options.path += parsedUrl.search;
|
|
28
|
+
}
|
|
29
|
+
if (options.protocol === "http:" || options.protocol === "https:") {
|
|
13
30
|
options.agent = globalAgent;
|
|
14
31
|
}
|
|
15
32
|
if (isUndefined(options.timeout)) {
|