Socket
Socket
Sign inDemoInstall

y18n

Package Overview
Dependencies
0
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.5 to 5.0.6

31

build/lib/index.js

@@ -77,3 +77,3 @@ let shim;

// to the arguments expanded by util.format.
var values = [str];
const values = [str];
if (~str.indexOf('%d'))

@@ -101,3 +101,3 @@ values.push(quantity);

parts.forEach(function (part, i) {
var arg = args[i + 1];
const arg = args[i + 1];
str += part;

@@ -116,10 +116,10 @@ if (typeof arg !== 'undefined') {

_processWriteQueue() {
var _this = this;
var work = this.writeQueue[0];
const _this = this;
const work = this.writeQueue[0];
// destructure the enqueued work.
var directory = work.directory;
var locale = work.locale;
var cb = work.cb;
var languageFile = this._resolveLocaleFile(directory, locale);
var serializedLocale = JSON.stringify(this.cache[locale], null, 2);
const directory = work.directory;
const locale = work.locale;
const cb = work.cb;
const languageFile = this._resolveLocaleFile(directory, locale);
const serializedLocale = JSON.stringify(this.cache[locale], null, 2);
shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) {

@@ -133,6 +133,9 @@ _this.writeQueue.shift();

_readLocaleFile() {
var localeLookup = {};
var languageFile = this._resolveLocaleFile(this.directory, this.locale);
let localeLookup = {};
const languageFile = this._resolveLocaleFile(this.directory, this.locale);
try {
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8'));
// When using a bundler such as webpack, readFileSync may not be defined:
if (shim.fs.readFileSync) {
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8'));
}
}

@@ -151,6 +154,6 @@ catch (err) {

_resolveLocaleFile(directory, locale) {
var file = shim.resolve(directory, './', locale + '.json');
let file = shim.resolve(directory, './', locale + '.json');
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
// attempt fallback to language only
var languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
const languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
if (this._fileExistsSync(languageFile))

@@ -157,0 +160,0 @@ file = languageFile;

@@ -5,2 +5,9 @@ # Change Log

### [5.0.6](https://www.github.com/yargs/y18n/compare/v5.0.5...v5.0.6) (2021-04-05)
### Bug Fixes
* **webpack:** skip readFileSync if not defined ([#117](https://www.github.com/yargs/y18n/issues/117)) ([6966fa9](https://www.github.com/yargs/y18n/commit/6966fa91d2881cc6a6c531e836099e01f4da1616))
### [5.0.5](https://www.github.com/yargs/y18n/compare/v5.0.4...v5.0.5) (2020-10-25)

@@ -58,2 +65,9 @@

### 4.0.1 (2020-10-25)
### Bug Fixes
* address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/7de58ca0d315990cdb38234e97fc66254cdbcd71))
## [4.0.0](https://github.com/yargs/y18n/compare/v3.2.1...v4.0.0) (2017-10-10)

@@ -60,0 +74,0 @@

{
"name": "y18n",
"version": "5.0.5",
"version": "5.0.6",
"description": "the bare-bones internationalization library used by yargs",

@@ -30,4 +30,4 @@ "exports": {

"scripts": {
"check": "standardx '**/*.ts' '**/*.cjs' '**/*.mjs'",
"fix": "standardx --fix '**/*.ts' '**/*.cjs' '**/*.mjs'",
"check": "standardx **/*.ts **/*.cjs **/*.mjs",
"fix": "standardx --fix **/*.ts **/*.cjs **/*.mjs",
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",

@@ -54,3 +54,3 @@ "test": "c8 --reporter=text --reporter=html mocha test/*.cjs",

"rollup": "^2.26.10",
"standardx": "^5.0.0",
"standardx": "^7.0.0",
"ts-transform-default-export": "^1.0.2",

@@ -57,0 +57,0 @@ "typescript": "^4.0.0"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc