Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solid-aria/i18n

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-aria/i18n - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

9

dist/index.d.ts

@@ -42,2 +42,9 @@ import { Accessor, JSX } from 'solid-js';

/**
* Provides localized string collation for the current locale. Automatically updates when the locale changes,
* and handles caching of the collator for performance.
* @param options - Collator options.
*/
declare function createCollator(options?: Intl.CollatorOptions): Accessor<Intl.Collator>;
declare const RTL_LANGS: Set<string>;

@@ -51,2 +58,2 @@ /**

export { I18nProvider, Locale, RTL_LANGS, createDefaultLocale, getDefaultLocale, getReadingDirection, isRTL, useLocale };
export { I18nProvider, Locale, RTL_LANGS, createCollator, createDefaultLocale, getDefaultLocale, getReadingDirection, isRTL, useLocale };

@@ -115,5 +115,29 @@ // src/context.tsx

}
// src/createCollator.ts
import { createMemo as createMemo3 } from "solid-js";
var cache = /* @__PURE__ */ new Map();
function createCollator(options) {
const locale = useLocale();
const cacheKey = createMemo3(() => {
return locale().locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
});
const formatter = createMemo3(() => {
const key = cacheKey();
let collator;
if (cache.has(key)) {
collator = cache.get(key);
}
if (!collator) {
collator = new Intl.Collator(locale().locale, options);
cache.set(key, collator);
}
return collator;
});
return formatter;
}
export {
I18nProvider,
RTL_LANGS,
createCollator,
createDefaultLocale,

@@ -120,0 +144,0 @@ getDefaultLocale,

6

package.json
{
"name": "@solid-aria/i18n",
"version": "0.0.2",
"version": "0.0.3",
"private": false,

@@ -34,4 +34,4 @@ "description": "Primitives for dealing with locale and layout direction.",

"dependencies": {
"@solid-aria/types": "^0.0.1",
"@solid-aria/utils": "^0.0.1"
"@solid-aria/types": "^0.0.2",
"@solid-aria/utils": "^0.0.2"
},

@@ -38,0 +38,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc