@funkit/utils
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -15,2 +15,3 @@ export * from './address'; | ||
export * from './isNotNullish'; | ||
export * from './json'; | ||
export * from './locale'; | ||
@@ -17,0 +18,0 @@ export * from './mobile'; |
@@ -462,2 +462,21 @@ // src/utils/address.ts | ||
// src/utils/json.ts | ||
function safeParseJsonArray(src) { | ||
try { | ||
const value = src ? JSON.parse(src) : []; | ||
return Array.isArray(value) ? value : []; | ||
} catch { | ||
return []; | ||
} | ||
} | ||
function safeParseJson(src, onError) { | ||
if (!src) return null; | ||
try { | ||
return JSON.parse(src); | ||
} catch (e) { | ||
onError?.(e); | ||
return null; | ||
} | ||
} | ||
// src/utils/locale.ts | ||
@@ -544,4 +563,6 @@ var detectedBrowserLocale = () => { | ||
round, | ||
roundUpToXDecimalPlaces | ||
roundUpToXDecimalPlaces, | ||
safeParseJson, | ||
safeParseJsonArray | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@funkit/utils", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Funkit Utils SDK centralizes all utilities & consts for usage across all funkit apps and packages.", | ||
@@ -31,3 +31,3 @@ "files": [ | ||
"@testing-library/user-event": "^14.5.2", | ||
"jsdom": "^23.0.1", | ||
"jsdom": "^25.0.1", | ||
"react": "^18.3.0", | ||
@@ -34,0 +34,0 @@ "vitest": "^2.0.5" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55033
567