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

i18n-js

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18n-js - npm Package Compare versions

Comparing version 4.0.0-alpha.5 to 4.0.0-alpha.6

17

dist/import/I18n.js

@@ -60,2 +60,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

this._defaultLocale = DEFAULT_I18N_OPTIONS.defaultLocale;
this.onChangeHandlers = [];
this.translations = {};

@@ -86,2 +87,3 @@ this.t = this.translate;

map.forEach((path) => set(this.translations, path, get(translations, path)));
this.runCallbacks();
}

@@ -95,3 +97,7 @@ get locale() {

}
const changed = this._locale !== newLocale;
this._locale = newLocale;
if (changed) {
this.runCallbacks();
}
}

@@ -105,3 +111,7 @@ get defaultLocale() {

}
const changed = this._defaultLocale !== newLocale;
this._defaultLocale = newLocale;
if (changed) {
this.runCallbacks();
}
}

@@ -243,2 +253,3 @@ toNumber(numeric, options) {

set(this.translations, path, newNode);
this.runCallbacks();
}

@@ -353,6 +364,12 @@ toSentence(items, options) {

}
onChange(callback) {
this.onChangeHandlers.push(callback);
}
get(path) {
return lookup(this, path);
}
runCallbacks() {
this.onChangeHandlers.forEach((callback) => callback(this));
}
}
//# sourceMappingURL=I18n.js.map

@@ -63,2 +63,3 @@ "use strict";

this._defaultLocale = DEFAULT_I18N_OPTIONS.defaultLocale;
this.onChangeHandlers = [];
this.translations = {};

@@ -89,2 +90,3 @@ this.t = this.translate;

map.forEach((path) => lodash_1.set(this.translations, path, lodash_1.get(translations, path)));
this.runCallbacks();
}

@@ -98,3 +100,7 @@ get locale() {

}
const changed = this._locale !== newLocale;
this._locale = newLocale;
if (changed) {
this.runCallbacks();
}
}

@@ -108,3 +114,7 @@ get defaultLocale() {

}
const changed = this._defaultLocale !== newLocale;
this._defaultLocale = newLocale;
if (changed) {
this.runCallbacks();
}
}

@@ -246,2 +256,3 @@ toNumber(numeric, options) {

lodash_1.set(this.translations, path, newNode);
this.runCallbacks();
}

@@ -356,7 +367,13 @@ toSentence(items, options) {

}
onChange(callback) {
this.onChangeHandlers.push(callback);
}
get(path) {
return helpers_1.lookup(this, path);
}
runCallbacks() {
this.onChangeHandlers.forEach((callback) => callback(this));
}
}
exports.I18n = I18n;
//# sourceMappingURL=I18n.js.map

2

package.json
{
"name": "i18n-js",
"version": "4.0.0-alpha.5",
"version": "4.0.0-alpha.6",
"description": "A small library to provide I18n on JavaScript.",

@@ -5,0 +5,0 @@ "main": "./dist/import/index.js",

@@ -1,2 +0,2 @@

import { DateTime, Dict, I18nOptions, MissingPlaceholderHandler, NullPlaceholderHandler, Scope, TimeAgoInWordsOptions, ToNumberOptions, ToSentenceOptions, TranslateOptions } from "../index.d";
import { DateTime, Dict, I18nOptions, MissingPlaceholderHandler, NullPlaceholderHandler, OnChangeHandler, Scope, TimeAgoInWordsOptions, ToNumberOptions, ToSentenceOptions, TranslateOptions } from "../index.d";
import { Locales } from "./Locales";

@@ -8,2 +8,3 @@ import { Pluralization } from "./Pluralization";

private _defaultLocale;
onChangeHandlers: OnChangeHandler[];
defaultSeparator: string;

@@ -44,3 +45,5 @@ enableFallback: boolean;

distanceOfTimeInWords: (fromTime: DateTime, toTime: DateTime, options?: TimeAgoInWordsOptions) => string;
onChange(callback: OnChangeHandler): void;
private get;
private runCallbacks;
}

Sorry, the diff of this file is too big to display

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

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