@vxrn/utils 1.1.368

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./mustReplace.cjs"), module.exports);
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var src_exports = {};
13
+ module.exports = __toCommonJS(src_exports);
14
+ __reExport(src_exports, require("./mustReplace"), module.exports);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;",
5
+ "names": []
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from == "object" || typeof from == "function")
8
+ for (let key of __getOwnPropNames(from))
9
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ return to;
11
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
12
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
13
+ var src_exports = {};
14
+ module.exports = __toCommonJS(src_exports);
15
+ __reExport(src_exports, require("./mustReplace"), module.exports);
16
+ // Annotate the CommonJS export names for ESM import in node:
17
+ 0 && (module.exports = {
18
+ ...require("./mustReplace")
19
+ });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/utils/src/index.tsx"],
4
+ "mappings": ";;;;;;;;;;;;AAAA;;wBAAc,0BAAd;",
5
+ "names": []
6
+ }
@@ -0,0 +1,37 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var mustReplace_exports = {};
22
+ __export(mustReplace_exports, {
23
+ mustReplace: () => mustReplace
24
+ });
25
+ module.exports = __toCommonJS(mustReplace_exports);
26
+ function mustReplace(source, replacements) {
27
+ let sourceOut = source;
28
+ for (const {
29
+ find,
30
+ replace,
31
+ optional
32
+ } of replacements) {
33
+ if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find))) throw new Error(`Substring or pattern "${find}" not found in the string.`);
34
+ sourceOut = sourceOut.replace(find, replace);
35
+ }
36
+ return sourceOut;
37
+ }
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var mustReplace_exports = {};
16
+ __export(mustReplace_exports, {
17
+ mustReplace: () => mustReplace
18
+ });
19
+ module.exports = __toCommonJS(mustReplace_exports);
20
+ function mustReplace(source, replacements) {
21
+ let sourceOut = source;
22
+ for (const { find, replace, optional } of replacements) {
23
+ if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)))
24
+ throw new Error(`Substring or pattern "${find}" not found in the string.`);
25
+ sourceOut = sourceOut.replace(find, replace);
26
+ }
27
+ return sourceOut;
28
+ }
29
+ //# sourceMappingURL=mustReplace.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/mustReplace.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,YACd,QACA,cAKA;AACA,MAAI,YAAY;AAChB,aAAW,EAAE,MAAM,SAAS,SAAS,KAAK,cAAc;AACtD,QAAI,CAAC,YAEC,EADU,gBAAgB,SAAS,KAAK,KAAK,SAAS,IAAI,UAAU,SAAS,IAAI;AAEnF,YAAM,IAAI,MAAM,yBAAyB,IAAI,4BAA4B;AAK7E,gBAAY,UAAU,QAAQ,MAAM,OAAO;AAAA,EAC7C;AACA,SAAO;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var mustReplace_exports = {};
17
+ __export(mustReplace_exports, {
18
+ mustReplace: () => mustReplace
19
+ });
20
+ module.exports = __toCommonJS(mustReplace_exports);
21
+ function mustReplace(source, replacements) {
22
+ var sourceOut = source, _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
23
+ try {
24
+ for (var _iterator = replacements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
25
+ var { find, replace, optional } = _step.value;
26
+ if (!optional) {
27
+ var found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
28
+ if (!found)
29
+ throw new Error(`Substring or pattern "${find}" not found in the string.`);
30
+ }
31
+ sourceOut = sourceOut.replace(find, replace);
32
+ }
33
+ } catch (err) {
34
+ _didIteratorError = !0, _iteratorError = err;
35
+ } finally {
36
+ try {
37
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
38
+ } finally {
39
+ if (_didIteratorError)
40
+ throw _iteratorError;
41
+ }
42
+ }
43
+ return sourceOut;
44
+ }
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ mustReplace
48
+ });
49
+ //# sourceMappingURL=mustReplace.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/utils/src/mustReplace.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;AAAO,SAASA,YACdC,QACAC,cAIG;AAEH,MAAIC,YAAYF,QACX,4BAAA,IAAA,oBAAA,IAAA,iBAAA;;AAAL,aAAK,YAAqCC,aAAAA,OAAAA,QAAAA,EAAAA,GAArC,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,GAAA,OAAA,4BAAA,IAAmD;AAAnD,UAAM,EAAEE,MAAMC,SAASC,SAAQ,IAA/B,MAAA;AACH,UAAI,CAACA,UAAU;AACb,YAAMC,QAAQH,gBAAgBI,SAASJ,KAAKK,KAAKN,SAAAA,IAAaA,UAAUO,SAASN,IAAAA;AACjF,YAAI,CAACG;AACH,gBAAM,IAAII,MAAM,yBAAyBP,IAAAA,4BAAgC;MAE7E;AAGAD,kBAAYA,UAAUE,QAAQD,MAAMC,OAAAA;IACtC;;AAVK,wBAAA,IAAA,iBAAA;;;OAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;UAAA;cAAA;;;AAWL,SAAOF;AACT;",
5
+ "names": ["mustReplace", "source", "replacements", "sourceOut", "find", "replace", "optional", "found", "RegExp", "test", "includes", "Error"]
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./mustReplace";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "mappings": "AAAA,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./mustReplace.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./mustReplace";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/utils/src/index.tsx"],
4
+ "mappings": "AAAA,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,13 @@
1
+ function mustReplace(source, replacements) {
2
+ let sourceOut = source;
3
+ for (const { find, replace, optional } of replacements) {
4
+ if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)))
5
+ throw new Error(`Substring or pattern "${find}" not found in the string.`);
6
+ sourceOut = sourceOut.replace(find, replace);
7
+ }
8
+ return sourceOut;
9
+ }
10
+ export {
11
+ mustReplace
12
+ };
13
+ //# sourceMappingURL=mustReplace.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/mustReplace.tsx"],
4
+ "mappings": "AAAO,SAAS,YACd,QACA,cAKA;AACA,MAAI,YAAY;AAChB,aAAW,EAAE,MAAM,SAAS,SAAS,KAAK,cAAc;AACtD,QAAI,CAAC,YAEC,EADU,gBAAgB,SAAS,KAAK,KAAK,SAAS,IAAI,UAAU,SAAS,IAAI;AAEnF,YAAM,IAAI,MAAM,yBAAyB,IAAI,4BAA4B;AAK7E,gBAAY,UAAU,QAAQ,MAAM,OAAO;AAAA,EAC7C;AACA,SAAO;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,14 @@
1
+ function mustReplace(source, replacements) {
2
+ let sourceOut = source;
3
+ for (const {
4
+ find,
5
+ replace,
6
+ optional
7
+ } of replacements) {
8
+ if (!optional && !(find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find))) throw new Error(`Substring or pattern "${find}" not found in the string.`);
9
+ sourceOut = sourceOut.replace(find, replace);
10
+ }
11
+ return sourceOut;
12
+ }
13
+ export { mustReplace };
14
+ //# sourceMappingURL=mustReplace.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["mustReplace","source","replacements","sourceOut","find","replace","optional","RegExp","test","includes","Error"],"sources":["../../src/mustReplace.tsx"],"sourcesContent":[null],"mappings":"AAAO,SAASA,YACdC,MAAA,EACAC,YAAA,EAKA;EACA,IAAIC,SAAA,GAAYF,MAAA;EAChB,WAAW;IAAEG,IAAA;IAAMC,OAAA;IAASC;EAAS,KAAKJ,YAAA,EAAc;IACtD,IAAI,CAACI,QAAA,IAEC,EADUF,IAAA,YAAgBG,MAAA,GAASH,IAAA,CAAKI,IAAA,CAAKL,SAAS,IAAIA,SAAA,CAAUM,QAAA,CAASL,IAAI,IAEnF,MAAM,IAAIM,KAAA,CAAM,yBAAyBN,IAAI,4BAA4B;IAK7ED,SAAA,GAAYA,SAAA,CAAUE,OAAA,CAAQD,IAAA,EAAMC,OAAO;EAC7C;EACA,OAAOF,SAAA;AACT","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ function mustReplace(source, replacements) {
2
+ var sourceOut = source, _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
3
+ try {
4
+ for (var _iterator = replacements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
5
+ var { find, replace, optional } = _step.value;
6
+ if (!optional) {
7
+ var found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
8
+ if (!found)
9
+ throw new Error(`Substring or pattern "${find}" not found in the string.`);
10
+ }
11
+ sourceOut = sourceOut.replace(find, replace);
12
+ }
13
+ } catch (err) {
14
+ _didIteratorError = !0, _iteratorError = err;
15
+ } finally {
16
+ try {
17
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
18
+ } finally {
19
+ if (_didIteratorError)
20
+ throw _iteratorError;
21
+ }
22
+ }
23
+ return sourceOut;
24
+ }
25
+ export {
26
+ mustReplace
27
+ };
28
+ //# sourceMappingURL=mustReplace.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/utils/src/mustReplace.tsx"],
4
+ "mappings": "AAAO,SAASA,YACdC,QACAC,cAIG;AAEH,MAAIC,YAAYF,QACX,4BAAA,IAAA,oBAAA,IAAA,iBAAA;;AAAL,aAAK,YAAqCC,aAAAA,OAAAA,QAAAA,EAAAA,GAArC,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,GAAA,OAAA,4BAAA,IAAmD;AAAnD,UAAM,EAAEE,MAAMC,SAASC,SAAQ,IAA/B,MAAA;AACH,UAAI,CAACA,UAAU;AACb,YAAMC,QAAQH,gBAAgBI,SAASJ,KAAKK,KAAKN,SAAAA,IAAaA,UAAUO,SAASN,IAAAA;AACjF,YAAI,CAACG;AACH,gBAAM,IAAII,MAAM,yBAAyBP,IAAAA,4BAAgC;MAE7E;AAGAD,kBAAYA,UAAUE,QAAQD,MAAMC,OAAAA;IACtC;;AAVK,wBAAA,IAAA,iBAAA;;;OAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;UAAA;cAAA;;;AAWL,SAAOF;AACT;",
5
+ "names": ["mustReplace", "source", "replacements", "sourceOut", "find", "replace", "optional", "found", "RegExp", "test", "includes", "Error"]
6
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@vxrn/utils",
3
+ "version": "1.1.368",
4
+ "sideEffects": false,
5
+ "type": "module",
6
+ "types": "./src/index.ts",
7
+ "main": "dist/cjs",
8
+ "module": "dist/esm",
9
+ "exports": {
10
+ "./package.json": "./package.json",
11
+ ".": {
12
+ "react-native": {
13
+ "import": "./dist/esm/index.native.js",
14
+ "require": "./dist/cjs/index.native.js"
15
+ },
16
+ "types": "./src/index.ts",
17
+ "import": "./dist/esm/index.mjs",
18
+ "require": "./dist/cjs/index.cjs"
19
+ }
20
+ },
21
+ "files": [
22
+ "src",
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "build": "tamagui-build --skip-types",
27
+ "watch": "tamagui-build --skip-types --watch",
28
+ "lint": "npx biome check src",
29
+ "lint:fix": "npx biome check --apply-unsafe src",
30
+ "clean": "tamagui-build clean",
31
+ "clean:build": "tamagui-build clean:build"
32
+ },
33
+ "devDependencies": {
34
+ "@tamagui/build": "^1.120.2"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }
package/src/index.tsx ADDED
@@ -0,0 +1 @@
1
+ export * from './mustReplace'
@@ -0,0 +1,22 @@
1
+ export function mustReplace(
2
+ source: string,
3
+ replacements: {
4
+ find: string | RegExp
5
+ replace: string
6
+ optional?: boolean
7
+ }[]
8
+ ) {
9
+ let sourceOut = source
10
+ for (const { find, replace, optional } of replacements) {
11
+ if (!optional) {
12
+ const found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find)
13
+ if (!found) {
14
+ throw new Error(`Substring or pattern "${find}" not found in the string.`)
15
+ }
16
+ }
17
+
18
+ // Perform the replacement
19
+ sourceOut = sourceOut.replace(find, replace)
20
+ }
21
+ return sourceOut
22
+ }