@silverhand/essentials
Advanced tools
Comparing version
@@ -8,2 +8,3 @@ // Intended | ||
typeof value.then === 'function'; | ||
// eslint-disable-next-line @typescript-eslint/promise-function-async | ||
const tryThat = (exec, onError) => { | ||
@@ -18,6 +19,4 @@ const handleError = (error) => { | ||
const unwrapped = typeof exec === 'function' ? exec() : exec; | ||
return isPromise(unwrapped) | ||
? // eslint-disable-next-line promise/prefer-await-to-then | ||
unwrapped.catch(handleError) | ||
: unwrapped; | ||
// eslint-disable-next-line promise/prefer-await-to-then | ||
return isPromise(unwrapped) ? unwrapped.catch(handleError) : unwrapped; | ||
} | ||
@@ -28,2 +27,3 @@ catch (error) { | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/promise-function-async | ||
const trySafe = (exec, onError) => { | ||
@@ -30,0 +30,0 @@ try { |
@@ -7,4 +7,4 @@ function toTitle(string) { | ||
.toLowerCase() | ||
.replace(/(?:^|\s|-)\S/g, (value) => value.toUpperCase()) | ||
.replace(/-/g, ' '); | ||
.replaceAll(/(?:^|\s|-)\S/g, (value) => value.toUpperCase()) | ||
.replaceAll('-', ' '); | ||
} | ||
@@ -15,4 +15,4 @@ /** | ||
*/ | ||
const replaceNonUrlSafeCharacters = (base64String) => base64String.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, ''); | ||
const restoreNonUrlSafeCharacters = (base64String) => base64String.replace(/-/g, '+').replace(/_/g, '/'); | ||
const replaceNonUrlSafeCharacters = (base64String) => base64String.replaceAll('+', '-').replaceAll('/', '_').replaceAll(/=+$/g, ''); | ||
const restoreNonUrlSafeCharacters = (base64String) => base64String.replaceAll('-', '+').replaceAll('_', '/'); | ||
const urlSafeBase64 = { | ||
@@ -19,0 +19,0 @@ isSafe: (input) => /^[\w-]*$/.test(input), |
{ | ||
"name": "@silverhand/essentials", | ||
"version": "2.8.6", | ||
"version": "2.8.7", | ||
"description": "The missing essentials for TypeScript (and JavaScript).", | ||
@@ -22,20 +22,20 @@ "repository": "git@github.com:silverhand-io/essentials.git", | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.0.2", | ||
"@rollup/plugin-typescript": "^11.1.0", | ||
"@silverhand/eslint-config": "1.3.0", | ||
"@silverhand/ts-config": "1.2.1", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@silverhand/eslint-config": "5.0.0", | ||
"@silverhand/ts-config": "5.0.0", | ||
"@types/jest": "^29.2.4", | ||
"@types/node": "^16.9.1", | ||
"eslint": "^8.30.0", | ||
"expect-type": "^0.14.0", | ||
"@types/node": "^20.11.6", | ||
"eslint": "^8.56.0", | ||
"expect-type": "^0.17.1", | ||
"jest": "^29.3.1", | ||
"jest-environment-jsdom": "^29.3.1", | ||
"jest-matcher-specific-error": "^1.0.0", | ||
"prettier": "^2.8.1", | ||
"rollup": "^3.21.0", | ||
"prettier": "^3.2.4", | ||
"rollup": "^4.0.0", | ||
"rollup-plugin-summary": "^2.0.0", | ||
"typescript": "^5.0.0" | ||
"typescript": "^5.3.3" | ||
}, | ||
"engines": { | ||
"node": "^16.13.0 || ^18.12.0 || ^19.2.0", | ||
"node": "^18.12.0 || ^20.9.0", | ||
"pnpm": "^8.0.0" | ||
@@ -42,0 +42,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38780
0.6%