@axelarjs/utils
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -12,3 +12,3 @@ "use strict"; | ||
camelCase: (input) => input.charAt(0).toLowerCase() + | ||
input.slice(1).replace(/_(\w)/g, (_, char) => char.toUpperCase()), | ||
input.slice(1).replace(/_(\w)/g, (_, char) => String(char).toUpperCase()), | ||
"kebab-case": (input) => input | ||
@@ -25,3 +25,3 @@ .split(/(?=[A-Z])/) | ||
CONSTANT_CASE: (input) => input.toUpperCase(), | ||
camelCase: (input) => input.replace(/_(\w)/g, (_, char) => char.toUpperCase()), | ||
camelCase: (input) => input.replace(/_(\w)/g, (_, char) => String(char).toUpperCase()), | ||
"kebab-case": (input) => input.replace(/_/g, "-"), | ||
@@ -50,3 +50,3 @@ }, | ||
.slice(1) | ||
.replace(/_(\w)/g, (_, char) => char.toUpperCase()) | ||
.replace(/_(\w)/g, (_, char) => String(char).toUpperCase()) | ||
.replace(/(\w)([A-Z])/g, (_, first, second) => `${first}${second}`), | ||
@@ -66,3 +66,3 @@ snake_case: (input) => input.replace(/(\w)([A-Z])/g, (_, first, second) => `${first}_${second}`), | ||
CONSTANT_CASE: (input) => input.toUpperCase().replace(/-/g, "_"), | ||
camelCase: (input) => input.replace(/-(\w)/g, (_, char) => char.toUpperCase()), | ||
camelCase: (input) => input.replace(/-(\w)/g, (_, char) => String(char).toUpperCase()), | ||
}, | ||
@@ -69,0 +69,0 @@ }; |
@@ -8,3 +8,5 @@ "use strict"; | ||
function usePersistedState(storage, key, defaultValue) { | ||
const [state, _setState] = (0, react_1.useState)(() => monad_1.Maybe.of(storage.getItem(key)).mapOr(defaultValue, JSON.parse)); | ||
const [state, _setState] = (0, react_1.useState)(() => | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
monad_1.Maybe.of(storage.getItem(key)).mapOr(defaultValue, JSON.parse)); | ||
(0, react_1.useEffect)(() => { | ||
@@ -11,0 +13,0 @@ storage.setItem(key, JSON.stringify(state)); |
@@ -8,2 +8,3 @@ "use strict"; | ||
(0, react_1.useEffect)(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
ref.current = value; | ||
@@ -10,0 +11,0 @@ }, [value]); |
@@ -21,8 +21,5 @@ "use strict"; | ||
function pluralizeKeys(obj) { | ||
const nextEntries = Object.entries(obj).map(([key, value]) => [ | ||
`${key}s`, | ||
value, | ||
]); | ||
const nextEntries = Object.entries(obj).map(([key, value]) => [`${key}s`, value]); | ||
return Object.fromEntries(nextEntries); | ||
} | ||
exports.pluralizeKeys = pluralizeKeys; |
@@ -9,3 +9,3 @@ export const CONVERTERS = { | ||
camelCase: (input) => input.charAt(0).toLowerCase() + | ||
input.slice(1).replace(/_(\w)/g, (_, char) => char.toUpperCase()), | ||
input.slice(1).replace(/_(\w)/g, (_, char) => String(char).toUpperCase()), | ||
"kebab-case": (input) => input | ||
@@ -22,3 +22,3 @@ .split(/(?=[A-Z])/) | ||
CONSTANT_CASE: (input) => input.toUpperCase(), | ||
camelCase: (input) => input.replace(/_(\w)/g, (_, char) => char.toUpperCase()), | ||
camelCase: (input) => input.replace(/_(\w)/g, (_, char) => String(char).toUpperCase()), | ||
"kebab-case": (input) => input.replace(/_/g, "-"), | ||
@@ -47,3 +47,3 @@ }, | ||
.slice(1) | ||
.replace(/_(\w)/g, (_, char) => char.toUpperCase()) | ||
.replace(/_(\w)/g, (_, char) => String(char).toUpperCase()) | ||
.replace(/(\w)([A-Z])/g, (_, first, second) => `${first}${second}`), | ||
@@ -63,3 +63,3 @@ snake_case: (input) => input.replace(/(\w)([A-Z])/g, (_, first, second) => `${first}_${second}`), | ||
CONSTANT_CASE: (input) => input.toUpperCase().replace(/-/g, "_"), | ||
camelCase: (input) => input.replace(/-(\w)/g, (_, char) => char.toUpperCase()), | ||
camelCase: (input) => input.replace(/-(\w)/g, (_, char) => String(char).toUpperCase()), | ||
}, | ||
@@ -66,0 +66,0 @@ }; |
@@ -5,3 +5,5 @@ import { useEffect, useState } from "react"; | ||
export function usePersistedState(storage, key, defaultValue) { | ||
const [state, _setState] = useState(() => Maybe.of(storage.getItem(key)).mapOr(defaultValue, JSON.parse)); | ||
const [state, _setState] = useState(() => | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
Maybe.of(storage.getItem(key)).mapOr(defaultValue, JSON.parse)); | ||
useEffect(() => { | ||
@@ -8,0 +10,0 @@ storage.setItem(key, JSON.stringify(state)); |
@@ -5,2 +5,3 @@ import { useEffect, useRef } from "react"; | ||
useEffect(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
ref.current = value; | ||
@@ -7,0 +8,0 @@ }, [value]); |
@@ -17,7 +17,4 @@ export const caseInsensitiveRecord = (record) => new Proxy(record, { | ||
export function pluralizeKeys(obj) { | ||
const nextEntries = Object.entries(obj).map(([key, value]) => [ | ||
`${key}s`, | ||
value, | ||
]); | ||
const nextEntries = Object.entries(obj).map(([key, value]) => [`${key}s`, value]); | ||
return Object.fromEntries(nextEntries); | ||
} |
@@ -12,3 +12,3 @@ "use strict"; | ||
camelCase: (input) => input.charAt(0).toLowerCase() + | ||
input.slice(1).replace(/_(\w)/g, (_, char) => char.toUpperCase()), | ||
input.slice(1).replace(/_(\w)/g, (_, char) => String(char).toUpperCase()), | ||
"kebab-case": (input) => input | ||
@@ -25,3 +25,3 @@ .split(/(?=[A-Z])/) | ||
CONSTANT_CASE: (input) => input.toUpperCase(), | ||
camelCase: (input) => input.replace(/_(\w)/g, (_, char) => char.toUpperCase()), | ||
camelCase: (input) => input.replace(/_(\w)/g, (_, char) => String(char).toUpperCase()), | ||
"kebab-case": (input) => input.replace(/_/g, "-"), | ||
@@ -50,3 +50,3 @@ }, | ||
.slice(1) | ||
.replace(/_(\w)/g, (_, char) => char.toUpperCase()) | ||
.replace(/_(\w)/g, (_, char) => String(char).toUpperCase()) | ||
.replace(/(\w)([A-Z])/g, (_, first, second) => `${first}${second}`), | ||
@@ -66,3 +66,3 @@ snake_case: (input) => input.replace(/(\w)([A-Z])/g, (_, first, second) => `${first}_${second}`), | ||
CONSTANT_CASE: (input) => input.toUpperCase().replace(/-/g, "_"), | ||
camelCase: (input) => input.replace(/-(\w)/g, (_, char) => char.toUpperCase()), | ||
camelCase: (input) => input.replace(/-(\w)/g, (_, char) => String(char).toUpperCase()), | ||
}, | ||
@@ -69,0 +69,0 @@ }; |
{ | ||
"name": "@axelarjs/utils", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"publishConfig": { | ||
@@ -65,3 +65,3 @@ "access": "public" | ||
"@types/testing-library__jest-dom": "^5.14.9", | ||
"@vitejs/plugin-react": "^4.0.4", | ||
"@vitejs/plugin-react": "^4.1.0", | ||
"fast-check": "^3.13.0", | ||
@@ -73,7 +73,7 @@ "happy-dom": "^9.20.3", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^5.0.1", | ||
"rimraf": "^5.0.4", | ||
"typescript": "^5.2.2", | ||
"vite": "4.4.9", | ||
"vitest": "^0.34.5", | ||
"@axelarjs/config": "0.1.6" | ||
"@axelarjs/config": "0.1.7" | ||
}, | ||
@@ -80,0 +80,0 @@ "dependencies": { |
@@ -8,3 +8,5 @@ "use strict"; | ||
function usePersistedState(storage, key, defaultValue) { | ||
const [state, _setState] = (0, react_1.useState)(() => monad_1.Maybe.of(storage.getItem(key)).mapOr(defaultValue, JSON.parse)); | ||
const [state, _setState] = (0, react_1.useState)(() => | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
monad_1.Maybe.of(storage.getItem(key)).mapOr(defaultValue, JSON.parse)); | ||
(0, react_1.useEffect)(() => { | ||
@@ -11,0 +13,0 @@ storage.setItem(key, JSON.stringify(state)); |
@@ -8,2 +8,3 @@ "use strict"; | ||
(0, react_1.useEffect)(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
ref.current = value; | ||
@@ -10,0 +11,0 @@ }, [value]); |
@@ -21,8 +21,5 @@ "use strict"; | ||
function pluralizeKeys(obj) { | ||
const nextEntries = Object.entries(obj).map(([key, value]) => [ | ||
`${key}s`, | ||
value, | ||
]); | ||
const nextEntries = Object.entries(obj).map(([key, value]) => [`${key}s`, value]); | ||
return Object.fromEntries(nextEntries); | ||
} | ||
exports.pluralizeKeys = pluralizeKeys; |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
100077
107
1
5