@metamask/snaps-utils 0.30.0 → 0.31.0
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/dist/cronjob.d.ts +3 -3
- package/dist/cronjob.js +4 -7
- package/dist/cronjob.js.map +1 -1
- package/dist/eval-worker.js +24 -7
- package/dist/eval-worker.js.map +1 -1
- package/dist/eval.js +1 -2
- package/dist/eval.js.map +1 -1
- package/dist/fs.d.ts +9 -0
- package/dist/fs.js +24 -1
- package/dist/fs.js.map +1 -1
- package/dist/handlers.d.ts +2 -5
- package/dist/handlers.js.map +1 -1
- package/dist/iframe.js +1 -0
- package/dist/iframe.js.map +1 -1
- package/dist/iframe.test.browser.d.ts +1 -0
- package/dist/iframe.test.browser.js +15 -0
- package/dist/iframe.test.browser.js.map +1 -0
- package/dist/index.browser.d.ts +0 -2
- package/dist/index.browser.js +0 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/manifest/manifest.js +13 -20
- package/dist/manifest/manifest.js.map +1 -1
- package/dist/manifest/validation.d.ts +12 -12
- package/dist/mock.js +3 -3
- package/dist/mock.js.map +1 -1
- package/dist/namespace.js +2 -2
- package/dist/namespace.js.map +1 -1
- package/dist/npm.js +4 -4
- package/dist/npm.js.map +1 -1
- package/dist/post-process.js +5 -7
- package/dist/post-process.js.map +1 -1
- package/dist/snaps.d.ts +10 -6
- package/dist/snaps.js +16 -22
- package/dist/snaps.js.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/virtual-file/VirtualFile.js +4 -5
- package/dist/virtual-file/VirtualFile.js.map +1 -1
- package/package.json +30 -9
- package/dist/flatMap.d.ts +0 -22
- package/dist/flatMap.js +0 -38
- package/dist/flatMap.js.map +0 -1
- package/dist/object.d.ts +0 -8
- package/dist/object.js +0 -15
- package/dist/object.js.map +0 -1
package/dist/flatMap.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flatMap = exports.flatten = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Flattens an array of arrays of up to 1 level deep into a single array.
|
|
6
|
-
*
|
|
7
|
-
* This is a non-recursive implementation of `Array.prototype.flat`, which is
|
|
8
|
-
* only available in ES2019 and above.
|
|
9
|
-
*
|
|
10
|
-
* @param array - The array to flatten.
|
|
11
|
-
* @returns The flattened array.
|
|
12
|
-
*/
|
|
13
|
-
const flatten = (array) => {
|
|
14
|
-
return array.reduce((acc, cur) => {
|
|
15
|
-
if (Array.isArray(cur)) {
|
|
16
|
-
return [...acc, ...cur];
|
|
17
|
-
}
|
|
18
|
-
acc.push(cur);
|
|
19
|
-
return acc;
|
|
20
|
-
}, []);
|
|
21
|
-
};
|
|
22
|
-
exports.flatten = flatten;
|
|
23
|
-
/**
|
|
24
|
-
* Maps an array of values using the provided callback, then flattens the result
|
|
25
|
-
* into a single array, up to 1 level deep.
|
|
26
|
-
*
|
|
27
|
-
* This is a non-recursive implementation of `Array.prototype.flatMap`, which is
|
|
28
|
-
* only available in ES2019 and above.
|
|
29
|
-
*
|
|
30
|
-
* @param array - The array to map.
|
|
31
|
-
* @param callback - The callback to map each value with.
|
|
32
|
-
* @returns The mapped and flattened array.
|
|
33
|
-
*/
|
|
34
|
-
const flatMap = (array, callback) => {
|
|
35
|
-
return (0, exports.flatten)(array.map(callback));
|
|
36
|
-
};
|
|
37
|
-
exports.flatMap = flatMap;
|
|
38
|
-
//# sourceMappingURL=flatMap.js.map
|
package/dist/flatMap.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flatMap.js","sourceRoot":"","sources":["../src/flatMap.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACI,MAAM,OAAO,GAAG,CAAO,KAAwB,EAAU,EAAE;IAChE,OAAO,KAAK,CAAC,MAAM,CAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACvC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACtB,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC;SACzB;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB;AAEF;;;;;;;;;;GAUG;AACI,MAAM,OAAO,GAAG,CACrB,KAAa,EACb,QAA4C,EAClC,EAAE;IACZ,OAAO,IAAA,eAAO,EAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB","sourcesContent":["/**\n * Flattens an array of arrays of up to 1 level deep into a single array.\n *\n * This is a non-recursive implementation of `Array.prototype.flat`, which is\n * only available in ES2019 and above.\n *\n * @param array - The array to flatten.\n * @returns The flattened array.\n */\nexport const flatten = <Type>(array: (Type | Type[])[]): Type[] => {\n return array.reduce<Type[]>((acc, cur) => {\n if (Array.isArray(cur)) {\n return [...acc, ...cur];\n }\n acc.push(cur);\n return acc;\n }, []);\n};\n\n/**\n * Maps an array of values using the provided callback, then flattens the result\n * into a single array, up to 1 level deep.\n *\n * This is a non-recursive implementation of `Array.prototype.flatMap`, which is\n * only available in ES2019 and above.\n *\n * @param array - The array to map.\n * @param callback - The callback to map each value with.\n * @returns The mapped and flattened array.\n */\nexport const flatMap = <Type, Return>(\n array: Type[],\n callback: (value: Type) => Return | Return[],\n): Return[] => {\n return flatten(array.map(callback));\n};\n"]}
|
package/dist/object.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An alternative implementation of `Object.fromEntries`, which works in older
|
|
3
|
-
* browsers.
|
|
4
|
-
*
|
|
5
|
-
* @param entries - The entries to convert to an object.
|
|
6
|
-
* @returns The object.
|
|
7
|
-
*/
|
|
8
|
-
export declare const fromEntries: <Key extends string, Value>(entries: readonly (readonly [Key, Value])[]) => Record<Key, Value>;
|
package/dist/object.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fromEntries = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* An alternative implementation of `Object.fromEntries`, which works in older
|
|
6
|
-
* browsers.
|
|
7
|
-
*
|
|
8
|
-
* @param entries - The entries to convert to an object.
|
|
9
|
-
* @returns The object.
|
|
10
|
-
*/
|
|
11
|
-
const fromEntries = (entries) => {
|
|
12
|
-
return entries.reduce((acc, [key, value]) => (Object.assign(Object.assign({}, acc), { [key]: value })), {});
|
|
13
|
-
};
|
|
14
|
-
exports.fromEntries = fromEntries;
|
|
15
|
-
//# sourceMappingURL=object.js.map
|
package/dist/object.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACI,MAAM,WAAW,GAAG,CACzB,OAA2C,EACvB,EAAE;IACtB,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,iCAAM,GAAG,KAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAG,EACjD,EAAE,CACH,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,WAAW,eAOtB","sourcesContent":["/**\n * An alternative implementation of `Object.fromEntries`, which works in older\n * browsers.\n *\n * @param entries - The entries to convert to an object.\n * @returns The object.\n */\nexport const fromEntries = <Key extends string, Value>(\n entries: readonly (readonly [Key, Value])[],\n): Record<Key, Value> => {\n return entries.reduce<Record<string, Value>>(\n (acc, [key, value]) => ({ ...acc, [key]: value }),\n {},\n );\n};\n"]}
|