🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@internationalized/string

Package Overview
Dependencies
Maintainers
2
Versions
718
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internationalized/string - npm Package Compare versions

Comparing version

to
3.0.1-nightly.3600

56

dist/main.js

@@ -7,3 +7,23 @@ function $parcel$export(e, n, v, s) {

$parcel$export(module.exports, "LocalizedStringFormatter", () => $3e95fbf3429967d1$export$2f817fcdc4b89ae0);
class $f80be5fd4d03dda9$export$c17fa47878dc55b6 {
/*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ /*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ class $f80be5fd4d03dda9$export$c17fa47878dc55b6 {
/** Returns a localized string for the given key and locale. */ getStringForLocale(key, locale) {

@@ -19,3 +39,3 @@ let strings = this.strings[locale];

}
constructor(messages, defaultLocale = 'en-US'){
constructor(messages, defaultLocale = "en-US"){
// Clone messages so we don't modify the original object.

@@ -28,3 +48,3 @@ this.strings = {

}
function $f80be5fd4d03dda9$var$getStringsForLocale(locale, strings, defaultLocale = 'en-US') {
function $f80be5fd4d03dda9$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
// If there is an exact match, use it.

@@ -40,3 +60,3 @@ if (strings[locale]) return strings[locale];

for(let key in strings){
if (key.startsWith(language + '-')) return strings[key];
if (key.startsWith(language + "-")) return strings[key];
}

@@ -50,7 +70,17 @@ // Nothing close, use english.

return new Intl.Locale(locale).language;
return locale.split('-')[0];
return locale.split("-")[0];
}
const $3e95fbf3429967d1$var$pluralRulesCache = new Map();
/*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ const $3e95fbf3429967d1$var$pluralRulesCache = new Map();
const $3e95fbf3429967d1$var$numberFormatCache = new Map();

@@ -60,8 +90,8 @@ class $3e95fbf3429967d1$export$2f817fcdc4b89ae0 {

let message = this.strings.getStringForLocale(key, this.locale);
return typeof message === 'function' ? message(variables, this) : message;
return typeof message === "function" ? message(variables, this) : message;
}
plural(count, options, type = 'cardinal') {
let opt = options['=' + count];
if (opt) return typeof opt === 'function' ? opt() : opt;
let key = this.locale + ':' + type;
plural(count, options, type = "cardinal") {
let opt = options["=" + count];
if (opt) return typeof opt === "function" ? opt() : opt;
let key = this.locale + ":" + type;
let pluralRules = $3e95fbf3429967d1$var$pluralRulesCache.get(key);

@@ -76,3 +106,3 @@ if (!pluralRules) {

opt = options[selected] || options.other;
return typeof opt === 'function' ? opt() : opt;
return typeof opt === "function" ? opt() : opt;
}

@@ -89,3 +119,3 @@ number(value) {

let opt = options[value] || options.other;
return typeof opt === 'function' ? opt() : opt;
return typeof opt === "function" ? opt() : opt;
}

@@ -92,0 +122,0 @@ constructor(locale, strings){

{
"name": "@internationalized/string",
"version": "3.0.1-nightly.3599+b35d5c02f",
"version": "3.0.1-nightly.3600+bfce84fee",
"description": "Internationalized string formatting and locale negotiation",

@@ -25,3 +25,3 @@ "license": "Apache-2.0",

"dependencies": {
"@babel/runtime": "^7.6.2"
"@swc/helpers": "^0.4.14"
},

@@ -31,3 +31,3 @@ "publishConfig": {

},
"gitHead": "b35d5c02fe900badccd0cf1a8f23bb593419f238"
"gitHead": "bfce84fee12a027d9cbc38b43e1747e3e4b4b169"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet