@stryke/helpers 0.10.19 → 0.10.20
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/CHANGELOG.md +8 -0
- package/dist/_virtual/_rolldown/runtime.cjs +19 -0
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/arg-identity.cjs +9 -1
- package/dist/arg-identity.mjs +4 -1
- package/dist/arg-identity.mjs.map +1 -1
- package/dist/arg-identity.test.cjs +12 -0
- package/dist/arg-identity.test.d.cts +1 -0
- package/dist/arg-identity.test.d.mts +1 -0
- package/dist/arg-identity.test.mjs +14 -0
- package/dist/arg-identity.test.mjs.map +1 -0
- package/dist/deep-clone.cjs +9 -1
- package/dist/deep-clone.mjs +3 -1
- package/dist/deep-clone.mjs.map +1 -1
- package/dist/deep-clone.test.cjs +12 -0
- package/dist/deep-clone.test.d.cts +1 -0
- package/dist/deep-clone.test.d.mts +1 -0
- package/dist/deep-clone.test.mjs +14 -0
- package/dist/deep-clone.test.mjs.map +1 -0
- package/dist/deep-merge.cjs +9 -1
- package/dist/deep-merge.mjs +3 -1
- package/dist/deep-merge.mjs.map +1 -1
- package/dist/deep-merge.test.cjs +12 -0
- package/dist/deep-merge.test.d.cts +1 -0
- package/dist/deep-merge.test.d.mts +1 -0
- package/dist/deep-merge.test.mjs +14 -0
- package/dist/deep-merge.test.mjs.map +1 -0
- package/dist/filter-empty.cjs +9 -1
- package/dist/filter-empty.mjs +3 -1
- package/dist/filter-empty.mjs.map +1 -1
- package/dist/filter-empty.test.cjs +12 -0
- package/dist/filter-empty.test.d.cts +1 -0
- package/dist/filter-empty.test.d.mts +1 -0
- package/dist/filter-empty.test.mjs +14 -0
- package/dist/filter-empty.test.mjs.map +1 -0
- package/dist/flatten-object.cjs +9 -1
- package/dist/flatten-object.mjs +3 -1
- package/dist/flatten-object.mjs.map +1 -1
- package/dist/flatten-object.test.cjs +12 -0
- package/dist/flatten-object.test.d.cts +1 -0
- package/dist/flatten-object.test.d.mts +1 -0
- package/dist/flatten-object.test.mjs +14 -0
- package/dist/flatten-object.test.mjs.map +1 -0
- package/dist/get-field.cjs +9 -1
- package/dist/get-field.mjs +3 -1
- package/dist/get-field.mjs.map +1 -1
- package/dist/get-field.test.cjs +12 -0
- package/dist/get-field.test.d.cts +1 -0
- package/dist/get-field.test.d.mts +1 -0
- package/dist/get-field.test.mjs +14 -0
- package/dist/get-field.test.mjs.map +1 -0
- package/dist/get-ordered-by.cjs +9 -1
- package/dist/get-ordered-by.mjs +4 -1
- package/dist/get-ordered-by.mjs.map +1 -1
- package/dist/get-ordered-by.test.cjs +12 -0
- package/dist/get-ordered-by.test.d.cts +1 -0
- package/dist/get-ordered-by.test.d.mts +1 -0
- package/dist/get-ordered-by.test.mjs +14 -0
- package/dist/get-ordered-by.test.mjs.map +1 -0
- package/dist/get-unique.cjs +12 -1
- package/dist/get-unique.mjs +7 -1
- package/dist/get-unique.mjs.map +1 -1
- package/dist/get-unique.test.cjs +12 -0
- package/dist/get-unique.test.d.cts +1 -0
- package/dist/get-unique.test.d.mts +1 -0
- package/dist/get-unique.test.mjs +14 -0
- package/dist/get-unique.test.mjs.map +1 -0
- package/dist/identity.cjs +9 -1
- package/dist/identity.mjs +4 -1
- package/dist/identity.mjs.map +1 -1
- package/dist/identity.test.cjs +12 -0
- package/dist/identity.test.d.cts +1 -0
- package/dist/identity.test.d.mts +1 -0
- package/dist/identity.test.mjs +14 -0
- package/dist/identity.test.mjs.map +1 -0
- package/dist/index.cjs +41 -0
- package/dist/index.mjs +37 -1
- package/dist/index.mjs.map +1 -0
- package/dist/index.test.cjs +12 -0
- package/dist/index.test.d.cts +1 -0
- package/dist/index.test.d.mts +1 -0
- package/dist/index.test.mjs +14 -0
- package/dist/index.test.mjs.map +1 -0
- package/dist/is-equal.cjs +9 -1
- package/dist/is-equal.mjs +3 -1
- package/dist/is-equal.mjs.map +1 -1
- package/dist/is-equal.test.cjs +12 -0
- package/dist/is-equal.test.d.cts +1 -0
- package/dist/is-equal.test.d.mts +1 -0
- package/dist/is-equal.test.mjs +14 -0
- package/dist/is-equal.test.mjs.map +1 -0
- package/dist/lru-cache.cjs +9 -1
- package/dist/lru-cache.mjs +4 -1
- package/dist/lru-cache.mjs.map +1 -1
- package/dist/lru-cache.test.cjs +12 -0
- package/dist/lru-cache.test.d.cts +1 -0
- package/dist/lru-cache.test.d.mts +1 -0
- package/dist/lru-cache.test.mjs +14 -0
- package/dist/lru-cache.test.mjs.map +1 -0
- package/dist/match-sorter.cjs +12 -0
- package/dist/match-sorter.mjs +7 -1
- package/dist/match-sorter.mjs.map +1 -1
- package/dist/match-sorter.test.cjs +12 -0
- package/dist/match-sorter.test.d.cts +1 -0
- package/dist/match-sorter.test.d.mts +1 -0
- package/dist/match-sorter.test.mjs +14 -0
- package/dist/match-sorter.test.mjs.map +1 -0
- package/dist/memoize.cjs +9 -1
- package/dist/memoize.mjs +4 -1
- package/dist/memoize.mjs.map +1 -1
- package/dist/memoize.test.cjs +12 -0
- package/dist/memoize.test.d.cts +1 -0
- package/dist/memoize.test.d.mts +1 -0
- package/dist/memoize.test.mjs +14 -0
- package/dist/memoize.test.mjs.map +1 -0
- package/dist/noop.cjs +12 -1
- package/dist/noop.mjs +7 -1
- package/dist/noop.mjs.map +1 -1
- package/dist/noop.test.cjs +12 -0
- package/dist/noop.test.d.cts +1 -0
- package/dist/noop.test.d.mts +1 -0
- package/dist/noop.test.mjs +14 -0
- package/dist/noop.test.mjs.map +1 -0
- package/dist/omit.cjs +9 -1
- package/dist/omit.mjs +4 -1
- package/dist/omit.mjs.map +1 -1
- package/dist/omit.test.cjs +12 -0
- package/dist/omit.test.d.cts +1 -0
- package/dist/omit.test.d.mts +1 -0
- package/dist/omit.test.mjs +14 -0
- package/dist/omit.test.mjs.map +1 -0
- package/dist/pick.cjs +9 -1
- package/dist/pick.mjs +4 -1
- package/dist/pick.mjs.map +1 -1
- package/dist/pick.test.cjs +12 -0
- package/dist/pick.test.d.cts +1 -0
- package/dist/pick.test.d.mts +1 -0
- package/dist/pick.test.mjs +14 -0
- package/dist/pick.test.mjs.map +1 -0
- package/dist/remove-accents.cjs +12 -1
- package/dist/remove-accents.mjs +7 -1
- package/dist/remove-accents.mjs.map +1 -1
- package/dist/remove-accents.test.cjs +12 -0
- package/dist/remove-accents.test.d.cts +1 -0
- package/dist/remove-accents.test.d.mts +1 -0
- package/dist/remove-accents.test.mjs +14 -0
- package/dist/remove-accents.test.mjs.map +1 -0
- package/dist/remove-empty-items.cjs +9 -1
- package/dist/remove-empty-items.mjs +4 -1
- package/dist/remove-empty-items.mjs.map +1 -1
- package/dist/remove-empty-items.test.cjs +12 -0
- package/dist/remove-empty-items.test.d.cts +1 -0
- package/dist/remove-empty-items.test.d.mts +1 -0
- package/dist/remove-empty-items.test.mjs +14 -0
- package/dist/remove-empty-items.test.mjs.map +1 -0
- package/dist/set-field.cjs +9 -1
- package/dist/set-field.mjs +3 -1
- package/dist/set-field.mjs.map +1 -1
- package/dist/set-field.test.cjs +12 -0
- package/dist/set-field.test.d.cts +1 -0
- package/dist/set-field.test.d.mts +1 -0
- package/dist/set-field.test.mjs +14 -0
- package/dist/set-field.test.mjs.map +1 -0
- package/dist/to-deep-key.cjs +12 -1
- package/dist/to-deep-key.mjs +6 -1
- package/dist/to-deep-key.mjs.map +1 -1
- package/dist/to-deep-key.test.cjs +12 -0
- package/dist/to-deep-key.test.d.cts +1 -0
- package/dist/to-deep-key.test.d.mts +1 -0
- package/dist/to-deep-key.test.mjs +14 -0
- package/dist/to-deep-key.test.mjs.map +1 -0
- package/dist/to-path.cjs +9 -1
- package/dist/to-path.mjs +4 -1
- package/dist/to-path.mjs.map +1 -1
- package/dist/to-path.test.cjs +12 -0
- package/dist/to-path.test.d.cts +1 -0
- package/dist/to-path.test.d.mts +1 -0
- package/dist/to-path.test.mjs +14 -0
- package/dist/to-path.test.mjs.map +1 -0
- package/dist/unflatten-object.cjs +9 -1
- package/dist/unflatten-object.mjs +3 -1
- package/dist/unflatten-object.mjs.map +1 -1
- package/dist/unflatten-object.test.cjs +12 -0
- package/dist/unflatten-object.test.d.cts +1 -0
- package/dist/unflatten-object.test.d.mts +1 -0
- package/dist/unflatten-object.test.mjs +14 -0
- package/dist/unflatten-object.test.mjs.map +1 -0
- package/dist/union.cjs +9 -1
- package/dist/union.mjs +3 -1
- package/dist/union.mjs.map +1 -1
- package/dist/union.test.cjs +12 -0
- package/dist/union.test.d.cts +1 -0
- package/dist/union.test.d.mts +1 -0
- package/dist/union.test.mjs +14 -0
- package/dist/union.test.mjs.map +1 -0
- package/package.json +101 -5
package/dist/omit.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.mjs","names":[],"sources":["../src/omit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @param obj - The object to omit keys from.\n * @param keys - An array of keys to be omitted from the object.\n * @returns A new object with the specified keys omitted.\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n * ```\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(\n obj: T,\n keys: readonly K[]\n): Omit<T, K> {\n const result = { ...obj };\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key) {\n delete result[key];\n }\n }\n\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"omit.mjs","names":[],"sources":["../src/omit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @param obj - The object to omit keys from.\n * @param keys - An array of keys to be omitted from the object.\n * @returns A new object with the specified keys omitted.\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n * ```\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(\n obj: T,\n keys: readonly K[]\n): Omit<T, K> {\n const result = { ...obj };\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key) {\n delete result[key];\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,KACd,KACA,MACY;CACZ,MAAM,SAAS,EAAE,GAAG,KAAK;AAEzB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,MAAM,KAAK;AACjB,MAAI,IACF,QAAO,OAAO;;AAIlB,QAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_omit = require('./omit.cjs');
|
|
2
|
+
let vitest = require("vitest");
|
|
3
|
+
|
|
4
|
+
//#region src/omit.test.ts
|
|
5
|
+
(0, vitest.describe)("omit.ts exports", () => {
|
|
6
|
+
(0, vitest.it)("loads module exports", () => {
|
|
7
|
+
(0, vitest.expect)(require_omit.omit_exports).toBeDefined();
|
|
8
|
+
(0, vitest.expect)(typeof require_omit.omit_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { omit_exports } from "./omit.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/omit.test.ts
|
|
5
|
+
describe("omit.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(omit_exports).toBeDefined();
|
|
8
|
+
expect(typeof omit_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=omit.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.test.mjs","names":["moduleExports"],"sources":["../src/omit.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./omit.ts\";\n\ndescribe(\"omit.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,yBAAyB;AAChC,IAAG,8BAA8B;AAC/B,SAAOA,aAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,aAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/pick.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/pick.ts
|
|
5
|
+
var pick_exports = /* @__PURE__ */ require_runtime.__exportAll({ pick: () => pick });
|
|
4
6
|
/**
|
|
5
7
|
* Creates a new object composed of the picked object properties.
|
|
6
8
|
*
|
|
@@ -28,4 +30,10 @@ function pick(obj, keys) {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
//#endregion
|
|
31
|
-
exports.pick = pick;
|
|
33
|
+
exports.pick = pick;
|
|
34
|
+
Object.defineProperty(exports, 'pick_exports', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return pick_exports;
|
|
38
|
+
}
|
|
39
|
+
});
|
package/dist/pick.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/pick.ts
|
|
4
|
+
var pick_exports = /* @__PURE__ */ __exportAll({ pick: () => pick });
|
|
2
5
|
/**
|
|
3
6
|
* Creates a new object composed of the picked object properties.
|
|
4
7
|
*
|
|
@@ -26,5 +29,5 @@ function pick(obj, keys) {
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
//#endregion
|
|
29
|
-
export { pick };
|
|
32
|
+
export { pick, pick_exports };
|
|
30
33
|
//# sourceMappingURL=pick.mjs.map
|
package/dist/pick.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.mjs","names":[],"sources":["../src/pick.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @param obj - The object to pick keys from.\n * @param keys - An array of keys to be picked from the object.\n * @returns A new object with the specified keys picked.\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n * ```\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(\n obj: T,\n keys: readonly K[]\n): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (key && Object.hasOwn(obj, key)) {\n result[key] = obj[key];\n }\n }\n\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pick.mjs","names":[],"sources":["../src/pick.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @param obj - The object to pick keys from.\n * @param keys - An array of keys to be picked from the object.\n * @returns A new object with the specified keys picked.\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n * ```\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(\n obj: T,\n keys: readonly K[]\n): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (key && Object.hasOwn(obj, key)) {\n result[key] = obj[key];\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,KACd,KACA,MACY;CACZ,MAAM,SAAS,EAAE;AAEjB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,MAAM,KAAK;AAEjB,MAAI,OAAO,OAAO,OAAO,KAAK,IAAI,CAChC,QAAO,OAAO,IAAI;;AAItB,QAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_pick = require('./pick.cjs');
|
|
2
|
+
let vitest = require("vitest");
|
|
3
|
+
|
|
4
|
+
//#region src/pick.test.ts
|
|
5
|
+
(0, vitest.describe)("pick.ts exports", () => {
|
|
6
|
+
(0, vitest.it)("loads module exports", () => {
|
|
7
|
+
(0, vitest.expect)(require_pick.pick_exports).toBeDefined();
|
|
8
|
+
(0, vitest.expect)(typeof require_pick.pick_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { pick_exports } from "./pick.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/pick.test.ts
|
|
5
|
+
describe("pick.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(pick_exports).toBeDefined();
|
|
8
|
+
expect(typeof pick_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=pick.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick.test.mjs","names":["moduleExports"],"sources":["../src/pick.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./pick.ts\";\n\ndescribe(\"pick.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,yBAAyB;AAChC,IAAG,8BAA8B;AAC/B,SAAOA,aAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,aAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/remove-accents.cjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/remove-accents.ts
|
|
5
|
+
var remove_accents_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
6
|
+
characterMap: () => characterMap,
|
|
7
|
+
removeAccents: () => removeAccents
|
|
8
|
+
});
|
|
4
9
|
const characterMap = {
|
|
5
10
|
À: "A",
|
|
6
11
|
Á: "A",
|
|
@@ -412,4 +417,10 @@ const removeAccents = (str) => str.replace(new RegExp(Object.keys(characterMap).
|
|
|
412
417
|
|
|
413
418
|
//#endregion
|
|
414
419
|
exports.characterMap = characterMap;
|
|
415
|
-
exports.removeAccents = removeAccents;
|
|
420
|
+
exports.removeAccents = removeAccents;
|
|
421
|
+
Object.defineProperty(exports, 'remove_accents_exports', {
|
|
422
|
+
enumerable: true,
|
|
423
|
+
get: function () {
|
|
424
|
+
return remove_accents_exports;
|
|
425
|
+
}
|
|
426
|
+
});
|
package/dist/remove-accents.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/remove-accents.ts
|
|
4
|
+
var remove_accents_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
characterMap: () => characterMap,
|
|
6
|
+
removeAccents: () => removeAccents
|
|
7
|
+
});
|
|
2
8
|
const characterMap = {
|
|
3
9
|
À: "A",
|
|
4
10
|
Á: "A",
|
|
@@ -409,5 +415,5 @@ const characterMap = {
|
|
|
409
415
|
const removeAccents = (str) => str.replace(new RegExp(Object.keys(characterMap).join("|"), "g"), (match) => characterMap[match]);
|
|
410
416
|
|
|
411
417
|
//#endregion
|
|
412
|
-
export { characterMap, removeAccents };
|
|
418
|
+
export { characterMap, removeAccents, remove_accents_exports };
|
|
413
419
|
//# sourceMappingURL=remove-accents.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-accents.mjs","names":[],"sources":["../src/remove-accents.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const characterMap: Record<string, string> = {\n À: \"A\",\n Á: \"A\",\n Â: \"A\",\n Ã: \"A\",\n Ä: \"A\",\n Å: \"A\",\n Ấ: \"A\",\n Ắ: \"A\",\n Ẳ: \"A\",\n Ẵ: \"A\",\n Ặ: \"A\",\n Æ: \"AE\",\n Ầ: \"A\",\n Ằ: \"A\",\n Ȃ: \"A\",\n Ç: \"C\",\n Ḉ: \"C\",\n È: \"E\",\n É: \"E\",\n Ê: \"E\",\n Ë: \"E\",\n Ế: \"E\",\n Ḗ: \"E\",\n Ề: \"E\",\n Ḕ: \"E\",\n Ḝ: \"E\",\n Ȇ: \"E\",\n Ì: \"I\",\n Í: \"I\",\n Î: \"I\",\n Ï: \"I\",\n Ḯ: \"I\",\n Ȋ: \"I\",\n Ð: \"D\",\n Ñ: \"N\",\n Ò: \"O\",\n Ó: \"O\",\n Ô: \"O\",\n Õ: \"O\",\n Ö: \"O\",\n Ø: \"O\",\n Ố: \"O\",\n Ṍ: \"O\",\n Ṓ: \"O\",\n Ȏ: \"O\",\n Ù: \"U\",\n Ú: \"U\",\n Û: \"U\",\n Ü: \"U\",\n Ý: \"Y\",\n à: \"a\",\n á: \"a\",\n â: \"a\",\n ã: \"a\",\n ä: \"a\",\n å: \"a\",\n ấ: \"a\",\n ắ: \"a\",\n ẳ: \"a\",\n ẵ: \"a\",\n ặ: \"a\",\n æ: \"ae\",\n ầ: \"a\",\n ằ: \"a\",\n ȃ: \"a\",\n ç: \"c\",\n ḉ: \"c\",\n è: \"e\",\n é: \"e\",\n ê: \"e\",\n ë: \"e\",\n ế: \"e\",\n ḗ: \"e\",\n ề: \"e\",\n ḕ: \"e\",\n ḝ: \"e\",\n ȇ: \"e\",\n ì: \"i\",\n í: \"i\",\n î: \"i\",\n ï: \"i\",\n ḯ: \"i\",\n ȋ: \"i\",\n ð: \"d\",\n ñ: \"n\",\n ò: \"o\",\n ó: \"o\",\n ô: \"o\",\n õ: \"o\",\n ö: \"o\",\n ø: \"o\",\n ố: \"o\",\n ṍ: \"o\",\n ṓ: \"o\",\n ȏ: \"o\",\n ù: \"u\",\n ú: \"u\",\n û: \"u\",\n ü: \"u\",\n ý: \"y\",\n ÿ: \"y\",\n Ā: \"A\",\n ā: \"a\",\n Ă: \"A\",\n ă: \"a\",\n Ą: \"A\",\n ą: \"a\",\n Ć: \"C\",\n ć: \"c\",\n Ĉ: \"C\",\n ĉ: \"c\",\n Ċ: \"C\",\n ċ: \"c\",\n Č: \"C\",\n č: \"c\",\n C̆: \"C\",\n c̆: \"c\",\n Ď: \"D\",\n ď: \"d\",\n Đ: \"D\",\n đ: \"d\",\n Ē: \"E\",\n ē: \"e\",\n Ĕ: \"E\",\n ĕ: \"e\",\n Ė: \"E\",\n ė: \"e\",\n Ę: \"E\",\n ę: \"e\",\n Ě: \"E\",\n ě: \"e\",\n Ĝ: \"G\",\n Ǵ: \"G\",\n ĝ: \"g\",\n ǵ: \"g\",\n Ğ: \"G\",\n ğ: \"g\",\n Ġ: \"G\",\n ġ: \"g\",\n Ģ: \"G\",\n ģ: \"g\",\n Ĥ: \"H\",\n ĥ: \"h\",\n Ħ: \"H\",\n ħ: \"h\",\n Ḫ: \"H\",\n ḫ: \"h\",\n Ĩ: \"I\",\n ĩ: \"i\",\n Ī: \"I\",\n ī: \"i\",\n Ĭ: \"I\",\n ĭ: \"i\",\n Į: \"I\",\n į: \"i\",\n İ: \"I\",\n ı: \"i\",\n IJ: \"IJ\",\n ij: \"ij\",\n Ĵ: \"J\",\n ĵ: \"j\",\n Ķ: \"K\",\n ķ: \"k\",\n Ḱ: \"K\",\n ḱ: \"k\",\n K̆: \"K\",\n k̆: \"k\",\n Ĺ: \"L\",\n ĺ: \"l\",\n Ļ: \"L\",\n ļ: \"l\",\n Ľ: \"L\",\n ľ: \"l\",\n Ŀ: \"L\",\n ŀ: \"l\",\n Ł: \"l\",\n ł: \"l\",\n Ḿ: \"M\",\n ḿ: \"m\",\n M̆: \"M\",\n m̆: \"m\",\n Ń: \"N\",\n ń: \"n\",\n Ņ: \"N\",\n ņ: \"n\",\n Ň: \"N\",\n ň: \"n\",\n ʼn: \"n\",\n N̆: \"N\",\n n̆: \"n\",\n Ō: \"O\",\n ō: \"o\",\n Ŏ: \"O\",\n ŏ: \"o\",\n Ő: \"O\",\n ő: \"o\",\n Œ: \"OE\",\n œ: \"oe\",\n P̆: \"P\",\n p̆: \"p\",\n Ŕ: \"R\",\n ŕ: \"r\",\n Ŗ: \"R\",\n ŗ: \"r\",\n Ř: \"R\",\n ř: \"r\",\n R̆: \"R\",\n r̆: \"r\",\n Ȓ: \"R\",\n ȓ: \"r\",\n Ś: \"S\",\n ś: \"s\",\n Ŝ: \"S\",\n ŝ: \"s\",\n Ş: \"S\",\n Ș: \"S\",\n ș: \"s\",\n ş: \"s\",\n Š: \"S\",\n š: \"s\",\n Ţ: \"T\",\n ţ: \"t\",\n ț: \"t\",\n Ț: \"T\",\n Ť: \"T\",\n ť: \"t\",\n Ŧ: \"T\",\n ŧ: \"t\",\n T̆: \"T\",\n t̆: \"t\",\n Ũ: \"U\",\n ũ: \"u\",\n Ū: \"U\",\n ū: \"u\",\n Ŭ: \"U\",\n ŭ: \"u\",\n Ů: \"U\",\n ů: \"u\",\n Ű: \"U\",\n ű: \"u\",\n Ų: \"U\",\n ų: \"u\",\n Ȗ: \"U\",\n ȗ: \"u\",\n V̆: \"V\",\n v̆: \"v\",\n Ŵ: \"W\",\n ŵ: \"w\",\n Ẃ: \"W\",\n ẃ: \"w\",\n X̆: \"X\",\n x̆: \"x\",\n Ŷ: \"Y\",\n ŷ: \"y\",\n Ÿ: \"Y\",\n Y̆: \"Y\",\n y̆: \"y\",\n Ź: \"Z\",\n ź: \"z\",\n Ż: \"Z\",\n ż: \"z\",\n Ž: \"Z\",\n ž: \"z\",\n ſ: \"s\",\n ƒ: \"f\",\n Ơ: \"O\",\n ơ: \"o\",\n Ư: \"U\",\n ư: \"u\",\n Ǎ: \"A\",\n ǎ: \"a\",\n Ǐ: \"I\",\n ǐ: \"i\",\n Ǒ: \"O\",\n ǒ: \"o\",\n Ǔ: \"U\",\n ǔ: \"u\",\n Ǖ: \"U\",\n ǖ: \"u\",\n Ǘ: \"U\",\n ǘ: \"u\",\n Ǚ: \"U\",\n ǚ: \"u\",\n Ǜ: \"U\",\n ǜ: \"u\",\n Ứ: \"U\",\n ứ: \"u\",\n Ṹ: \"U\",\n ṹ: \"u\",\n Ǻ: \"A\",\n ǻ: \"a\",\n Ǽ: \"AE\",\n ǽ: \"ae\",\n Ǿ: \"O\",\n ǿ: \"o\",\n Þ: \"TH\",\n þ: \"th\",\n Ṕ: \"P\",\n ṕ: \"p\",\n Ṥ: \"S\",\n ṥ: \"s\",\n X́: \"X\",\n x́: \"x\",\n Ѓ: \"Г\",\n ѓ: \"г\",\n Ќ: \"К\",\n ќ: \"к\",\n A̋: \"A\",\n a̋: \"a\",\n E̋: \"E\",\n e̋: \"e\",\n I̋: \"I\",\n i̋: \"i\",\n Ǹ: \"N\",\n ǹ: \"n\",\n Ồ: \"O\",\n ồ: \"o\",\n Ṑ: \"O\",\n ṑ: \"o\",\n Ừ: \"U\",\n ừ: \"u\",\n Ẁ: \"W\",\n ẁ: \"w\",\n Ỳ: \"Y\",\n ỳ: \"y\",\n Ȁ: \"A\",\n ȁ: \"a\",\n Ȅ: \"E\",\n ȅ: \"e\",\n Ȉ: \"I\",\n ȉ: \"i\",\n Ȍ: \"O\",\n ȍ: \"o\",\n Ȑ: \"R\",\n ȑ: \"r\",\n Ȕ: \"U\",\n ȕ: \"u\",\n B̌: \"B\",\n b̌: \"b\",\n Č̣: \"C\",\n č̣: \"c\",\n Ê̌: \"E\",\n ê̌: \"e\",\n F̌: \"F\",\n f̌: \"f\",\n Ǧ: \"G\",\n ǧ: \"g\",\n Ȟ: \"H\",\n ȟ: \"h\",\n J̌: \"J\",\n ǰ: \"j\",\n Ǩ: \"K\",\n ǩ: \"k\",\n M̌: \"M\",\n m̌: \"m\",\n P̌: \"P\",\n p̌: \"p\",\n Q̌: \"Q\",\n q̌: \"q\",\n Ř̩: \"R\",\n ř̩: \"r\",\n Ṧ: \"S\",\n ṧ: \"s\",\n V̌: \"V\",\n v̌: \"v\",\n W̌: \"W\",\n w̌: \"w\",\n X̌: \"X\",\n x̌: \"x\",\n Y̌: \"Y\",\n y̌: \"y\",\n A̧: \"A\",\n a̧: \"a\",\n B̧: \"B\",\n b̧: \"b\",\n Ḑ: \"D\",\n ḑ: \"d\",\n Ȩ: \"E\",\n ȩ: \"e\",\n Ɛ̧: \"E\",\n ɛ̧: \"e\",\n Ḩ: \"H\",\n ḩ: \"h\",\n I̧: \"I\",\n i̧: \"i\",\n Ɨ̧: \"I\",\n ɨ̧: \"i\",\n M̧: \"M\",\n m̧: \"m\",\n O̧: \"O\",\n o̧: \"o\",\n Q̧: \"Q\",\n q̧: \"q\",\n U̧: \"U\",\n u̧: \"u\",\n X̧: \"X\",\n x̧: \"x\",\n Z̧: \"Z\",\n z̧: \"z\"\n};\n\n/**\n * Removes accents from a string.\n *\n * @param str - The string to remove accents from\n * @returns The string without accents\n */\nexport const removeAccents = (str: string) =>\n str.replace(\n // eslint-disable-next-line regexp/no-dupe-disjunctions, regexp/prefer-character-class\n new RegExp(Object.keys(characterMap).join(\"|\"), \"g\"),\n match => characterMap[match]!\n );\n"],"mappings":";AAkBA,MAAa,eAAuC;CAClD,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;;;;;;;AAQD,MAAa,iBAAiB,QAC5B,IAAI,QAEF,IAAI,OAAO,OAAO,KAAK,aAAa,CAAC,KAAK,IAAI,EAAE,IAAI,GACpD,UAAS,aAAa,OACvB"}
|
|
1
|
+
{"version":3,"file":"remove-accents.mjs","names":[],"sources":["../src/remove-accents.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const characterMap: Record<string, string> = {\n À: \"A\",\n Á: \"A\",\n Â: \"A\",\n Ã: \"A\",\n Ä: \"A\",\n Å: \"A\",\n Ấ: \"A\",\n Ắ: \"A\",\n Ẳ: \"A\",\n Ẵ: \"A\",\n Ặ: \"A\",\n Æ: \"AE\",\n Ầ: \"A\",\n Ằ: \"A\",\n Ȃ: \"A\",\n Ç: \"C\",\n Ḉ: \"C\",\n È: \"E\",\n É: \"E\",\n Ê: \"E\",\n Ë: \"E\",\n Ế: \"E\",\n Ḗ: \"E\",\n Ề: \"E\",\n Ḕ: \"E\",\n Ḝ: \"E\",\n Ȇ: \"E\",\n Ì: \"I\",\n Í: \"I\",\n Î: \"I\",\n Ï: \"I\",\n Ḯ: \"I\",\n Ȋ: \"I\",\n Ð: \"D\",\n Ñ: \"N\",\n Ò: \"O\",\n Ó: \"O\",\n Ô: \"O\",\n Õ: \"O\",\n Ö: \"O\",\n Ø: \"O\",\n Ố: \"O\",\n Ṍ: \"O\",\n Ṓ: \"O\",\n Ȏ: \"O\",\n Ù: \"U\",\n Ú: \"U\",\n Û: \"U\",\n Ü: \"U\",\n Ý: \"Y\",\n à: \"a\",\n á: \"a\",\n â: \"a\",\n ã: \"a\",\n ä: \"a\",\n å: \"a\",\n ấ: \"a\",\n ắ: \"a\",\n ẳ: \"a\",\n ẵ: \"a\",\n ặ: \"a\",\n æ: \"ae\",\n ầ: \"a\",\n ằ: \"a\",\n ȃ: \"a\",\n ç: \"c\",\n ḉ: \"c\",\n è: \"e\",\n é: \"e\",\n ê: \"e\",\n ë: \"e\",\n ế: \"e\",\n ḗ: \"e\",\n ề: \"e\",\n ḕ: \"e\",\n ḝ: \"e\",\n ȇ: \"e\",\n ì: \"i\",\n í: \"i\",\n î: \"i\",\n ï: \"i\",\n ḯ: \"i\",\n ȋ: \"i\",\n ð: \"d\",\n ñ: \"n\",\n ò: \"o\",\n ó: \"o\",\n ô: \"o\",\n õ: \"o\",\n ö: \"o\",\n ø: \"o\",\n ố: \"o\",\n ṍ: \"o\",\n ṓ: \"o\",\n ȏ: \"o\",\n ù: \"u\",\n ú: \"u\",\n û: \"u\",\n ü: \"u\",\n ý: \"y\",\n ÿ: \"y\",\n Ā: \"A\",\n ā: \"a\",\n Ă: \"A\",\n ă: \"a\",\n Ą: \"A\",\n ą: \"a\",\n Ć: \"C\",\n ć: \"c\",\n Ĉ: \"C\",\n ĉ: \"c\",\n Ċ: \"C\",\n ċ: \"c\",\n Č: \"C\",\n č: \"c\",\n C̆: \"C\",\n c̆: \"c\",\n Ď: \"D\",\n ď: \"d\",\n Đ: \"D\",\n đ: \"d\",\n Ē: \"E\",\n ē: \"e\",\n Ĕ: \"E\",\n ĕ: \"e\",\n Ė: \"E\",\n ė: \"e\",\n Ę: \"E\",\n ę: \"e\",\n Ě: \"E\",\n ě: \"e\",\n Ĝ: \"G\",\n Ǵ: \"G\",\n ĝ: \"g\",\n ǵ: \"g\",\n Ğ: \"G\",\n ğ: \"g\",\n Ġ: \"G\",\n ġ: \"g\",\n Ģ: \"G\",\n ģ: \"g\",\n Ĥ: \"H\",\n ĥ: \"h\",\n Ħ: \"H\",\n ħ: \"h\",\n Ḫ: \"H\",\n ḫ: \"h\",\n Ĩ: \"I\",\n ĩ: \"i\",\n Ī: \"I\",\n ī: \"i\",\n Ĭ: \"I\",\n ĭ: \"i\",\n Į: \"I\",\n į: \"i\",\n İ: \"I\",\n ı: \"i\",\n IJ: \"IJ\",\n ij: \"ij\",\n Ĵ: \"J\",\n ĵ: \"j\",\n Ķ: \"K\",\n ķ: \"k\",\n Ḱ: \"K\",\n ḱ: \"k\",\n K̆: \"K\",\n k̆: \"k\",\n Ĺ: \"L\",\n ĺ: \"l\",\n Ļ: \"L\",\n ļ: \"l\",\n Ľ: \"L\",\n ľ: \"l\",\n Ŀ: \"L\",\n ŀ: \"l\",\n Ł: \"l\",\n ł: \"l\",\n Ḿ: \"M\",\n ḿ: \"m\",\n M̆: \"M\",\n m̆: \"m\",\n Ń: \"N\",\n ń: \"n\",\n Ņ: \"N\",\n ņ: \"n\",\n Ň: \"N\",\n ň: \"n\",\n ʼn: \"n\",\n N̆: \"N\",\n n̆: \"n\",\n Ō: \"O\",\n ō: \"o\",\n Ŏ: \"O\",\n ŏ: \"o\",\n Ő: \"O\",\n ő: \"o\",\n Œ: \"OE\",\n œ: \"oe\",\n P̆: \"P\",\n p̆: \"p\",\n Ŕ: \"R\",\n ŕ: \"r\",\n Ŗ: \"R\",\n ŗ: \"r\",\n Ř: \"R\",\n ř: \"r\",\n R̆: \"R\",\n r̆: \"r\",\n Ȓ: \"R\",\n ȓ: \"r\",\n Ś: \"S\",\n ś: \"s\",\n Ŝ: \"S\",\n ŝ: \"s\",\n Ş: \"S\",\n Ș: \"S\",\n ș: \"s\",\n ş: \"s\",\n Š: \"S\",\n š: \"s\",\n Ţ: \"T\",\n ţ: \"t\",\n ț: \"t\",\n Ț: \"T\",\n Ť: \"T\",\n ť: \"t\",\n Ŧ: \"T\",\n ŧ: \"t\",\n T̆: \"T\",\n t̆: \"t\",\n Ũ: \"U\",\n ũ: \"u\",\n Ū: \"U\",\n ū: \"u\",\n Ŭ: \"U\",\n ŭ: \"u\",\n Ů: \"U\",\n ů: \"u\",\n Ű: \"U\",\n ű: \"u\",\n Ų: \"U\",\n ų: \"u\",\n Ȗ: \"U\",\n ȗ: \"u\",\n V̆: \"V\",\n v̆: \"v\",\n Ŵ: \"W\",\n ŵ: \"w\",\n Ẃ: \"W\",\n ẃ: \"w\",\n X̆: \"X\",\n x̆: \"x\",\n Ŷ: \"Y\",\n ŷ: \"y\",\n Ÿ: \"Y\",\n Y̆: \"Y\",\n y̆: \"y\",\n Ź: \"Z\",\n ź: \"z\",\n Ż: \"Z\",\n ż: \"z\",\n Ž: \"Z\",\n ž: \"z\",\n ſ: \"s\",\n ƒ: \"f\",\n Ơ: \"O\",\n ơ: \"o\",\n Ư: \"U\",\n ư: \"u\",\n Ǎ: \"A\",\n ǎ: \"a\",\n Ǐ: \"I\",\n ǐ: \"i\",\n Ǒ: \"O\",\n ǒ: \"o\",\n Ǔ: \"U\",\n ǔ: \"u\",\n Ǖ: \"U\",\n ǖ: \"u\",\n Ǘ: \"U\",\n ǘ: \"u\",\n Ǚ: \"U\",\n ǚ: \"u\",\n Ǜ: \"U\",\n ǜ: \"u\",\n Ứ: \"U\",\n ứ: \"u\",\n Ṹ: \"U\",\n ṹ: \"u\",\n Ǻ: \"A\",\n ǻ: \"a\",\n Ǽ: \"AE\",\n ǽ: \"ae\",\n Ǿ: \"O\",\n ǿ: \"o\",\n Þ: \"TH\",\n þ: \"th\",\n Ṕ: \"P\",\n ṕ: \"p\",\n Ṥ: \"S\",\n ṥ: \"s\",\n X́: \"X\",\n x́: \"x\",\n Ѓ: \"Г\",\n ѓ: \"г\",\n Ќ: \"К\",\n ќ: \"к\",\n A̋: \"A\",\n a̋: \"a\",\n E̋: \"E\",\n e̋: \"e\",\n I̋: \"I\",\n i̋: \"i\",\n Ǹ: \"N\",\n ǹ: \"n\",\n Ồ: \"O\",\n ồ: \"o\",\n Ṑ: \"O\",\n ṑ: \"o\",\n Ừ: \"U\",\n ừ: \"u\",\n Ẁ: \"W\",\n ẁ: \"w\",\n Ỳ: \"Y\",\n ỳ: \"y\",\n Ȁ: \"A\",\n ȁ: \"a\",\n Ȅ: \"E\",\n ȅ: \"e\",\n Ȉ: \"I\",\n ȉ: \"i\",\n Ȍ: \"O\",\n ȍ: \"o\",\n Ȑ: \"R\",\n ȑ: \"r\",\n Ȕ: \"U\",\n ȕ: \"u\",\n B̌: \"B\",\n b̌: \"b\",\n Č̣: \"C\",\n č̣: \"c\",\n Ê̌: \"E\",\n ê̌: \"e\",\n F̌: \"F\",\n f̌: \"f\",\n Ǧ: \"G\",\n ǧ: \"g\",\n Ȟ: \"H\",\n ȟ: \"h\",\n J̌: \"J\",\n ǰ: \"j\",\n Ǩ: \"K\",\n ǩ: \"k\",\n M̌: \"M\",\n m̌: \"m\",\n P̌: \"P\",\n p̌: \"p\",\n Q̌: \"Q\",\n q̌: \"q\",\n Ř̩: \"R\",\n ř̩: \"r\",\n Ṧ: \"S\",\n ṧ: \"s\",\n V̌: \"V\",\n v̌: \"v\",\n W̌: \"W\",\n w̌: \"w\",\n X̌: \"X\",\n x̌: \"x\",\n Y̌: \"Y\",\n y̌: \"y\",\n A̧: \"A\",\n a̧: \"a\",\n B̧: \"B\",\n b̧: \"b\",\n Ḑ: \"D\",\n ḑ: \"d\",\n Ȩ: \"E\",\n ȩ: \"e\",\n Ɛ̧: \"E\",\n ɛ̧: \"e\",\n Ḩ: \"H\",\n ḩ: \"h\",\n I̧: \"I\",\n i̧: \"i\",\n Ɨ̧: \"I\",\n ɨ̧: \"i\",\n M̧: \"M\",\n m̧: \"m\",\n O̧: \"O\",\n o̧: \"o\",\n Q̧: \"Q\",\n q̧: \"q\",\n U̧: \"U\",\n u̧: \"u\",\n X̧: \"X\",\n x̧: \"x\",\n Z̧: \"Z\",\n z̧: \"z\"\n};\n\n/**\n * Removes accents from a string.\n *\n * @param str - The string to remove accents from\n * @returns The string without accents\n */\nexport const removeAccents = (str: string) =>\n str.replace(\n // eslint-disable-next-line regexp/no-dupe-disjunctions, regexp/prefer-character-class\n new RegExp(Object.keys(characterMap).join(\"|\"), \"g\"),\n match => characterMap[match]!\n );\n"],"mappings":";;;;;;;AAkBA,MAAa,eAAuC;CAClD,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;;;;;;;AAQD,MAAa,iBAAiB,QAC5B,IAAI,QAEF,IAAI,OAAO,OAAO,KAAK,aAAa,CAAC,KAAK,IAAI,EAAE,IAAI,GACpD,UAAS,aAAa,OACvB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_remove_accents = require('./remove-accents.cjs');
|
|
2
|
+
let vitest = require("vitest");
|
|
3
|
+
|
|
4
|
+
//#region src/remove-accents.test.ts
|
|
5
|
+
(0, vitest.describe)("remove-accents.ts exports", () => {
|
|
6
|
+
(0, vitest.it)("loads module exports", () => {
|
|
7
|
+
(0, vitest.expect)(require_remove_accents.remove_accents_exports).toBeDefined();
|
|
8
|
+
(0, vitest.expect)(typeof require_remove_accents.remove_accents_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { remove_accents_exports } from "./remove-accents.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/remove-accents.test.ts
|
|
5
|
+
describe("remove-accents.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(remove_accents_exports).toBeDefined();
|
|
8
|
+
expect(typeof remove_accents_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=remove-accents.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-accents.test.mjs","names":["moduleExports"],"sources":["../src/remove-accents.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./remove-accents.ts\";\n\ndescribe(\"remove-accents.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,mCAAmC;AAC1C,IAAG,8BAA8B;AAC/B,SAAOA,uBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,uBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/remove-empty-items.ts
|
|
5
|
+
var remove_empty_items_exports = /* @__PURE__ */ require_runtime.__exportAll({ removeEmptyItems: () => removeEmptyItems });
|
|
4
6
|
/**
|
|
5
7
|
* Removes empty items from an array
|
|
6
8
|
*
|
|
@@ -10,4 +12,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
10
12
|
const removeEmptyItems = (arr) => arr.filter(Boolean);
|
|
11
13
|
|
|
12
14
|
//#endregion
|
|
13
|
-
exports.removeEmptyItems = removeEmptyItems;
|
|
15
|
+
exports.removeEmptyItems = removeEmptyItems;
|
|
16
|
+
Object.defineProperty(exports, 'remove_empty_items_exports', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return remove_empty_items_exports;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/remove-empty-items.ts
|
|
4
|
+
var remove_empty_items_exports = /* @__PURE__ */ __exportAll({ removeEmptyItems: () => removeEmptyItems });
|
|
2
5
|
/**
|
|
3
6
|
* Removes empty items from an array
|
|
4
7
|
*
|
|
@@ -8,5 +11,5 @@
|
|
|
8
11
|
const removeEmptyItems = (arr) => arr.filter(Boolean);
|
|
9
12
|
|
|
10
13
|
//#endregion
|
|
11
|
-
export { removeEmptyItems };
|
|
14
|
+
export { removeEmptyItems, remove_empty_items_exports };
|
|
12
15
|
//# sourceMappingURL=remove-empty-items.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-empty-items.mjs","names":[],"sources":["../src/remove-empty-items.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Removes empty items from an array\n *\n * @param arr - The array to remove empty items from\n * @returns The array with empty items removed\n */\nexport const removeEmptyItems = <T = any>(\n arr: (T | undefined | null)[]\n): NonNullable<T>[] => arr.filter(Boolean) as NonNullable<T>[];\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove-empty-items.mjs","names":[],"sources":["../src/remove-empty-items.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Removes empty items from an array\n *\n * @param arr - The array to remove empty items from\n * @returns The array with empty items removed\n */\nexport const removeEmptyItems = <T = any>(\n arr: (T | undefined | null)[]\n): NonNullable<T>[] => arr.filter(Boolean) as NonNullable<T>[];\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,oBACX,QACqB,IAAI,OAAO,QAAQ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_remove_empty_items = require('./remove-empty-items.cjs');
|
|
2
|
+
let vitest = require("vitest");
|
|
3
|
+
|
|
4
|
+
//#region src/remove-empty-items.test.ts
|
|
5
|
+
(0, vitest.describe)("remove-empty-items.ts exports", () => {
|
|
6
|
+
(0, vitest.it)("loads module exports", () => {
|
|
7
|
+
(0, vitest.expect)(require_remove_empty_items.remove_empty_items_exports).toBeDefined();
|
|
8
|
+
(0, vitest.expect)(typeof require_remove_empty_items.remove_empty_items_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { remove_empty_items_exports } from "./remove-empty-items.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/remove-empty-items.test.ts
|
|
5
|
+
describe("remove-empty-items.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(remove_empty_items_exports).toBeDefined();
|
|
8
|
+
expect(typeof remove_empty_items_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=remove-empty-items.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-empty-items.test.mjs","names":["moduleExports"],"sources":["../src/remove-empty-items.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./remove-empty-items.ts\";\n\ndescribe(\"remove-empty-items.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,uCAAuC;AAC9C,IAAG,8BAA8B;AAC/B,SAAOA,2BAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,2BAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/set-field.cjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_to_path = require('./to-path.cjs');
|
|
3
4
|
let _stryke_type_checks_is_object_index = require("@stryke/type-checks/is-object-index");
|
|
4
5
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
5
6
|
|
|
6
7
|
//#region src/set-field.ts
|
|
8
|
+
var set_field_exports = /* @__PURE__ */ require_runtime.__exportAll({ setField: () => setField });
|
|
7
9
|
/**
|
|
8
10
|
* Sets a value at a given deep path in an object.
|
|
9
11
|
*
|
|
@@ -28,4 +30,10 @@ function setField(object, path, value) {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
//#endregion
|
|
31
|
-
exports.setField = setField;
|
|
33
|
+
exports.setField = setField;
|
|
34
|
+
Object.defineProperty(exports, 'set_field_exports', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return set_field_exports;
|
|
38
|
+
}
|
|
39
|
+
});
|
package/dist/set-field.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { toPath } from "./to-path.mjs";
|
|
2
3
|
import { isObjectIndex } from "@stryke/type-checks/is-object-index";
|
|
3
4
|
import { isString } from "@stryke/type-checks/is-string";
|
|
4
5
|
|
|
5
6
|
//#region src/set-field.ts
|
|
7
|
+
var set_field_exports = /* @__PURE__ */ __exportAll({ setField: () => setField });
|
|
6
8
|
/**
|
|
7
9
|
* Sets a value at a given deep path in an object.
|
|
8
10
|
*
|
|
@@ -27,5 +29,5 @@ function setField(object, path, value) {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
//#endregion
|
|
30
|
-
export { setField };
|
|
32
|
+
export { setField, set_field_exports };
|
|
31
33
|
//# sourceMappingURL=set-field.mjs.map
|
package/dist/set-field.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-field.mjs","names":[],"sources":["../src/set-field.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isObjectIndex } from \"@stryke/type-checks/is-object-index\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { DeepKey } from \"@stryke/types/object\";\nimport { toPath } from \"./to-path\";\n\n/**\n * Sets a value at a given deep path in an object.\n *\n * @param object - The object to set the value in.\n * @param path - The deep path to set the value at.\n * @param value - The value to set.\n * @returns The object with the value set at the given deep path.\n */\nexport function setField<\n TObject extends Record<string, any> = Record<string, any>\n>(object: TObject, path: DeepKey<TObject>, value: unknown): TObject {\n const resolvedPath = Array.isArray(path)\n ? path\n : isString(path)\n ? toPath(path)\n : [path];\n\n // Validate resolvedPath to prevent prototype pollution\n for (const key of resolvedPath) {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\") {\n throw new Error(`Invalid key in path: ${key}`);\n }\n }\n\n let current: any = object;\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] === null) {\n current[key] = isObjectIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath.at(-1);\n if (lastKey) {\n current[lastKey] = value;\n }\n\n return object;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-field.mjs","names":[],"sources":["../src/set-field.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isObjectIndex } from \"@stryke/type-checks/is-object-index\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { DeepKey } from \"@stryke/types/object\";\nimport { toPath } from \"./to-path\";\n\n/**\n * Sets a value at a given deep path in an object.\n *\n * @param object - The object to set the value in.\n * @param path - The deep path to set the value at.\n * @param value - The value to set.\n * @returns The object with the value set at the given deep path.\n */\nexport function setField<\n TObject extends Record<string, any> = Record<string, any>\n>(object: TObject, path: DeepKey<TObject>, value: unknown): TObject {\n const resolvedPath = Array.isArray(path)\n ? path\n : isString(path)\n ? toPath(path)\n : [path];\n\n // Validate resolvedPath to prevent prototype pollution\n for (const key of resolvedPath) {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\") {\n throw new Error(`Invalid key in path: ${key}`);\n }\n }\n\n let current: any = object;\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] === null) {\n current[key] = isObjectIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath.at(-1);\n if (lastKey) {\n current[lastKey] = value;\n }\n\n return object;\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,SAAgB,SAEd,QAAiB,MAAwB,OAAyB;CAClE,MAAM,eAAe,MAAM,QAAQ,KAAK,GACpC,OACA,SAAS,KAAK,GACZ,OAAO,KAAK,GACZ,CAAC,KAAK;AAGZ,MAAK,MAAM,OAAO,aAChB,KAAI,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ,YAC1D,OAAM,IAAI,MAAM,wBAAwB,MAAM;CAIlD,IAAI,UAAe;AACnB,MAAK,IAAI,IAAI,GAAG,IAAI,aAAa,SAAS,GAAG,KAAK;EAChD,MAAM,MAAM,aAAa;EACzB,MAAM,UAAU,aAAa,IAAI;AAEjC,MAAI,QAAQ,SAAS,KACnB,SAAQ,OAAO,cAAc,QAAQ,GAAG,EAAE,GAAG,EAAE;AAGjD,YAAU,QAAQ;;CAGpB,MAAM,UAAU,aAAa,GAAG,GAAG;AACnC,KAAI,QACF,SAAQ,WAAW;AAGrB,QAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_set_field = require('./set-field.cjs');
|
|
2
|
+
let vitest = require("vitest");
|
|
3
|
+
|
|
4
|
+
//#region src/set-field.test.ts
|
|
5
|
+
(0, vitest.describe)("set-field.ts exports", () => {
|
|
6
|
+
(0, vitest.it)("loads module exports", () => {
|
|
7
|
+
(0, vitest.expect)(require_set_field.set_field_exports).toBeDefined();
|
|
8
|
+
(0, vitest.expect)(typeof require_set_field.set_field_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { set_field_exports } from "./set-field.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/set-field.test.ts
|
|
5
|
+
describe("set-field.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(set_field_exports).toBeDefined();
|
|
8
|
+
expect(typeof set_field_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=set-field.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-field.test.mjs","names":["moduleExports"],"sources":["../src/set-field.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./set-field.ts\";\n\ndescribe(\"set-field.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,8BAA8B;AACrC,IAAG,8BAA8B;AAC/B,SAAOA,kBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,kBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/to-deep-key.cjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
3
4
|
let _stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
|
|
4
5
|
|
|
5
6
|
//#region src/to-deep-key.ts
|
|
7
|
+
var to_deep_key_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
8
|
+
addPathToDeepKey: () => addPathToDeepKey,
|
|
9
|
+
toDeepKey: () => toDeepKey
|
|
10
|
+
});
|
|
6
11
|
/**
|
|
7
12
|
* Converts an array of path segments into a deep key string.
|
|
8
13
|
*
|
|
@@ -52,4 +57,10 @@ function addPathToDeepKey(deepKey, path) {
|
|
|
52
57
|
|
|
53
58
|
//#endregion
|
|
54
59
|
exports.addPathToDeepKey = addPathToDeepKey;
|
|
55
|
-
exports.toDeepKey = toDeepKey;
|
|
60
|
+
exports.toDeepKey = toDeepKey;
|
|
61
|
+
Object.defineProperty(exports, 'to_deep_key_exports', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return to_deep_key_exports;
|
|
65
|
+
}
|
|
66
|
+
});
|
package/dist/to-deep-key.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
2
3
|
import { isNumber } from "@stryke/type-checks/is-number";
|
|
3
4
|
|
|
4
5
|
//#region src/to-deep-key.ts
|
|
6
|
+
var to_deep_key_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
addPathToDeepKey: () => addPathToDeepKey,
|
|
8
|
+
toDeepKey: () => toDeepKey
|
|
9
|
+
});
|
|
5
10
|
/**
|
|
6
11
|
* Converts an array of path segments into a deep key string.
|
|
7
12
|
*
|
|
@@ -50,5 +55,5 @@ function addPathToDeepKey(deepKey, path) {
|
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
//#endregion
|
|
53
|
-
export { addPathToDeepKey, toDeepKey };
|
|
58
|
+
export { addPathToDeepKey, toDeepKey, to_deep_key_exports };
|
|
54
59
|
//# sourceMappingURL=to-deep-key.mjs.map
|
package/dist/to-deep-key.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-deep-key.mjs","names":[],"sources":["../src/to-deep-key.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\n\n/**\n * Converts an array of path segments into a deep key string.\n *\n * This function takes an array of strings and numbers representing path segments and combines them into a deep key string.\n *\n * @example\n * toDeepKey(['a', 'b', 'c']) // Returns 'a.b.c'\n * toDeepKey(['a', 0, 'c']) // Returns 'a[0].c'\n * toDeepKey(['', 'a', 'b', 'c']) // Returns '.a.b.c'\n * toDeepKey(['a', 'b.c', 'd']) // Returns 'a.b.c.d'\n * toDeepKey([]) // Returns ''\n * toDeepKey(['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']) // Returns '.a.b.c.d.e.f.g.h'\n *\n * @param path - An array of strings and numbers representing path segments.\n * @returns A deep key string.\n */\nexport function toDeepKey(path: string[]): string {\n return path.reduce((ret, segment) => {\n return addPathToDeepKey(ret, segment);\n });\n}\n\n/**\n * Adds a path segment to a deep key string.\n *\n * @remarks\n * This function takes a deep key string and a path segment and combines them into a new deep key string.\n *\n * @example\n * ```ts\n * addPathToDeepKey('a.b', 'c') // Returns 'a.b.c'\n * addPathToDeepKey('a[0]', 'c') // Returns 'a[0].c'\n * addPathToDeepKey('.a.b', 'c') // Returns '.a.b.c'\n * addPathToDeepKey('a.b', 'b.c') // Returns 'a.b.b.c'\n * addPathToDeepKey('', 'a') // Returns 'a'\n * addPathToDeepKey('.a.b', 'c.d') // Returns '.a.b.c.d'\n * ```\n *\n * @param deepKey - The deep key string to add the path segment to.\n * @param path - The path segment to add to the deep key string.\n * @returns A new deep key string.\n */\nexport function addPathToDeepKey(\n deepKey: string,\n path: string | number\n): string {\n if (isNumber(path) || Number.isInteger(path)) {\n return `${deepKey}[${path}]`;\n }\n if (isSetString(path)) {\n return `${deepKey}.${path}`;\n }\n\n return deepKey;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"to-deep-key.mjs","names":[],"sources":["../src/to-deep-key.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\n\n/**\n * Converts an array of path segments into a deep key string.\n *\n * This function takes an array of strings and numbers representing path segments and combines them into a deep key string.\n *\n * @example\n * toDeepKey(['a', 'b', 'c']) // Returns 'a.b.c'\n * toDeepKey(['a', 0, 'c']) // Returns 'a[0].c'\n * toDeepKey(['', 'a', 'b', 'c']) // Returns '.a.b.c'\n * toDeepKey(['a', 'b.c', 'd']) // Returns 'a.b.c.d'\n * toDeepKey([]) // Returns ''\n * toDeepKey(['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']) // Returns '.a.b.c.d.e.f.g.h'\n *\n * @param path - An array of strings and numbers representing path segments.\n * @returns A deep key string.\n */\nexport function toDeepKey(path: string[]): string {\n return path.reduce((ret, segment) => {\n return addPathToDeepKey(ret, segment);\n });\n}\n\n/**\n * Adds a path segment to a deep key string.\n *\n * @remarks\n * This function takes a deep key string and a path segment and combines them into a new deep key string.\n *\n * @example\n * ```ts\n * addPathToDeepKey('a.b', 'c') // Returns 'a.b.c'\n * addPathToDeepKey('a[0]', 'c') // Returns 'a[0].c'\n * addPathToDeepKey('.a.b', 'c') // Returns '.a.b.c'\n * addPathToDeepKey('a.b', 'b.c') // Returns 'a.b.b.c'\n * addPathToDeepKey('', 'a') // Returns 'a'\n * addPathToDeepKey('.a.b', 'c.d') // Returns '.a.b.c.d'\n * ```\n *\n * @param deepKey - The deep key string to add the path segment to.\n * @param path - The path segment to add to the deep key string.\n * @returns A new deep key string.\n */\nexport function addPathToDeepKey(\n deepKey: string,\n path: string | number\n): string {\n if (isNumber(path) || Number.isInteger(path)) {\n return `${deepKey}[${path}]`;\n }\n if (isSetString(path)) {\n return `${deepKey}.${path}`;\n }\n\n return deepKey;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,UAAU,MAAwB;AAChD,QAAO,KAAK,QAAQ,KAAK,YAAY;AACnC,SAAO,iBAAiB,KAAK,QAAQ;GACrC;;;;;;;;;;;;;;;;;;;;;;AAuBJ,SAAgB,iBACd,SACA,MACQ;AACR,KAAI,SAAS,KAAK,IAAI,OAAO,UAAU,KAAK,CAC1C,QAAO,GAAG,QAAQ,GAAG,KAAK;AAE5B,KAAI,YAAY,KAAK,CACnB,QAAO,GAAG,QAAQ,GAAG;AAGvB,QAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_to_deep_key = require('./to-deep-key.cjs');
|
|
2
|
+
let vitest = require("vitest");
|
|
3
|
+
|
|
4
|
+
//#region src/to-deep-key.test.ts
|
|
5
|
+
(0, vitest.describe)("to-deep-key.ts exports", () => {
|
|
6
|
+
(0, vitest.it)("loads module exports", () => {
|
|
7
|
+
(0, vitest.expect)(require_to_deep_key.to_deep_key_exports).toBeDefined();
|
|
8
|
+
(0, vitest.expect)(typeof require_to_deep_key.to_deep_key_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { to_deep_key_exports } from "./to-deep-key.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/to-deep-key.test.ts
|
|
5
|
+
describe("to-deep-key.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(to_deep_key_exports).toBeDefined();
|
|
8
|
+
expect(typeof to_deep_key_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=to-deep-key.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-deep-key.test.mjs","names":["moduleExports"],"sources":["../src/to-deep-key.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./to-deep-key.ts\";\n\ndescribe(\"to-deep-key.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,gCAAgC;AACvC,IAAG,8BAA8B;AAC/B,SAAOA,oBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,oBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/to-path.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/to-path.ts
|
|
5
|
+
var to_path_exports = /* @__PURE__ */ require_runtime.__exportAll({ toPath: () => toPath });
|
|
4
6
|
const DOTS_KEY = /^[\w.]+$/g;
|
|
5
7
|
const ESCAPE_REGEXP = /\\(?<temp1>\\)?/g;
|
|
6
8
|
const PROPERTY_REGEXP = new RegExp(`${String.raw`[^.[\]]+`}|${String.raw`\[(?:`}([^"'][^[]*)|${String.raw`(["'])((?:(?!\2)[^\\]|\\.)*?)\2`}${String.raw`)\]`}|${String.raw`(?=(?:\.|\[\])(?:\.|\[\]|$))`}`, "g");
|
|
@@ -41,4 +43,10 @@ function toPath(deepKey) {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
//#endregion
|
|
44
|
-
exports.toPath = toPath;
|
|
46
|
+
exports.toPath = toPath;
|
|
47
|
+
Object.defineProperty(exports, 'to_path_exports', {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return to_path_exports;
|
|
51
|
+
}
|
|
52
|
+
});
|