@willbooster/shared-lib 1.7.0 → 1.8.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/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/{esm/error.d.ts → cjs/index.d.cts} +3 -1
- package/dist/{cjs/error.d.ts → esm/error.d.mts} +0 -0
- package/dist/esm/{error.js → error.mjs} +1 -1
- package/dist/esm/error.mjs.map +1 -0
- package/dist/{cjs/index.d.ts → esm/index.d.mts} +0 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/{cjs/shuffle.d.ts → esm/shuffle.d.mts} +0 -0
- package/dist/esm/{shuffle.js → shuffle.mjs} +1 -1
- package/dist/esm/shuffle.mjs.map +1 -0
- package/dist/{cjs/zenkaku.d.ts → esm/zenkaku.d.mts} +0 -0
- package/dist/esm/{zenkaku.js → zenkaku.mjs} +1 -1
- package/dist/esm/zenkaku.mjs.map +1 -0
- package/package.json +17 -15
- package/dist/cjs/error.js +0 -2
- package/dist/cjs/error.js.map +0 -1
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/shuffle.js +0 -2
- package/dist/cjs/shuffle.js.map +0 -1
- package/dist/cjs/zenkaku.js +0 -2
- package/dist/cjs/zenkaku.js.map +0 -1
- package/dist/esm/error.js.map +0 -1
- package/dist/esm/index.d.ts +0 -3
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/shuffle.d.ts +0 -2
- package/dist/esm/shuffle.js.map +0 -1
- package/dist/esm/zenkaku.d.ts +0 -2
- package/dist/esm/zenkaku.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";exports.ignoreEnoent=function(t){try{return t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreEnoentAsync=async function(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreError=function(t){try{return t()}catch(t){}},exports.ignoreErrorAsync=async function(t){try{return await t()}catch(t){}},exports.shuffle=function(t){for(let r=t.length-1;r>0;r--){const n=Math.floor(Math.random()*(r+1));[t[r],t[n]]=[t[n],t[r]]}return t},exports.zenkakuAlphanumericalsToHankaku=function(t){return t.replace(/[0-9A-Za-z]/g,(t=>{var r;return String.fromCodePoint((null!==(r=t.codePointAt(0))&&void 0!==r?r:0)-65248)}))};
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/error.ts","../../src/shuffle.ts","../../src/zenkaku.ts"],"sourcesContent":["export function ignoreError<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch {\n // do nothing\n }\n}\n\nexport function ignoreEnoent<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch {\n // do nothing\n }\n}\n\nexport async function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n","export function shuffle<T>(array: T[]): T[] {\n for (let index = array.length - 1; index > 0; index--) {\n const index_ = Math.floor(Math.random() * (index + 1));\n [array[index], array[index_]] = [array[index_], array[index]];\n }\n return array;\n}\n","export function zenkakuAlphanumericalsToHankaku(str: string): string {\n return str.replace(/[0-9A-Za-z]/g, (s: string) => {\n return String.fromCodePoint((s.codePointAt(0) ?? 0) - 0xfe_e0);\n });\n}\n"],"names":["fn","error","code","async","_unused","_unused2","array","index","length","index_","Math","floor","random","str","replace","s","_s$codePointAt","String","fromCodePoint","codePointAt"],"mappings":"kCAQO,SAAyBA,GAC9B,IACE,OAAOA,GAMT,CALE,MAAOC,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,4BAUOE,eAAoCH,GACzC,IACE,aAAaA,GAMf,CALE,MAAOC,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,sBApCO,SAAwBD,GAC7B,IACE,OAAOA,GAEP,CADA,MAAMI,GACN,CAEJ,2BAaOD,eAAmCH,GACxC,IACE,aAAaA,GAEb,CADA,MAAMK,GACN,CAEJ,kBCzBO,SAAoBC,GACzB,IAAK,IAAIC,EAAQD,EAAME,OAAS,EAAGD,EAAQ,EAAGA,IAAS,CACrD,MAAME,EAASC,KAAKC,MAAMD,KAAKE,UAAYL,EAAQ,KAClDD,EAAMC,GAAQD,EAAMG,IAAW,CAACH,EAAMG,GAASH,EAAMC,GACxD,CACA,OAAOD,CACT,0CCNO,SAAyCO,GAC9C,OAAOA,EAAIC,QAAQ,gBAAiBC,IAAc,IAAAC,EAChD,OAAOC,OAAOC,eAA+B,UAAhBH,EAAEI,YAAY,UAAE,IAAAH,EAAAA,EAAI,GAAK,MAAQ,GAElE"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
declare function shuffle<T>(array: T[]): T[];
|
|
1
2
|
declare function ignoreError<T>(fn: () => T): T | undefined;
|
|
2
3
|
declare function ignoreEnoent<T>(fn: () => T): T | undefined;
|
|
3
4
|
declare function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined>;
|
|
4
5
|
declare function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined>;
|
|
5
|
-
|
|
6
|
+
declare function zenkakuAlphanumericalsToHankaku(str: string): string;
|
|
7
|
+
export { shuffle, ignoreError, ignoreEnoent, ignoreErrorAsync, ignoreEnoentAsync, zenkakuAlphanumericalsToHankaku };
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function t(t){try{return t()}catch(t){}}function c(t){try{return t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}async function r(t){try{return await t()}catch(t){}}async function n(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}}export{c as ignoreEnoent,n as ignoreEnoentAsync,t as ignoreError,r as ignoreErrorAsync};
|
|
2
|
-
//# sourceMappingURL=error.
|
|
2
|
+
//# sourceMappingURL=error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","sources":["../../src/error.ts"],"sourcesContent":["export function ignoreError<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch {\n // do nothing\n }\n}\n\nexport function ignoreEnoent<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n\nexport async function ignoreErrorAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch {\n // do nothing\n }\n}\n\nexport async function ignoreEnoentAsync<T>(fn: () => Promise<T>): Promise<T | undefined> {\n try {\n return await fn();\n } catch (error) {\n if (typeof error === 'object' && error && 'code' in error && error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n}\n"],"names":["ignoreError","fn","_unused","ignoreEnoent","error","code","async","ignoreErrorAsync","_unused2","ignoreEnoentAsync"],"mappings":"AAAO,SAASA,EAAeC,GAC7B,IACE,OAAOA,GAEP,CADA,MAAMC,GACN,CAEJ,CAEO,SAASC,EAAgBF,GAC9B,IACE,OAAOA,GAMT,CALE,MAAOG,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF,CAEOE,eAAeC,EAAoBN,GACxC,IACE,aAAaA,GAEb,CADA,MAAMO,GACN,CAEJ,CAEOF,eAAeG,EAAqBR,GACzC,IACE,aAAaA,GAMf,CALE,MAAOG,GACP,GAAqB,iBAAVA,GAAsBA,GAAS,SAAUA,GAAwB,WAAfA,EAAMC,KACjE,OAEF,MAAMD,CACR,CACF"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function t(t){for(let o=t.length-1;o>0;o--){const n=Math.floor(Math.random()*(o+1));[t[o],t[n]]=[t[n],t[o]]}return t}export{t as shuffle};
|
|
2
|
-
//# sourceMappingURL=shuffle.
|
|
2
|
+
//# sourceMappingURL=shuffle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shuffle.mjs","sources":["../../src/shuffle.ts"],"sourcesContent":["export function shuffle<T>(array: T[]): T[] {\n for (let index = array.length - 1; index > 0; index--) {\n const index_ = Math.floor(Math.random() * (index + 1));\n [array[index], array[index_]] = [array[index_], array[index]];\n }\n return array;\n}\n"],"names":["shuffle","array","index","length","index_","Math","floor","random"],"mappings":"AAAO,SAASA,EAAWC,GACzB,IAAK,IAAIC,EAAQD,EAAME,OAAS,EAAGD,EAAQ,EAAGA,IAAS,CACrD,MAAME,EAASC,KAAKC,MAAMD,KAAKE,UAAYL,EAAQ,KAClDD,EAAMC,GAAQD,EAAMG,IAAW,CAACH,EAAMG,GAASH,EAAMC,GACxD,CACA,OAAOD,CACT"}
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function r(r){return r.replace(/[0-9A-Za-z]/g,(r=>{var n;return String.fromCodePoint((null!==(n=r.codePointAt(0))&&void 0!==n?n:0)-65248)}))}export{r as zenkakuAlphanumericalsToHankaku};
|
|
2
|
-
//# sourceMappingURL=zenkaku.
|
|
2
|
+
//# sourceMappingURL=zenkaku.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zenkaku.mjs","sources":["../../src/zenkaku.ts"],"sourcesContent":["export function zenkakuAlphanumericalsToHankaku(str: string): string {\n return str.replace(/[0-9A-Za-z]/g, (s: string) => {\n return String.fromCodePoint((s.codePointAt(0) ?? 0) - 0xfe_e0);\n });\n}\n"],"names":["zenkakuAlphanumericalsToHankaku","str","replace","s","_s$codePointAt","String","fromCodePoint","codePointAt"],"mappings":"AAAO,SAASA,EAAgCC,GAC9C,OAAOA,EAAIC,QAAQ,gBAAiBC,IAAc,IAAAC,EAChD,OAAOC,OAAOC,eAA+B,UAAhBH,EAAEI,YAAY,UAAE,IAAAH,EAAAA,EAAI,GAAK,MAAQ,GAElE"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/shared-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "WillBooster Inc.",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "dist/cjs/index.
|
|
8
|
-
"module": "dist/esm/index.
|
|
9
|
-
"types": "dist/
|
|
7
|
+
"main": "dist/cjs/index.cjs",
|
|
8
|
+
"module": "dist/esm/index.mjs",
|
|
9
|
+
"types": "dist/cjs/index.d.cts",
|
|
10
10
|
"files": [
|
|
11
11
|
"bin/",
|
|
12
12
|
"dist/"
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
"build": "build-ts build -t lib",
|
|
16
16
|
"cleanup": "yarn format && yarn lint-fix",
|
|
17
17
|
"format": "sort-package-json && yarn prettify",
|
|
18
|
-
"lint": "eslint --color \"./{
|
|
18
|
+
"lint": "eslint --color \"./{scripts,src,tests}/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}\"",
|
|
19
19
|
"lint-fix": "yarn lint --fix",
|
|
20
20
|
"prettify": "prettier --cache --color --write \"**/{.*/,}*.{cjs,css,cts,htm,html,js,json,json5,jsx,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}\" \"!**/test-fixtures/**\"",
|
|
21
|
+
"test": "vitest",
|
|
21
22
|
"typecheck": "tsc --noEmit --Pretty"
|
|
22
23
|
},
|
|
23
24
|
"prettier": "@willbooster/prettier-config",
|
|
@@ -25,23 +26,24 @@
|
|
|
25
26
|
"@types/eslint": "8.4.10",
|
|
26
27
|
"@types/micromatch": "4.0.2",
|
|
27
28
|
"@types/prettier": "2.7.2",
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
29
|
-
"@typescript-eslint/parser": "5.
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "5.49.0",
|
|
30
|
+
"@typescript-eslint/parser": "5.49.0",
|
|
30
31
|
"@willbooster/eslint-config-ts": "10.0.8",
|
|
31
32
|
"@willbooster/prettier-config": "9.1.1",
|
|
32
|
-
"build-ts": "3.
|
|
33
|
-
"eslint": "8.
|
|
34
|
-
"eslint-config-prettier": "8.
|
|
35
|
-
"eslint-import-resolver-typescript": "3.5.
|
|
36
|
-
"eslint-plugin-import": "2.
|
|
33
|
+
"build-ts": "3.2.5",
|
|
34
|
+
"eslint": "8.32.0",
|
|
35
|
+
"eslint-config-prettier": "8.6.0",
|
|
36
|
+
"eslint-import-resolver-typescript": "3.5.3",
|
|
37
|
+
"eslint-plugin-import": "2.27.5",
|
|
37
38
|
"eslint-plugin-sort-class-members": "1.16.0",
|
|
38
39
|
"eslint-plugin-sort-destructure-keys": "1.4.0",
|
|
39
40
|
"eslint-plugin-unicorn": "45.0.2",
|
|
40
41
|
"lint-staged": "13.1.0",
|
|
41
42
|
"micromatch": "4.0.5",
|
|
42
|
-
"prettier": "2.8.
|
|
43
|
-
"sort-package-json": "2.
|
|
44
|
-
"typescript": "4.9.4"
|
|
43
|
+
"prettier": "2.8.3",
|
|
44
|
+
"sort-package-json": "2.2.0",
|
|
45
|
+
"typescript": "4.9.4",
|
|
46
|
+
"vitest": "0.28.3"
|
|
45
47
|
},
|
|
46
48
|
"publishConfig": {
|
|
47
49
|
"access": "public"
|
package/dist/cjs/error.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";exports.ignoreEnoent=function(t){try{return t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreEnoentAsync=async function(t){try{return await t()}catch(t){if("object"==typeof t&&t&&"code"in t&&"ENOENT"===t.code)return;throw t}},exports.ignoreError=function(t){try{return t()}catch(t){}},exports.ignoreErrorAsync=async function(t){try{return await t()}catch(t){}};
|
|
2
|
-
//# sourceMappingURL=error.js.map
|
package/dist/cjs/error.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var r=require("./shuffle.js"),e=require("./error.js"),n=require("./zenkaku.js");exports.shuffle=r.shuffle,exports.ignoreEnoent=e.ignoreEnoent,exports.ignoreEnoentAsync=e.ignoreEnoentAsync,exports.ignoreError=e.ignoreError,exports.ignoreErrorAsync=e.ignoreErrorAsync,exports.zenkakuAlphanumericalsToHankaku=n.zenkakuAlphanumericalsToHankaku;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/shuffle.js
DELETED
package/dist/cjs/shuffle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shuffle.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/zenkaku.js
DELETED
package/dist/cjs/zenkaku.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zenkaku.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/esm/error.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/esm/index.d.ts
DELETED
package/dist/esm/index.js
DELETED
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/esm/shuffle.d.ts
DELETED
package/dist/esm/shuffle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shuffle.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/esm/zenkaku.d.ts
DELETED
package/dist/esm/zenkaku.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zenkaku.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|