From 4acb452a5d4077d3bf137bc7f56dd226065a1dd7 Mon Sep 17 00:00:00 2001 From: Pascal Duez Date: Thu, 29 Aug 2024 15:02:13 +0200 Subject: [PATCH] Remove usage of `except` helper package --- .jshintrc | 1 + index.js | 8 ++++---- package-lock.json | 16 +--------------- package.json | 3 +-- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/.jshintrc b/.jshintrc index 76093c9..26ef75f 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,4 +1,5 @@ { + "esversion": 11, "undef": true, "unused": "vars", "asi": false, diff --git a/index.js b/index.js index 83265d4..d32e345 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,6 @@ var extend = require('extend'); var sprintf = require("sprintf-js").sprintf; var events = require('events'); -var except = require('except'); var strftime = require('./strftime'); @@ -394,11 +393,12 @@ Counterpart.prototype._resolve = function(locale, scope, object, subject, option }; Counterpart.prototype._fallback = function(locale, scope, object, subject, options) { - options = except(options, 'fallback'); + /* jshint unused: false */ + var { fallback, ...restOptions } = options; if (Array.isArray(subject)) { for (var i = 0, ii = subject.length; i < ii; i++) { - var result = this._resolve(locale, scope, object, subject[i], options); + var result = this._resolve(locale, scope, object, subject[i], restOptions); if (result) { return result; @@ -407,7 +407,7 @@ Counterpart.prototype._fallback = function(locale, scope, object, subject, optio return null; } else { - return this._resolve(locale, scope, object, subject, options); + return this._resolve(locale, scope, object, subject, restOptions); } }; diff --git a/package-lock.json b/package-lock.json index 9e48591..fd1cb10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,13 +10,12 @@ "license": "MIT", "dependencies": { "date-names": "^0.1.11", - "except": "^0.1.3", "extend": "^3.0.0", "pluralizers": "^0.1.7", "sprintf-js": "^1.0.3" }, "devDependencies": { - "jshint": "^2.5.10", + "jshint": "^2.13.6", "mocha": "^2.0.1", "time": "github:riyadshauk/node-time" } @@ -183,14 +182,6 @@ "node": ">=0.8.0" } }, - "node_modules/except": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/except/-/except-0.1.3.tgz", - "integrity": "sha1-mCYckZWFUVNrREgiOOl4P7c9KSo=", - "dependencies": { - "indexof": "0.0.1" - } - }, "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -257,11 +248,6 @@ "readable-stream": "1.1" } }, - "node_modules/indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", diff --git a/package.json b/package.json index 1b8dc42..17de733 100644 --- a/package.json +++ b/package.json @@ -47,13 +47,12 @@ "packageManager": "npm@10.8.3+sha512.d08425c8062f56d43bb8e84315864218af2492eb769e1f1ca40740f44e85bd148969382d651660363942e5909cb7ffcbef7ca0ae963ddc2c57a51243b4da8f56", "dependencies": { "date-names": "^0.1.11", - "except": "^0.1.3", "extend": "^3.0.0", "pluralizers": "^0.1.7", "sprintf-js": "^1.0.3" }, "devDependencies": { - "jshint": "^2.5.10", + "jshint": "^2.13.6", "mocha": "^2.0.1", "time": "github:riyadshauk/node-time" }