diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 0000000..0ec79be --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,35 @@ +name: Test and Coverage + +on: + pull_request: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install dependencies + run: npm install + + - name: Run tests and collect coverage + run: mkdir -p coverage/tmp && npm run test:coverage + + - name: Wait for coverage report + run: sleep 3 + + - name: Debug coverage directory + run: ls -R coverage + + - name: Debug lcov.info + run: cat coverage/lcov.info + + - name: Publish to coveralls.io + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} \ No newline at end of file diff --git a/dist/handlebars-i18n.d.ts b/dist/handlebars-i18n.d.ts index 77e3ad7..6367eb2 100644 --- a/dist/handlebars-i18n.d.ts +++ b/dist/handlebars-i18n.d.ts @@ -18,7 +18,7 @@ type unitDisplay = "short" | "narrow" | "long"; type roundingPriority = "auto" | "morePrecision" | "lessPrecision"; type roundingMode = - | "ceil" + "ceil" | "floor" | "expand" | "trunc" @@ -197,13 +197,13 @@ export type DateTimeFormatConfiguration = [ CustomFormatName? ]; - type DateRelFormatOptions = { localeMatcher?: localeMatcher, numberingSystem?: numberingSystem, numeric?: "always" | "auto", style?: "long" | "short" | "narrow", - unit?: "second" | "minute" | "hour" | "day" | "week" | "month" | "year" + timeZone?: TimeZone, + unit?: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year" } export type RelativeTimeFormatConfiguration = [ diff --git a/dist/handlebars-i18n.js b/dist/handlebars-i18n.js index c2ce161..fa1b4b9 100644 --- a/dist/handlebars-i18n.js +++ b/dist/handlebars-i18n.js @@ -17,15 +17,14 @@ const Handlebars = require('handlebars'), i18next = require('i18next'), Intl = require('intl'), - RelativeTimeFormat= require('relative-time-format'); + RelativeTimeFormat = require('relative-time-format'); module.exports = factory( Handlebars, i18next, Intl, RelativeTimeFormat, process?.env?.NODE_ENV === 'TEST'); - } - else if (typeof define === 'function' && define.amd) + } else if (typeof define === 'function' && define.amd) define(['Handlebars', 'i18next', 'Intl'], factory); else if (typeof root.Handlebars === 'object' && typeof root.i18next === 'object' @@ -151,7 +150,7 @@ return false; } - if (! ['DateTimeFormat', 'RelativeTimeFormat', 'NumberFormat', 'PriceFormat'].includes(typeOfFormat)) { + if (!['DateTimeFormat', 'RelativeTimeFormat', 'NumberFormat', 'PriceFormat'].includes(typeOfFormat)) { console.error('@ handlebars-i18n.configure(): Invalid argument <' + typeOfFormat + '>. ' + 'Second argument must be a string with the options key. ' + 'Use either "DateTimeFormat", "RelativeTimeFormat", "NumberFormat", or "PriceFormat".'); @@ -191,8 +190,7 @@ optionsConf[formatType].custom[customFormat] = {}; optionsConf[formatType].custom[customFormat][lang] = options; - } - else + } else optionsConf[formatType].standard[lang] = options; return true; @@ -221,8 +219,7 @@ if (typeof dateInput === 'number') { // input as milliseconds since unix epoch, like: 1583922952743 date = new Date(dateInput); - } - else if (typeof dateInput === 'string') { + } else if (typeof dateInput === 'string') { if (dateInput.charAt(0) === '[' && dateInput.slice(-1) === ']') { // input as array represented as string such as "[2020, 11]" @@ -230,17 +227,14 @@ let dateArr = dateInput.split(','); let dateFactory = __applyToConstructor.bind(null, Date); date = dateFactory(dateArr); - } - else if (dateInput.toLowerCase() === 'now' || dateInput.toLowerCase() === 'today') { + } else if (dateInput.toLowerCase() === 'now' || dateInput.toLowerCase() === 'today') { // input as word "now" or "today" date = new Date(); - } - else { + } else { // input as date string such as "1995-12-17T03:24:00" date = new Date(dateInput); } - } - else { + } else { // fallback: today’s date date = new Date(); } @@ -337,8 +331,7 @@ else return false; }); - } - else { + } else { if (__validateArgs(langOrArr, typeOfFormat, options, customFormatName)) __setArgs(langOrArr, typeOfFormat, options, customFormatName); else @@ -393,7 +386,7 @@ * @returns {*} */ function (str, attributes) { - return new handlebars.SafeString((typeof(i18next) !== 'undefined' ? i18next.t(str, attributes.hash) : str)); + return new handlebars.SafeString((typeof (i18next) !== 'undefined' ? i18next.t(str, attributes.hash) : str)); } ); handlebars.registerHelper('_locale', @@ -445,7 +438,7 @@ * @param options */ function (dateInput, options) { - const date= __createDateObj(dateInput); + const date = __createDateObj(dateInput); const opts = __configLookup(options, i18next.language, optionsConf.DateTimeFormat); const dateFormat = new Intl.DateTimeFormat(i18next.language, opts); return dateFormat.format(date); @@ -468,7 +461,7 @@ * @returns {string} */ function (dateValue, options) { - const relDate= parseInt(dateValue); + const relDate = parseInt(dateValue); const opts = __configLookup(options, i18next.language, optionsConf.RelativeTimeFormat); const relDateFormat = __getRelDateFormatPolyfill(i18next.language, opts); return relDateFormat.format(relDate, opts.unit); @@ -485,20 +478,20 @@ function (dateInputA, dateInputB, options) { let dateDiff; + let opts = __configLookup(options, i18next.language, optionsConf.RelativeTimeFormat); - if (! __isNumOrString(dateInputA) && ! __isNumOrString(dateInputB)) + if (!__isNumOrString(dateInputA)) { + console.error('@ handlebars-i18n: invalid first argument dateInputA was given for _dateDiff.'); return null; - else if (! __isNumOrString(dateInputB)) - dateDiff = __createDateObj(dateInputA); - else if (! __isNumOrString(dateInputA)) - dateDiff = __createDateObj(dateInputB); - else { - const dateA= __createDateObj(dateInputA); - const dateB= __createDateObj(dateInputB); - dateDiff = dateA - dateB; } - const opts = __configLookup(options, i18next.language, optionsConf.RelativeTimeFormat); + dateInputB = dateInputB || 'now'; + + let dateA = __createDateObj(dateInputA); + let dateB = __createDateObj(dateInputB); + + dateDiff = dateA - dateB; + const relDate = __getDateDiff(dateDiff, opts.unit); const relDateFormat = __getRelDateFormatPolyfill(i18next.language, opts); return relDateFormat.format(relDate, opts.unit); diff --git a/dist/handlebars-i18n.min.js b/dist/handlebars-i18n.min.js index 7e0f75a..d94f7f2 100644 --- a/dist/handlebars-i18n.min.js +++ b/dist/handlebars-i18n.min.js @@ -1 +1 @@ -!function(e,r){if("object"==typeof exports&&"object"==typeof module){const e=require("handlebars"),t=require("i18next"),n=require("intl"),a=require("relative-time-format");module.exports=r(e,t,n,a,"TEST"===process?.env?.NODE_ENV)}else if("function"==typeof define&&define.amd)define(["Handlebars","i18next","Intl"],r);else{if("object"!=typeof e.Handlebars||"object"!=typeof e.i18next||"object"!=typeof e.Intl)return console.error("@ handlebars-i18n: One or more dependencies are missing. Check for Handlebars, i18next and Intl."),!1;e.HandlebarsI18n=r(e.Handlebars,e.i18next,e.Intl)}}(this,(function(e,r,t,n,a){"use strict";const o={DateTimeFormat:{standard:{},custom:{}},RelativeTimeFormat:{standard:{all:{unit:"hours"}},custom:{}},NumberFormat:{standard:{},custom:{}},PriceFormat:{standard:{all:{style:"currency",currency:"EUR"}},custom:{}}};let i=JSON.parse(JSON.stringify(o));const u={};function s(e,r){let t=[null].concat(r);return new(e.bind.apply(e,t))}function l(e,r,t){if("object"==typeof e&&"object"==typeof e.hash&&Object.keys(e.hash).length>0){let n=e.hash;if(void 0===n.format)return n;if(void 0!==t.custom[n.format]&&void 0!==t.custom[n.format][r])return t.custom[n.format][r]}return void 0!==t.standard[r]?t.standard[r]:void 0!==t.standard.all?t.standard.all:{}}function c(e,r,t,n){return"string"!=typeof e?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en".'),!1):["DateTimeFormat","RelativeTimeFormat","NumberFormat","PriceFormat"].includes(r)?"object"!=typeof t?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+t+"> Third argument must be an object containing the configuration parameters."),!1):(null==n||"string"==typeof n)&&""!==n&&" "!==n||(console.error("@ handlebars-i18n.configure(): Invalid argument <"+n+"> Fourth argument (optional) must be a string naming your custom format configuration."),!1):(console.error("@ handlebars-i18n.configure(): Invalid argument <"+r+'>. Second argument must be a string with the options key. Use either "DateTimeFormat", "RelativeTimeFormat", "NumberFormat", or "PriceFormat".'),!1)}function m(e,r,t,n){return null!=n?(void 0===i[r].custom[n]&&(i[r].custom[n]={}),i[r].custom[n][e]=t):i[r].standard[e]=t,!0}function f(e){return"number"==typeof e||"string"==typeof e&&""!==e}function g(e){let r;if("number"==typeof e)r=new Date(e);else if("string"==typeof e)if("["===e.charAt(0)&&"]"===e.slice(-1)){let t=(e=e.substring(1,e.length-1).replace(/ /g,"")).split(",");r=s.bind(null,Date)(t)}else r="now"===e.toLowerCase()||"today"===e.toLowerCase()?new Date:new Date(e);else r=new Date;return r}function d(e,r){if("function"==typeof t.RelativeTimeFormat)return new t.RelativeTimeFormat(e,r);if(void 0===u[e])try{u[e]=require(`relative-time-format/locale/${e}`)}catch(e){console.error(e)}return n.addLocale(u[e]),new n(e,r)}function b(e,r){return r=r||"hour",Math.trunc(e/{second:1e3,seconds:1e3,minute:6e4,minutes:6e4,hour:36e5,hours:36e5,day:864e5,days:864e5,week:6048e5,weeks:6048e5,month:2629746e3,months:2629746e3,quarter:78894e5,quarters:78894e5,year:315576e5,years:315576e5}[r])}return{configure:function(e,r,t,n){if("string"!=typeof e&&!Array.isArray(e))return console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en" or an array with language parameters.'),!1;if(Array.isArray(e)){if(e.length<1)return console.log("@ handlebars-i18n.configure(): You passed an empty array, no parameters taken."),!1;e.forEach((e=>{if(!c(e[0],e[1],e[2],e[3]))return!1;m(e[0],e[1],e[2],e[3])}))}else{if(!c(e,r,t,n))return!1;m(e,r,t,n)}return!0},reset:function(){return i=JSON.parse(JSON.stringify(o)),!0},init:function(n,a){return"object"==typeof n&&null!==n?e=n:null!=n&&console.error("@ handlebars-i18n.init(): Invalid Argument [1] given for overrideHndlbrs. Argument must be the Handlebars object. Using generic Handlebars object instead."),"object"==typeof a&&null!==a?r=a:null!=a&&console.error("@ handlebars-i18n.init(): Invalid Argument [2] given for overrideI18n. Argument must be the i18next object. Using generic i18next object on module level instead."),e.registerHelper("__",(function(t,n){return new e.SafeString(void 0!==r?r.t(t,n.hash):t)})),e.registerHelper("_locale",(function(){return r.language})),e.registerHelper("localeIs",(function(e){return r.language===e})),e.registerHelper("_date",(function(e,n){const a=g(e),o=l(n,r.language,i.DateTimeFormat);return new t.DateTimeFormat(r.language,o).format(a)})),e.registerHelper("_dateRel",(function(e,t){const n=parseInt(e),a=l(t,r.language,i.RelativeTimeFormat);return d(r.language,a).format(n,a.unit)})),e.registerHelper("_dateDiff",(function(e,t,n){let a;if(!f(e)&&!f(t))return null;if(f(t))if(f(e)){a=g(e)-g(t)}else a=g(t);else a=g(e);const o=l(n,r.language,i.RelativeTimeFormat),u=b(a,o.unit);return d(r.language,o).format(u,o.unit)})),e.registerHelper("_num",(function(e,n){let a=l(n,r.language,i.NumberFormat);return new t.NumberFormat(r.language,a).format(e)})),e.registerHelper("_price",(function(e,n){let a=l(n,r.language,i.PriceFormat);"string"!=typeof a.style&&"string"==typeof a.currency&&(a.style="currency");return new t.NumberFormat(r.language,a).format(e)})),e},...a&&{private:{applyToConstructor:s,configLookup:l,validateArgs:c,setArgs:m,isNumOrString:f,createDateObj:g,getRelDateFormatPolyfill:d,getDateDiff:b}}}})); \ No newline at end of file +!function(e,r){if("object"==typeof exports&&"object"==typeof module){const e=require("handlebars"),t=require("i18next"),n=require("intl"),a=require("relative-time-format");module.exports=r(e,t,n,a,"TEST"===process?.env?.NODE_ENV)}else if("function"==typeof define&&define.amd)define(["Handlebars","i18next","Intl"],r);else{if("object"!=typeof e.Handlebars||"object"!=typeof e.i18next||"object"!=typeof e.Intl)return console.error("@ handlebars-i18n: One or more dependencies are missing. Check for Handlebars, i18next and Intl."),!1;e.HandlebarsI18n=r(e.Handlebars,e.i18next,e.Intl)}}(this,(function(e,r,t,n,a){"use strict";const o={DateTimeFormat:{standard:{},custom:{}},RelativeTimeFormat:{standard:{all:{unit:"hours"}},custom:{}},NumberFormat:{standard:{},custom:{}},PriceFormat:{standard:{all:{style:"currency",currency:"EUR"}},custom:{}}};let i=JSON.parse(JSON.stringify(o));const u={};function s(e,r){let t=[null].concat(r);return new(e.bind.apply(e,t))}function l(e,r,t){if("object"==typeof e&&"object"==typeof e.hash&&Object.keys(e.hash).length>0){let n=e.hash;if(void 0===n.format)return n;if(void 0!==t.custom[n.format]&&void 0!==t.custom[n.format][r])return t.custom[n.format][r]}return void 0!==t.standard[r]?t.standard[r]:void 0!==t.standard.all?t.standard.all:{}}function c(e,r,t,n){return"string"!=typeof e?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en".'),!1):["DateTimeFormat","RelativeTimeFormat","NumberFormat","PriceFormat"].includes(r)?"object"!=typeof t?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+t+"> Third argument must be an object containing the configuration parameters."),!1):(null==n||"string"==typeof n)&&""!==n&&" "!==n||(console.error("@ handlebars-i18n.configure(): Invalid argument <"+n+"> Fourth argument (optional) must be a string naming your custom format configuration."),!1):(console.error("@ handlebars-i18n.configure(): Invalid argument <"+r+'>. Second argument must be a string with the options key. Use either "DateTimeFormat", "RelativeTimeFormat", "NumberFormat", or "PriceFormat".'),!1)}function m(e,r,t,n){return null!=n?(void 0===i[r].custom[n]&&(i[r].custom[n]={}),i[r].custom[n][e]=t):i[r].standard[e]=t,!0}function f(e){return"number"==typeof e||"string"==typeof e&&""!==e}function g(e){let r;if("number"==typeof e)r=new Date(e);else if("string"==typeof e)if("["===e.charAt(0)&&"]"===e.slice(-1)){let t=(e=e.substring(1,e.length-1).replace(/ /g,"")).split(",");r=s.bind(null,Date)(t)}else r="now"===e.toLowerCase()||"today"===e.toLowerCase()?new Date:new Date(e);else r=new Date;return r}function d(e,r){if("function"==typeof t.RelativeTimeFormat)return new t.RelativeTimeFormat(e,r);if(void 0===u[e])try{u[e]=require(`relative-time-format/locale/${e}`)}catch(e){console.error(e)}return n.addLocale(u[e]),new n(e,r)}function b(e,r){return r=r||"hour",Math.trunc(e/{second:1e3,seconds:1e3,minute:6e4,minutes:6e4,hour:36e5,hours:36e5,day:864e5,days:864e5,week:6048e5,weeks:6048e5,month:2629746e3,months:2629746e3,quarter:78894e5,quarters:78894e5,year:315576e5,years:315576e5}[r])}return{configure:function(e,r,t,n){if("string"!=typeof e&&!Array.isArray(e))return console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en" or an array with language parameters.'),!1;if(Array.isArray(e)){if(e.length<1)return console.log("@ handlebars-i18n.configure(): You passed an empty array, no parameters taken."),!1;e.forEach((e=>{if(!c(e[0],e[1],e[2],e[3]))return!1;m(e[0],e[1],e[2],e[3])}))}else{if(!c(e,r,t,n))return!1;m(e,r,t,n)}return!0},reset:function(){return i=JSON.parse(JSON.stringify(o)),!0},init:function(n,a){return"object"==typeof n&&null!==n?e=n:null!=n&&console.error("@ handlebars-i18n.init(): Invalid Argument [1] given for overrideHndlbrs. Argument must be the Handlebars object. Using generic Handlebars object instead."),"object"==typeof a&&null!==a?r=a:null!=a&&console.error("@ handlebars-i18n.init(): Invalid Argument [2] given for overrideI18n. Argument must be the i18next object. Using generic i18next object on module level instead."),e.registerHelper("__",(function(t,n){return new e.SafeString(void 0!==r?r.t(t,n.hash):t)})),e.registerHelper("_locale",(function(){return r.language})),e.registerHelper("localeIs",(function(e){return r.language===e})),e.registerHelper("_date",(function(e,n){const a=g(e),o=l(n,r.language,i.DateTimeFormat);return new t.DateTimeFormat(r.language,o).format(a)})),e.registerHelper("_dateRel",(function(e,t){const n=parseInt(e),a=l(t,r.language,i.RelativeTimeFormat);return d(r.language,a).format(n,a.unit)})),e.registerHelper("_dateDiff",(function(e,t,n){let a,o=l(n,r.language,i.RelativeTimeFormat);if(!f(e))return console.error("@ handlebars-i18n: invalid first argument dateInputA was given for _dateDiff."),null;t=t||"now",a=g(e)-g(t);const u=b(a,o.unit);return d(r.language,o).format(u,o.unit)})),e.registerHelper("_num",(function(e,n){let a=l(n,r.language,i.NumberFormat);return new t.NumberFormat(r.language,a).format(e)})),e.registerHelper("_price",(function(e,n){let a=l(n,r.language,i.PriceFormat);"string"!=typeof a.style&&"string"==typeof a.currency&&(a.style="currency");return new t.NumberFormat(r.language,a).format(e)})),e},...a&&{private:{applyToConstructor:s,configLookup:l,validateArgs:c,setArgs:m,isNumOrString:f,createDateObj:g,getRelDateFormatPolyfill:d,getDateDiff:b}}}})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c1e4e9a..58fd02d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "handlebars-i18n", - "version": "1.7.0", + "version": "1.7.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "handlebars-i18n", - "version": "1.7.0", + "version": "1.7.1", "license": "MIT", "dependencies": { "handlebars": "^4.7.7", @@ -19,6 +19,7 @@ "@commitlint/config-conventional": "16.2.1", "@types/intl": "^1.2.0", "@types/node": "^18.13.0", + "c8": "^10.1.2", "chai": "4.3.6", "coveralls": "3.1.1", "gulp": "5.0.0", @@ -27,7 +28,6 @@ "gulp-uglify-es": "3.0.0", "html-entities": "^2.5.2", "husky": "7.0.4", - "istanbul": "0.4.5", "mocha": "9.2.2", "nyc": "15.1.0", "typescript": "^4.9.5" @@ -557,6 +557,12 @@ "node": ">=6.9.0" } }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, "node_modules/@commitlint/cli": { "version": "17.6.1", "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-17.6.1.tgz", @@ -895,6 +901,102 @@ "node": ">=10.13.0" } }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1030,6 +1132,16 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -1060,6 +1172,12 @@ "integrity": "sha512-BP+KwmOvD9AR5aoxnbyyPr3fAtpjEI/bVImHsotmpuC43+z0NAmjJ9cQbX7vPCq8XcvCeAVc8E3KSQPYNaPsUQ==", "dev": true }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, "node_modules/@types/minimist": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", @@ -1084,12 +1202,6 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, - "node_modules/abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, "node_modules/acorn": { "version": "8.7.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", @@ -1140,16 +1252,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.4.2" - } - }, "node_modules/ansi-colors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", @@ -1328,12 +1430,6 @@ "node": ">=0.10.0" } }, - "node_modules/async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, "node_modules/async-done": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/async-done/-/async-done-2.0.0.tgz", @@ -1567,6 +1663,169 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/c8": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/c8/-/c8-10.1.2.tgz", + "integrity": "sha512-Qr6rj76eSshu5CgRYvktW0uM0CFY0yi4Fd5D0duDXO6sYinyopmftUiJVuzBQxQcwQLor7JWDVRP+dUfCmzgJw==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@istanbuljs/schema": "^0.1.3", + "find-up": "^5.0.0", + "foreground-child": "^3.1.1", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.1.6", + "test-exclude": "^7.0.1", + "v8-to-istanbul": "^9.0.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1" + }, + "bin": { + "c8": "bin/c8.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "monocart-coverage-reports": "^2" + }, + "peerDependenciesMeta": { + "monocart-coverage-reports": { + "optional": true + } + } + }, + "node_modules/c8/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/c8/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/c8/node_modules/foreground-child": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/c8/node_modules/glob": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", + "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/c8/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/c8/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/c8/node_modules/test-exclude": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", + "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^10.4.1", + "minimatch": "^9.0.4" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/c8/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/c8/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/caching-transform": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", @@ -2073,12 +2332,6 @@ "node": ">=0.12" } }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, "node_modules/default-require-extensions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", @@ -2143,6 +2396,12 @@ "node": ">= 10.13.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -2210,72 +2469,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "dependencies": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=0.12.0" - }, - "optionalDependencies": { - "source-map": "~0.2.0" - } - }, - "node_modules/escodegen/node_modules/source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "dependencies": { - "amdefine": ">=0.0.4" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -2344,12 +2537,6 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, "node_modules/fastest-levenshtein": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", @@ -2671,22 +2858,6 @@ "node": ">=10" } }, - "node_modules/glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "dependencies": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - } - }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -3563,32 +3734,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "node_modules/istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "deprecated": "This module is no longer maintained, try this instead:\n npm i nyc\nVisit https://istanbul.js.org/integrations for other alternatives.", - "dev": true, - "dependencies": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "istanbul": "lib/cli.js" - } - }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -3653,17 +3798,44 @@ } }, "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "dependencies": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-report/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/istanbul-lib-source-maps": { @@ -3704,9 +3876,9 @@ "dev": true }, "node_modules/istanbul-reports": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz", - "integrity": "sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -3716,25 +3888,22 @@ "node": ">=8" } }, - "node_modules/istanbul/node_modules/has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/istanbul/node_modules/supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "node_modules/jackspeak": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", "dev": true, "dependencies": { - "has-flag": "^1.0.0" + "@isaacs/cliui": "^8.0.2" }, "engines": { - "node": ">=0.8.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" } }, "node_modules/js-tokens": { @@ -3902,19 +4071,6 @@ "node": ">=10.13.0" } }, - "node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/liftoff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-5.0.0.tgz", @@ -4272,16 +4428,13 @@ "node": ">=0.10.0" } }, - "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" + "engines": { + "node": ">=16 || 14 >=14.17" } }, "node_modules/mocha": { @@ -4537,18 +4690,6 @@ "integrity": "sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg==", "dev": true }, - "node_modules/nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, "node_modules/normalize-package-data": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", @@ -4854,23 +4995,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -4937,6 +5061,12 @@ "node": ">=8" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5044,6 +5174,31 @@ "node": ">=0.10.0" } }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -5202,15 +5357,6 @@ "node": ">=0.10.0" } }, - "node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -5604,12 +5750,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, "node_modules/resolve-dir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", @@ -5999,6 +6139,21 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -6011,6 +6166,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -6329,18 +6497,6 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true }, - "node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -6478,6 +6634,26 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, "node_modules/v8flags": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-4.0.1.tgz", @@ -6709,27 +6885,36 @@ "which": "bin/which" } }, - "node_modules/word-wrap": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", - "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, + "node_modules/workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" - }, - "node_modules/workerpool": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", - "dev": true - }, - "node_modules/wrap-ansi": { + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", @@ -7284,6 +7469,12 @@ "to-fast-properties": "^2.0.0" } }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, "@commitlint/cli": { "version": "17.6.1", "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-17.6.1.tgz", @@ -7555,6 +7746,71 @@ "is-negated-glob": "^1.0.0" } }, + "@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "requires": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -7662,6 +7918,13 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -7692,6 +7955,12 @@ "integrity": "sha512-BP+KwmOvD9AR5aoxnbyyPr3fAtpjEI/bVImHsotmpuC43+z0NAmjJ9cQbX7vPCq8XcvCeAVc8E3KSQPYNaPsUQ==", "dev": true }, + "@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, "@types/minimist": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", @@ -7716,12 +7985,6 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, "acorn": { "version": "8.7.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", @@ -7756,13 +8019,6 @@ "uri-js": "^4.2.2" } }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true, - "optional": true - }, "ansi-colors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", @@ -7896,12 +8152,6 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, "async-done": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/async-done/-/async-done-2.0.0.tgz", @@ -8069,6 +8319,118 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "c8": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/c8/-/c8-10.1.2.tgz", + "integrity": "sha512-Qr6rj76eSshu5CgRYvktW0uM0CFY0yi4Fd5D0duDXO6sYinyopmftUiJVuzBQxQcwQLor7JWDVRP+dUfCmzgJw==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@istanbuljs/schema": "^0.1.3", + "find-up": "^5.0.0", + "foreground-child": "^3.1.1", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.1.6", + "test-exclude": "^7.0.1", + "v8-to-istanbul": "^9.0.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "foreground-child": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + } + }, + "glob": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", + "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + } + }, + "minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true + }, + "test-exclude": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", + "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^10.4.1", + "minimatch": "^9.0.4" + } + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + } + } + }, "caching-transform": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", @@ -8454,12 +8816,6 @@ "type-detect": "^4.0.0" } }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, "default-require-extensions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", @@ -8506,6 +8862,12 @@ "object.defaults": "^1.1.0" } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -8564,49 +8926,6 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" - }, - "dependencies": { - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": ">=0.0.4" - } - } - } - }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, "execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -8663,12 +8982,6 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, "fastest-levenshtein": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", @@ -8891,19 +9204,6 @@ "through2": "^4.0.0" } }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -9541,45 +9841,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "dev": true, - "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" - }, - "dependencies": { - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - } - } - }, "istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -9631,14 +9892,31 @@ } }, "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "requires": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" + }, + "dependencies": { + "make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "requires": { + "semver": "^7.5.3" + } + }, + "semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true + } } }, "istanbul-lib-source-maps": { @@ -9670,15 +9948,25 @@ } }, "istanbul-reports": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz", - "integrity": "sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, "requires": { "html-escaper": "^2.0.0", "istanbul-lib-report": "^3.0.0" } }, + "jackspeak": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", + "dev": true, + "requires": { + "@isaacs/cliui": "^8.0.2", + "@pkgjs/parseargs": "^0.11.0" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -9801,16 +10089,6 @@ "integrity": "sha512-DpMa59o5uGUWWjruMp71e6knmwKU3jRBBn1kjuLWN9EeIOxNeSAwvHf03WIl8g/ZMR2oSQC9ej3yeLBwdDc/pg==", "dev": true }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, "liftoff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-5.0.0.tgz", @@ -10099,14 +10377,11 @@ } } }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } + "minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true }, "mocha": { "version": "9.2.2", @@ -10292,15 +10567,6 @@ "integrity": "sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg==", "dev": true }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dev": true, - "requires": { - "abbrev": "1" - } - }, "normalize-package-data": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", @@ -10545,20 +10811,6 @@ "mimic-fn": "^2.1.0" } }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -10604,6 +10856,12 @@ "release-zalgo": "^1.0.0" } }, + "package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -10681,6 +10939,24 @@ "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", "dev": true }, + "path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "requires": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", + "dev": true + } + } + }, "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -10801,12 +11077,6 @@ } } }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -11119,12 +11389,6 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, "resolve-dir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", @@ -11434,6 +11698,17 @@ "strip-ansi": "^6.0.1" } }, + "string-width-cjs": { + "version": "npm:string-width@4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -11443,6 +11718,15 @@ "ansi-regex": "^5.0.1" } }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, "strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -11678,15 +11962,6 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -11788,6 +12063,25 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "dependencies": { + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + } + } + }, "v8flags": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-4.0.1.tgz", @@ -11984,12 +12278,6 @@ "isexe": "^2.0.0" } }, - "word-wrap": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", - "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", - "dev": true - }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -12012,6 +12300,17 @@ "strip-ansi": "^6.0.0" } }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 7b0de4f..ba634de 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "handlebars-i18n", - "version": "1.7.0", + "version": "1.7.1", "description": "handlebars-i18n adds internationalization to handlebars.js using i18next and Intl.", "main": "dist/handlebars-i18n.js", "scripts": { - "test": "NODE_ENV=TEST nyc mocha", - "coveralls": "NODE_ENV=TEST istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", + "test": "NODE_ENV=TEST c8 mocha", + "test:coverage": "npm run test && NODE_ENV=TEST c8 report --reporter=text-lcov > coverage/lcov.info", "compress": "gulp compress", "example:js": "cd examples/node-example && node simple-example.js", "example:ts": "cd examples/typescript && tsc && node index.js" @@ -48,6 +48,7 @@ "@commitlint/config-conventional": "16.2.1", "@types/intl": "^1.2.0", "@types/node": "^18.13.0", + "c8": "^10.1.2", "chai": "4.3.6", "coveralls": "3.1.1", "gulp": "5.0.0", @@ -56,7 +57,6 @@ "gulp-uglify-es": "3.0.0", "html-entities": "^2.5.2", "husky": "7.0.4", - "istanbul": "0.4.5", "mocha": "9.2.2", "nyc": "15.1.0", "typescript": "^4.9.5" diff --git a/readme.md b/readme.md index 4910711..ba47e11 100644 --- a/readme.md +++ b/readme.md @@ -10,8 +10,7 @@ Handlebars-i18n is listed amongst i18next’s [framework helpers](https://www.i1 [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) ![Node.js Version](https://img.shields.io/badge/Node.js-14.x-green) [![Build](https://github.com/fwalzel/handlebars-i18n/actions/workflows/node.js.yml/badge.svg)](https://github.com/fwalzel/handlebars-i18n/actions/workflows/node.js.yml/badge.svg) -[![Coverage Status](https://coveralls.io/repos/github/fwalzel/handlebars-i18next/badge.svg?branch=master)](https://coveralls.io/github/fwalzel/handlebars-i18next?branch=master) -[![Code Climate](https://codeclimate.com/github/Aller-Couleur/handlebars-i18n/badges/gpa.svg)](https://codeclimate.com/github/Aller-Couleur/handlebars-i18n) +[![Coverage Status](https://coveralls.io/repos/github/Aller-Couleur/handlebars-i18n/badge.svg?branch=master)](https://coveralls.io/github/Aller-Couleur/handlebars-i18n?branch=master)[![Code Climate](https://codeclimate.com/github/Aller-Couleur/handlebars-i18n/badges/gpa.svg)](https://codeclimate.com/github/Aller-Couleur/handlebars-i18n) [![Known Vulnerabilities](https://snyk.io/test/github/Aller-Couleur/handlebars-i18n/badge.svg)](https://snyk.io/test/github/Aller-Couleur/handlebars-i18n/badge.svg) ![npm](https://img.shields.io/npm/dt/handlebars-i18n) ![npm](https://img.shields.io/npm/dm/handlebars-i18n) @@ -197,13 +196,9 @@ Template usage: The i18next resource: ```javascript -"en" -: -{ +"en" : { translation : { - "whatIsWhat" - : - "{{a}} is {{b}}." + "whatIsWhat" : "{{a}} is {{b}}." } } ``` @@ -215,19 +210,12 @@ The i18next resource: ``` ```javascript -"en" -: -{ +"en" : { translation : { - "keyWithCount" - : - "{{count}} item", - "keyWithCount_plural" - : - "{{count}} items" + "keyWithCount" : "{{count}} item", + "keyWithCount_plural" : "{{count}} items" } -} -, ... +}, ... ``` **Override globally selected language** @@ -328,7 +316,8 @@ Will output for "en" → **in 7 hours** Will output for "en" → **7 hours ago** A positive number argument leads to a future event statement, a negative refers to a past date. Possible units -are `"second"` | `"minute"` | `"hour"` | `"day"` | `"week"` | `"month"` | `"year"` (default is `"hour"`). For a complete +are `"second"` | `"minute"` | `"hour"` | `"day"` | `"week"` | `"month"` | `"quarter"` | `"year"` (default is `"hour"`). +For a complete set of options (such as `numberingSystem` or `localeMatcher`) see [Intl.RelativeTimeFormat Constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat). Alternatively check this repo’s TS types @@ -347,15 +336,16 @@ Outputs the time difference between two given dates. Will output for "en" → **in 1 year** The second date argument is subtracted from the first. If the difference is a positive value, a future event statement -is made. A negative value refers to a past date. Allowed date input formats are similar to *_date*, options equal -**_dateRel**. +is made. A negative value refers to a past date. Allowed date input formats are similar to **_date**, options equal +**_dateRel**. If only one argument is given, the second date to subtract is "now" (`new Date()`). --- ### _num -Outputs a formatted number according to the language specific conventions of number representation, e.g. * -*4,100,000.8314** for "**en**", but **4.100.000,8314** for "**de**". +Outputs a formatted number according to the language specific conventions of number representation, e.g. +**4,100,000.8314** for "**en**", but **4.100.000,8314** for "**de**". + ``` {{_num 4100000.8314 }} @@ -378,8 +368,8 @@ Will output **3.14** for "**en**", but **3,14** for "**de**". ### _price -Outputs a formatted currency string according to the language specific conventions of price representation, e.g. * -*€9,999.99** for "**en**", but **9.999,99 €** for "**de**". +Outputs a formatted currency string according to the language specific conventions of price representation, e.g. +**€9,999.99** for "**en**", but **9.999,99 €** for "**de**". ``` {{_price 9999.99}} diff --git a/test/handlebars-i18n.test.js b/test/handlebars-i18n.test.js index 4223171..85ff469 100644 --- a/test/handlebars-i18n.test.js +++ b/test/handlebars-i18n.test.js @@ -12,7 +12,7 @@ const Handlebars = require('handlebars'); const i18next = require('i18next'); const HandlebarsI18n = require('../dist/handlebars-i18n'); -describe('handlebars-i18n Tests', function() { +describe('handlebars-i18n Tests', function () { const i18nInitObj = { resources: { @@ -99,19 +99,19 @@ describe('handlebars-i18n Tests', function() { Tests against function _locale ****************************************/ - it('expecting function _locale to be [undefined] as long as no language was set with i18next.init', function() { + it('expecting function _locale to be [undefined] as long as no language was set with i18next.init', function () { i18next.init(); // empty init const res = hI18n.helpers._locale(); expect(res).to.be.undefined; }); - it('function _locale should return "en" if language is specified as "en" by init Object', function() { + it('function _locale should return "en" if language is specified as "en" by init Object', function () { i18next.init(i18nInitObj); // initialize with data const res = hI18n.helpers._locale(); assert.equal('en', res); }); - it('function _locale should return "de" after language change to "de"', function() { + it('function _locale should return "de" after language change to "de"', function () { i18next.changeLanguage('de'); const res = hI18n.helpers._locale(); assert.equal('de', res); @@ -122,13 +122,13 @@ describe('handlebars-i18n Tests', function() { Tests against function isLocale ****************************************/ - it('function isLocale should return TRUE when current language is set to "en" and given "en" as parameter', function() { + it('function isLocale should return TRUE when current language is set to "en" and given "en" as parameter', function () { i18next.changeLanguage('en'); const res = hI18n.helpers.localeIs('en'); assert.equal(true, res); }); - it('function isLocale should return FALSE when current language is set to "en" and given "someOther" as parameter', function() { + it('function isLocale should return FALSE when current language is set to "en" and given "someOther" as parameter', function () { i18next.changeLanguage('en'); const res = hI18n.helpers.localeIs('someOther'); assert.equal(false, res); @@ -139,35 +139,37 @@ describe('handlebars-i18n Tests', function() { Tests against function __ ****************************************/ - it('expect __ to throw error when called with no parameter', function() { - expect(function() { hI18n.helpers.__() }).to.throw(); + it('expect __ to throw error when called with no parameter', function () { + expect(function () { + hI18n.helpers.__() + }).to.throw(); }); - it('function __ should return a SafeString object with property "string" where "string" returns the first argument given to __', function() { - const res = hI18n.helpers.__("someNoneExitingKey", { hash: {} }); + it('function __ should return a SafeString object with property "string" where "string" returns the first argument given to __', function () { + const res = hI18n.helpers.__("someNoneExitingKey", {hash: {}}); assert.equal("someNoneExitingKey", res.string); }); - it('function __ should return a SafeString object with property "string" where "string" contains "What is good?!', function() { - const res = hI18n.helpers.__("key1", { hash: {} }); + it('function __ should return a SafeString object with property "string" where "string" contains "What is good?!', function () { + const res = hI18n.helpers.__("key1", {hash: {}}); assert.equal("What is good?", res.string); }); - it('function __ should return a SafeString object with property "string" where "string" contains "Was ist gut?"', function() { + it('function __ should return a SafeString object with property "string" where "string" contains "Was ist gut?"', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers.__("key1", { hash: {} }); + const res = hI18n.helpers.__("key1", {hash: {}}); assert.equal("Was ist gut?", res.string); }); - it('function __ should return a SafeString object with property "string" where "string" contains "handlebarsI18next is good."', function() { + it('function __ should return a SafeString object with property "string" where "string" contains "handlebarsI18next is good."', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers.__("key2", { hash: { what : "handlebarsI18next", adverb : "good" } }); + const res = hI18n.helpers.__("key2", {hash: {what: "handlebarsI18next", adverb: "good"}}); assert.equal("handlebarsI18next is good.", res.string); }); - it('function __ should return a SafeString object with property "string" where "string" contains "handlebarsI18next ist gut."', function() { + it('function __ should return a SafeString object with property "string" where "string" contains "handlebarsI18next ist gut."', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers.__("key2", { hash: { what: "handlebarsI18next", adverb: "gut" } }); + const res = hI18n.helpers.__("key2", {hash: {what: "handlebarsI18next", adverb: "gut"}}); assert.equal("handlebarsI18next ist gut.", res.string); }); @@ -176,11 +178,13 @@ describe('handlebars-i18n Tests', function() { Tests against function _date ****************************************/ - it('expect function _date to throw error when called with invalid date parameter', function() { - expect(function() { hI18n.helpers._date('someStrangeString') }).to.throw("Invalid valid date passed to format"); + it('expect function _date to throw error when called with invalid date parameter', function () { + expect(function () { + hI18n.helpers._date('someStrangeString') + }).to.throw("Invalid valid date passed to format"); }); - it('function _date should return today’s date in Intl default format when called without parameter', function() { + it('function _date should return today’s date in Intl default format when called without parameter', function () { i18next.changeLanguage('en'); const today = new Date(); const todayFormated = new Intl.DateTimeFormat().format(today); @@ -190,7 +194,7 @@ describe('handlebars-i18n Tests', function() { }); it('function _date should return today’s date in Intl default format when called with parameter, "Today" or "Now" no matter of upper or lower case writing', - function() { + function () { i18next.changeLanguage('en'); const today = new Date(); const todayFormated = new Intl.DateTimeFormat().format(today); @@ -201,53 +205,53 @@ describe('handlebars-i18n Tests', function() { assert.equal(todayFormated, hI18n.helpers._date("now")); assert.equal(todayFormated, hI18n.helpers._date("Now")); assert.equal(todayFormated, hI18n.helpers._date("NOW")); - }); + }); - it('function _date should return "1/1/1970" (Intl default format) when called with parameter 1 as number ', function() { + it('function _date should return "1/1/1970" (Intl default format) when called with parameter 1 as number ', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._date(1); assert.equal('1/1/1970', res); }); - it('function _date should return "12/17/1995" (Intl default format) when called with parameter "1995-12-17T03:24:00"', function() { + it('function _date should return "12/17/1995" (Intl default format) when called with parameter "1995-12-17T03:24:00"', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._date('1995-12-17T03:24:00'); assert.equal('12/17/1995', res); }); - it('function _date should return "12/17/1995" (Intl default format) when called with parameter "December 17, 1995 03:24:00"', function() { + it('function _date should return "12/17/1995" (Intl default format) when called with parameter "December 17, 1995 03:24:00"', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._date('December 17, 1995 03:24:00'); assert.equal('12/17/1995', res); }); - it('function _date should return "1/1/2020" (Intl default format) when called with parameter "[2020]"', function() { + it('function _date should return "1/1/2020" (Intl default format) when called with parameter "[2020]"', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._date('[1995]'); assert.equal('1/1/1995', res); }); - it('function _date should return "12/1/1995" (Intl default format) when called with parameter "[2020,11]"', function() { + it('function _date should return "12/1/1995" (Intl default format) when called with parameter "[2020,11]"', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._date('[1995,11]'); assert.equal('12/1/1995', res); }); - it('function _date should return "12/17/1995" (Intl default format) when called with parameter "[2020,11,17]"', function() { + it('function _date should return "12/17/1995" (Intl default format) when called with parameter "[2020,11,17]"', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._date('[1995,11,17]'); assert.equal('12/17/1995', res); }); - it('function _date should return "12/1/95" when called with parameter "[2020,11,01] and specifying options"', function() { + it('function _date should return "12/1/95" when called with parameter "[2020,11,01] and specifying options"', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers._date('[1995,11,1]', { hash: { year:"2-digit", month:"2-digit", day:"2-digit" } }); + const res = hI18n.helpers._date('[1995,11,1]', {hash: {year: "2-digit", month: "2-digit", day: "2-digit"}}); assert.equal('12/1/95', res); }); - it('function _date should return "01.12.95" when called with parameter "[2020,11,01] and specifying options an language set to "de"', function() { + it('function _date should return "01.12.95" when called with parameter "[2020,11,01] and specifying options an language set to "de"', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers._date('[1995,11,1]', { hash: { year:"2-digit", month:"2-digit", day:"2-digit" } }); + const res = hI18n.helpers._date('[1995,11,1]', {hash: {year: "2-digit", month: "2-digit", day: "2-digit"}}); assert.equal('01.12.95', res); }); @@ -256,42 +260,60 @@ describe('handlebars-i18n Tests', function() { Tests against function _dateRel ****************************************/ - it('expect function _dateRel to throw error when called without parameter', function() { - expect(function() { hI18n.helpers._dateRel() }).to.throw('Invalid "number" argument: NaN'); + it('expect function _dateRel to throw error when called without parameter', function () { + expect(function () { + hI18n.helpers._dateRel() + }).to.throw('Invalid "number" argument: NaN'); }); - it('expect function _dateRel to throw error when called with invalid date parameter', function() { - expect(function() { hI18n.helpers._dateRel('someStrangeString') }).to.throw('Invalid "number" argument: NaN'); + it('expect function _dateRel to throw error when called with invalid date parameter', function () { + expect(function () { + hI18n.helpers._dateRel('someStrangeString') + }).to.throw('Invalid "number" argument: NaN'); }); - it('expect function _dateRel to throw error when called with non-existent language shortcode', function() { + it('expect function _dateRel to throw error when called with non-existent language shortcode', function () { i18next.changeLanguage('invalid'); - expect(function() { - hI18n.helpers._dateRel(1, { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit:"day" }}) + expect(function () { + hI18n.helpers._dateRel(1, {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: "day"}}) }).to.throw('No locale data passed'); }); - it('expect function _dateRel to return \'in 1 hour\' when called with \'en\' and first parameter being 1', function() { + it('expect function _dateRel to return \'in 1 hour\' when called with \'en\' and first parameter being 1', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._dateRel(1); assert.equal('in 1 hour', res); }); - it('expect function _dateRel to return \'1 hour ago\' when called with \'en\' and first parameter being -1', function() { + it('expect function _dateRel to return \'1 hour ago\' when called with \'en\' and first parameter being -1', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._dateRel(-1); assert.equal('1 hour ago', res); }); - it('expect function _dateRel to return \'in 1 second\' when called with \'en\' and first parameter being 1 and according options', function() { + it('expect function _dateRel to return \'in 1 second\' when called with \'en\' and first parameter being 1 and according options', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers._dateRel(1, { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit:"seconds" }}); + const res = hI18n.helpers._dateRel(1, { + hash: { + localeMatcher: "best fit", + numeric: "always", + style: "long", + unit: "seconds" + } + }); assert.equal('in 1 second', res); }); - it('expect function _dateRel to return \'in 1 Tag\' when called with \'de\' and paramter 1 and according options', function() { + it('expect function _dateRel to return \'in 1 Tag\' when called with \'de\' and paramter 1 and according options', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers._dateRel(1, { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit:"day" }}); + const res = hI18n.helpers._dateRel(1, { + hash: { + localeMatcher: "best fit", + numeric: "always", + style: "long", + unit: "day" + } + }); assert.equal('in 1 Tag', res); }); @@ -300,35 +322,33 @@ describe('handlebars-i18n Tests', function() { Tests against function _dateDiff ****************************************/ - it('function _dateDiff should return null when called with no parameter', function() { + it('function _dateDiff should return null when called with no parameter', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._dateDiff(); assert.equal(null, res); }); - it('expect function _dateDiff to throw error when called with invalid 1. date parameter', function() { - expect(function() { hI18n.helpers._dateDiff('someStrangeString', '1995-12-17T03:24:00') }) + it('expect function _dateDiff to throw error when called with invalid 1. date parameter', function () { + expect(function () { + hI18n.helpers._dateDiff('someStrangeString', '1995-12-17T03:24:00') + }) .to.throw('Invalid "number" argument: NaN'); }); - it('expect function _dateDiff to throw error when called with invalid 2. date parameter', function() { - expect(function() { hI18n.helpers._dateDiff('1995-12-17T03:24:00', 'someStrangeString') }) + it('expect function _dateDiff to throw error when called with invalid 2. date parameter', function () { + expect(function () { + hI18n.helpers._dateDiff('1995-12-17T03:24:00', 'someStrangeString') + }) .to.throw('Invalid "number" argument: NaN'); }); - /*it('expect function _dateDiff to return the first date as "in 227,543 hours", when no second param given', function() { + it('expect function _dateDiff to return null when called with empty argument', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers._dateDiff('1995-12-17T00:00:00'); - assert.equal('in 227,543 hours', res); - });*/ - - it('expect function _dateDiff to return the second date as "in 227,543 hours", when first param is empty', function() { - i18next.changeLanguage('en'); - const res = hI18n.helpers._dateDiff('', '1995-12-17T00:00:00'); - assert.equal('in 227,543 hours', res); + const res = hI18n.helpers._dateDiff(''); + assert.equal(null, res); }); - it('expect function _dateDiff to return "in 0 hours", when dates are identical', function() { + it('expect function _dateDiff to return "in 0 hours", when dates are identical', function () { i18next.changeLanguage('en'); const res = hI18n.helpers._dateDiff('1995-12-17T00:00:00', '1995-12-17T00:00:00'); assert.equal('in 0 hours', res); @@ -336,124 +356,124 @@ describe('handlebars-i18n Tests', function() { // -- Test year -- // - it('expect function _dateDiff to return "in 1 year"', function() { + it('expect function _dateDiff to return "in 1 year"', function () { i18next.changeLanguage('en'); - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: "year" } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: "year"}}; const res = hI18n.helpers._dateDiff('1996-12-17T00:00:00', '1995-12-17T00:00:00', hash); assert.equal('in 1 year', res); }); - it('expect function _dateDiff to return "1 year ago"', function() { + it('expect function _dateDiff to return "1 year ago"', function () { i18next.changeLanguage('en'); - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: "year" } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: "year"}}; const res = hI18n.helpers._dateDiff('1995-12-17T00:00:00', '1996-12-17T00:00:00', hash); assert.equal('1 year ago', res); }); // -- Test quarter -- // - it('expect function _dateDiff to return "in 1 quarter"', function() { + it('expect function _dateDiff to return "in 1 quarter"', function () { i18next.changeLanguage('en'); const unit = 'quarter'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-17T00:00:00', '1996-09-16T00:00:00', hash); assert.equal(`in 1 ${unit}`, res); }); - it('expect function _dateDiff to return "1 quarter ago"', function() { + it('expect function _dateDiff to return "1 quarter ago"', function () { i18next.changeLanguage('en'); const unit = 'quarter'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-09-16T00:00:00', '1996-12-17T00:00:00', hash); assert.equal(`1 ${unit} ago`, res); }); // -- Test month -- // - it('expect function _dateDiff to return "in 1 month"', function() { + it('expect function _dateDiff to return "in 1 month"', function () { i18next.changeLanguage('en'); const unit = 'month'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-17T00:00:00', '1996-11-16T00:00:00', hash); assert.equal(`in 1 ${unit}`, res); }); - it('expect function _dateDiff to return "1 month ago"', function() { + it('expect function _dateDiff to return "1 month ago"', function () { i18next.changeLanguage('en'); const unit = 'month'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-11-16T00:00:00', '1996-12-17T00:00:00', hash); assert.equal(`1 ${unit} ago`, res); }); // -- Test week -- // - it('expect function _dateDiff to return "in 1 week"', function() { + it('expect function _dateDiff to return "in 1 week"', function () { i18next.changeLanguage('en'); const unit = 'week'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-08T00:00:00', '1996-12-01T00:00:00', hash); assert.equal(`in 1 ${unit}`, res); }); - it('expect function _dateDiff to return "1 week ago"', function() { + it('expect function _dateDiff to return "1 week ago"', function () { i18next.changeLanguage('en'); const unit = 'week'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-01T00:00:00', '1996-12-08T00:00:00', hash); assert.equal(`1 ${unit} ago`, res); }); // -- Test day -- // - it('expect function _dateDiff to return "in 1 day"', function() { + it('expect function _dateDiff to return "in 1 day"', function () { i18next.changeLanguage('en'); const unit = 'day'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-08T00:00:00', '1996-12-07T00:00:00', hash); assert.equal(`in 1 ${unit}`, res); }); - it('expect function _dateDiff to return "1 day ago"', function() { + it('expect function _dateDiff to return "1 day ago"', function () { i18next.changeLanguage('en'); const unit = 'day'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-07T00:00:00', '1996-12-08T00:00:00', hash); assert.equal(`1 ${unit} ago`, res); }); // -- Test minute -- // - it('expect function _dateDiff to return "in 1 minute"', function() { + it('expect function _dateDiff to return "in 1 minute"', function () { i18next.changeLanguage('en'); const unit = 'minute'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-08T00:01:00', '1996-12-08T00:00:00', hash); assert.equal(`in 1 ${unit}`, res); }); - it('expect function _dateDiff to return "1 minute ago"', function() { + it('expect function _dateDiff to return "1 minute ago"', function () { i18next.changeLanguage('en'); const unit = 'minute'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-08T00:00:00', '1996-12-08T00:01:00', hash); assert.equal(`1 ${unit} ago`, res); }); // -- Test second -- // - it('expect function _dateDiff to return "in 1 second"', function() { + it('expect function _dateDiff to return "in 1 second"', function () { i18next.changeLanguage('en'); const unit = 'second'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-08T00:00:01', '1996-12-08T00:00:00', hash); assert.equal(`in 1 ${unit}`, res); }); - it('expect function _dateDiff to return "1 second ago"', function() { + it('expect function _dateDiff to return "1 second ago"', function () { i18next.changeLanguage('en'); const unit = 'second'; - const hash = { hash: { localeMatcher: "best fit", numeric: "always", style: "long", unit: unit } }; + const hash = {hash: {localeMatcher: "best fit", numeric: "always", style: "long", unit: unit}}; const res = hI18n.helpers._dateDiff('1996-12-08T00:00:00', '1996-12-08T00:00:01', hash); assert.equal(`1 ${unit} ago`, res); }); @@ -463,27 +483,27 @@ describe('handlebars-i18n Tests', function() { Tests against function _num ****************************************/ - it('function _num should return comma separated triples of decimals when language is "en"', function() { + it('function _num should return comma separated triples of decimals when language is "en"', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: {} }); + const res = hI18n.helpers._num(4000000, {hash: {}}); assert.equal('4,000,000', res); }); - it('function _num should return dot separated triples of decimals when language is "de"', function() { + it('function _num should return dot separated triples of decimals when language is "de"', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers._num(4000000, { hash: {} }); + const res = hI18n.helpers._num(4000000, {hash: {}}); assert.equal('4.000.000', res); }); - it('function _num should return comma separated triples of decimals and 2 fraction digits"', function() { + it('function _num should return comma separated triples of decimals and 2 fraction digits"', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { minimumFractionDigits : 2 } }); + const res = hI18n.helpers._num(4000000, {hash: {minimumFractionDigits: 2}}); assert.equal('4,000,000.00', res); }); - it('function _num should return dot separated triples of decimals and 2 fraction digits when language is "de"', function() { + it('function _num should return dot separated triples of decimals and 2 fraction digits when language is "de"', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers._num(4000000, { hash: { minimumFractionDigits : 2 } }); + const res = hI18n.helpers._num(4000000, {hash: {minimumFractionDigits: 2}}); assert.equal('4.000.000,00', res); }); @@ -492,28 +512,28 @@ describe('handlebars-i18n Tests', function() { Tests against function _price ****************************************/ - it('function _currency should return price in € written in comma separated triples of decimals and 2 fraction digits with leading currency symbol', function() { + it('function _currency should return price in € written in comma separated triples of decimals and 2 fraction digits with leading currency symbol', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers._price(4000000, { hash: {} }); + const res = hI18n.helpers._price(4000000, {hash: {}}); assert.equal('€4,000,000.00', res); }); - it('function _currency should return price in € written in dot separated triples of decimals and 2 fraction digits with trailing currency symbol', function() { + it('function _currency should return price in € written in dot separated triples of decimals and 2 fraction digits with trailing currency symbol', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers._price(4000000, { hash: {} }); + const res = hI18n.helpers._price(4000000, {hash: {}}); assert.isString(res); assert.equal('4.000.000,00 €', res); }); - it('function _currency should return price in ¥ written in comma separated triples of decimals with leading currency symbol', function() { + it('function _currency should return price in ¥ written in comma separated triples of decimals with leading currency symbol', function () { i18next.changeLanguage('en'); - const res = hI18n.helpers._price(4000000, { hash: { currency: 'JPY', maximumFractionDigits: 0 } }); + const res = hI18n.helpers._price(4000000, {hash: {currency: 'JPY', maximumFractionDigits: 0}}); assert.equal('¥4,000,000', res); }); - it('function _currency should return price in ¥ written in comma separated triples of decimals with trailing currency symbol', function() { + it('function _currency should return price in ¥ written in comma separated triples of decimals with trailing currency symbol', function () { i18next.changeLanguage('de'); - const res = hI18n.helpers._price(4000000, { hash: { currency: 'JPY', maximumFractionDigits: 0 } }); + const res = hI18n.helpers._price(4000000, {hash: {currency: 'JPY', maximumFractionDigits: 0}}); assert.equal('4.000.000 ¥', res); }); @@ -522,53 +542,57 @@ describe('handlebars-i18n Tests', function() { Tests against method configure() ****************************************/ - it('method configure() should return false if called without argument', function() { + it('method configure() should return false if called without argument', function () { const configure = HandlebarsI18n.configure(); assert.isNotOk(configure); }); - it('method configure() should return false if called with empty array []', function() { + it('method configure() should return false if called with empty array []', function () { const configure = HandlebarsI18n.configure([]); assert.isNotOk(configure); }); - it('method configure() should return false if called with only one argument', function() { + it('method configure() should return false if called with only one argument', function () { const configure = HandlebarsI18n.configure('en'); assert.isNotOk(configure); }); - it('method configure() should return false if called with language argument and invalid second argument', function() { + it('method configure() should return false if called with language argument and invalid second argument', function () { const configure = HandlebarsI18n.configure('en', 'somestrangeinput'); assert.isNotOk(configure); }); - it('method configure() should return false if called with language argument "en" and second argument "DateTimeFormat" and Number (invalid argument) as third', function() { + it('method configure() should return false if called with language argument "en" and second argument "DateTimeFormat" and Number (invalid argument) as third', function () { const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', 12); assert.isNotOk(configure); }); - it('method configure() should return true if called with language argument "en" and second argument "DateTimeFormat" and options object as third argument', function() { - const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', { year:'numeric' } ); + it('method configure() should return true if called with language argument "en" and second argument "DateTimeFormat" and options object as third argument', function () { + const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', {year: 'numeric'}); assert.isOk(configure); }); - it('method configure() should return true if called with arguments "en", "DateTimeFormat", { year:"numeric" } and a string as custom configuration name', function() { - const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', { year:'numeric' }, "my-custom-conf" ); + it('method configure() should return true if called with arguments "en", "DateTimeFormat", { year:"numeric" } and a string as custom configuration name', function () { + const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', {year: 'numeric'}, "my-custom-conf"); assert.isOk(configure); }); - it('method configure() should return false if called with arguments "en", "DateTimeFormat", { year:"numeric" } and an additional object (invalid argument)', function() { - const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', { year:'numeric' }, {} ); + it('method configure() should return false if called with arguments "en", "DateTimeFormat", { year:"numeric" } and an additional object (invalid argument)', function () { + const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', {year: 'numeric'}, {}); assert.isNotOk(configure); }); - it('method configure() should return false if called with arguments "en", "DateTimeFormat", { year:"numeric" } and an additional empty string (invalid argument)', function() { - const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', { year:'numeric' }, "" ); + it('method configure() should return false if called with arguments "en", "DateTimeFormat", { year:"numeric" } and an additional empty string (invalid argument)', function () { + const configure = HandlebarsI18n.configure('en', 'DateTimeFormat', {year: 'numeric'}, ""); assert.isNotOk(configure); }); - it('method configure() should return true if called with arguments "en", "RelativeTimeFormat", { localeMatcher: "best fit", numeric: "always", style: "long" }', function() { - const configure = HandlebarsI18n.configure('en', 'RelativeTimeFormat', { localeMatcher: "best fit", numeric: "always", style: "long" } ); + it('method configure() should return true if called with arguments "en", "RelativeTimeFormat", { localeMatcher: "best fit", numeric: "always", style: "long" }', function () { + const configure = HandlebarsI18n.configure('en', 'RelativeTimeFormat', { + localeMatcher: "best fit", + numeric: "always", + style: "long" + }); assert.isOk(configure); }); @@ -577,13 +601,13 @@ describe('handlebars-i18n Tests', function() { Tests against method reset() ****************************************/ - it('method reset() should return TRUE if called', function() { + it('method reset() should return TRUE if called', function () { const res = HandlebarsI18n.reset(); assert.isOk(res); }); - it('function _num should return Intl standard format (no fraction digits) after reset() being called', function() { - HandlebarsI18n.configure('en', 'NumberFormat', { minimumFractionDigits:4 } ); + it('function _num should return Intl standard format (no fraction digits) after reset() being called', function () { + HandlebarsI18n.configure('en', 'NumberFormat', {minimumFractionDigits: 4}); i18next.changeLanguage('en'); HandlebarsI18n.reset(); const res = hI18n.helpers._num(4000000); @@ -596,73 +620,73 @@ describe('handlebars-i18n Tests', function() { ********************************************************************/ it('function _date when called after configure() with defined custom format (year:2-digit) should return ' + - 'date "95" when language is "en"', function() { - HandlebarsI18n.configure('en', 'DateTimeFormat', { year:"2-digit" }, 'my-custom-format'); + 'date "95" when language is "en"', function () { + HandlebarsI18n.configure('en', 'DateTimeFormat', {year: "2-digit"}, 'my-custom-format'); i18next.changeLanguage('en'); - const res = hI18n.helpers._date('December 17, 1995 03:24:00', { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._date('December 17, 1995 03:24:00', {hash: {format: 'my-custom-format'}}); assert.equal('95', res); }); it('function _date when called after configure() with defined custom format (year:numeric) given as ARRAY should return ' + - 'date "12/17/95" when language is "en"', function() { - HandlebarsI18n.configure(['en', 'DateTimeFormat', { year:"numeric" }, 'my-custom-format']); + 'date "12/17/95" when language is "en"', function () { + HandlebarsI18n.configure(['en', 'DateTimeFormat', {year: "numeric"}, 'my-custom-format']); i18next.changeLanguage('en'); - const res = hI18n.helpers._date('December 17, 1995 03:24:00', { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._date('December 17, 1995 03:24:00', {hash: {format: 'my-custom-format'}}); assert.equal('95', res); }); it('function _date when called after configure() with defined custom format (year:2-digit) should override ' + - 'standard configuration when language is "en"', function() { + 'standard configuration when language is "en"', function () { HandlebarsI18n.configure([ - ['en', 'DateTimeFormat', { year:"numeric" }], - ['en', 'DateTimeFormat', { year:"2-digit" }, 'my-custom-format'] + ['en', 'DateTimeFormat', {year: "numeric"}], + ['en', 'DateTimeFormat', {year: "2-digit"}, 'my-custom-format'] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._date('[1995,11,17]', { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._date('[1995,11,17]', {hash: {format: 'my-custom-format'}}); assert.equal('95', res); }); it('function _date when called after configure() with defined custom format (year:2-digit) should override ' + - 'standard configuration also when being defined first', function() { + 'standard configuration also when being defined first', function () { HandlebarsI18n.configure([ - ['en', 'DateTimeFormat', { year:"2-digit" }, 'my-custom-format'], - ['en', 'DateTimeFormat', { year:"numeric" }] + ['en', 'DateTimeFormat', {year: "2-digit"}, 'my-custom-format'], + ['en', 'DateTimeFormat', {year: "numeric"}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._date('December 17, 1995 03:24:00', { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._date('December 17, 1995 03:24:00', {hash: {format: 'my-custom-format'}}); assert.equal('95', res); }); it('function _date when called after configure() should fall back to generic language format "en" when custom format is unknown' + - 'standard configuration also when being defined first', function() { + 'standard configuration also when being defined first', function () { HandlebarsI18n.configure([ - ['en', 'DateTimeFormat', { year:"2-digit" }, 'my-custom-format'], - ['en', 'DateTimeFormat', { year:"numeric" }] + ['en', 'DateTimeFormat', {year: "2-digit"}, 'my-custom-format'], + ['en', 'DateTimeFormat', {year: "numeric"}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._date('December 17, 1995 03:24:00', { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._date('December 17, 1995 03:24:00', {hash: {format: 'my-unknown-format'}}); assert.equal('1995', res); }); it('function _date when called after configure() should fall back to generic language format "all" when custom format is unknown' + - 'standard configuration also when being defined first', function() { + 'standard configuration also when being defined first', function () { HandlebarsI18n.configure([ - ['all', 'DateTimeFormat', { year:"2-digit" }, 'my-custom-format'], - ['en', 'DateTimeFormat', { year:"numeric" }] + ['all', 'DateTimeFormat', {year: "2-digit"}, 'my-custom-format'], + ['en', 'DateTimeFormat', {year: "numeric"}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._date('December 17, 1995 03:24:00', { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._date('December 17, 1995 03:24:00', {hash: {format: 'my-unknown-format'}}); assert.equal('1995', res); }); it('function _date when called after configure() should fall back to Intl default format when custom format is unknown' + - 'standard configuration also when being defined first', function() { + 'standard configuration also when being defined first', function () { HandlebarsI18n.reset(); HandlebarsI18n.configure([ - ['en', 'DateTimeFormat', { year:"2-digit" }, 'my-custom-format'] + ['en', 'DateTimeFormat', {year: "2-digit"}, 'my-custom-format'] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._date('December 17, 1995 03:24:00', { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._date('December 17, 1995 03:24:00', {hash: {format: 'my-unknown-format'}}); assert.equal('12/17/1995', res); }); @@ -672,51 +696,51 @@ describe('handlebars-i18n Tests', function() { ********************************************************************/ it('function _dateRel called after configure() with defined "all" (style: "long", unit: "second") should return ' + - '"in 12 seconds" when language is "en"', function() { - HandlebarsI18n.configure('all', 'RelativeTimeFormat', { style: "long", unit: "second" }); + '"in 12 seconds" when language is "en"', function () { + HandlebarsI18n.configure('all', 'RelativeTimeFormat', {style: "long", unit: "second"}); i18next.changeLanguage('en'); const res = hI18n.helpers._dateRel('12'); assert.equal('in 12 seconds', res); }); it('function _dateRel called after configure() with defined custom format (style: "long", unit: "year") should return ' + - '"in 12 Jahren" when language is "de"', function() { - HandlebarsI18n.configure('de', 'RelativeTimeFormat', { style: "long", unit: "year" }, 'date-rel-custom'); + '"in 12 Jahren" when language is "de"', function () { + HandlebarsI18n.configure('de', 'RelativeTimeFormat', {style: "long", unit: "year"}, 'date-rel-custom'); i18next.changeLanguage('de'); - const res = hI18n.helpers._dateRel('12', { hash: { format: 'date-rel-custom'} }); + const res = hI18n.helpers._dateRel('12', {hash: {format: 'date-rel-custom'}}); assert.equal('in 12 Jahren', res); }); it('function _dateRel called after configure() with defined custom format { style: "short", unit: "minutes" } should override ' + - 'standard configuration when language is "en"', function() { + 'standard configuration when language is "en"', function () { HandlebarsI18n.configure([ - ['en', 'RelativeTimeFormat', { style: "short", unit: "day" }, 'date-rel-spec'], - ['en', 'RelativeTimeFormat', { style: "long", unit: "second" }] + ['en', 'RelativeTimeFormat', {style: "short", unit: "day"}, 'date-rel-spec'], + ['en', 'RelativeTimeFormat', {style: "long", unit: "second"}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._dateRel('12', { hash: { format: 'date-rel-spec'} }); + const res = hI18n.helpers._dateRel('12', {hash: {format: 'date-rel-spec'}}); assert.equal('in 12 days', res); }); it('function _dateRel called after configure() with defined custom format { style: "short", unit: "minutes" } should override ' + - 'standard configuration when language is "en" and output: \'in 12 days\'', function() { + 'standard configuration when language is "en" and output: \'in 12 days\'', function () { HandlebarsI18n.configure([ - ['en', 'RelativeTimeFormat', { style: "short", unit: "day" }, 'date-rel-spec'], - ['en', 'RelativeTimeFormat', { style: "long", unit: "second" }] + ['en', 'RelativeTimeFormat', {style: "short", unit: "day"}, 'date-rel-spec'], + ['en', 'RelativeTimeFormat', {style: "long", unit: "second"}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._dateRel('12', { hash: { format: 'date-rel-spec'} }); + const res = hI18n.helpers._dateRel('12', {hash: {format: 'date-rel-spec'}}); assert.equal('in 12 days', res); }); it('function _dateDiff called after configure() with defined custom format { style: "short", unit: "minutes" } should override ' + - 'standard configuration when language is "en" and output: \'in in 1 yr.\'', function() { + 'standard configuration when language is "en" and output: \'in in 1 yr.\'', function () { HandlebarsI18n.configure([ - ['en', 'RelativeTimeFormat', { style: "short", unit: "year" }, 'date-rel-spec'], - ['en', 'RelativeTimeFormat', { style: "long", unit: "day" }] + ['en', 'RelativeTimeFormat', {style: "short", unit: "year"}, 'date-rel-spec'], + ['en', 'RelativeTimeFormat', {style: "long", unit: "day"}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._dateDiff('1996-12-17T00:00:00', '1995-12-17T00:00:00',{ hash: { format: 'date-rel-spec'} }); + const res = hI18n.helpers._dateDiff('1996-12-17T00:00:00', '1995-12-17T00:00:00', {hash: {format: 'date-rel-spec'}}); assert.equal('in 1 yr.', res); }); @@ -726,70 +750,70 @@ describe('handlebars-i18n Tests', function() { ********************************************************************/ it('function _num when called after configure() with defined custom format (minimumFractionDigits:4) should return ' + - 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function() { - HandlebarsI18n.configure('en', 'NumberFormat', { minimumFractionDigits:4 }, 'my-custom-format'); + 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function () { + HandlebarsI18n.configure('en', 'NumberFormat', {minimumFractionDigits: 4}, 'my-custom-format'); i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._num(4000000, {hash: {format: 'my-custom-format'}}); assert.equal('4,000,000.0000', res); }); it('function _num when called after configure() with defined custom format (minimumFractionDigits:4) given as ARRAY should return ' + - 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function() { - HandlebarsI18n.configure(['en', 'NumberFormat', { minimumFractionDigits:4 }, 'my-custom-format']); + 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function () { + HandlebarsI18n.configure(['en', 'NumberFormat', {minimumFractionDigits: 4}, 'my-custom-format']); i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._num(4000000, {hash: {format: 'my-custom-format'}}); assert.equal('4,000,000.0000', res); }); it('function _num when called after configure() with defined custom format (minimumFractionDigits:4) should override' + - 'standard configuration when language is "en"', function() { + 'standard configuration when language is "en"', function () { HandlebarsI18n.configure([ - ['en', 'NumberFormat', { maximumFractionDigits:1 }], - ['en', 'NumberFormat', { minimumFractionDigits:4 }, 'my-custom-format'] + ['en', 'NumberFormat', {maximumFractionDigits: 1}], + ['en', 'NumberFormat', {minimumFractionDigits: 4}, 'my-custom-format'] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._num(4000000, {hash: {format: 'my-custom-format'}}); assert.equal('4,000,000.0000', res); }); it('function _num when called after configure() with defined custom format (minimumFractionDigits:4) should override' + - 'standard configuration also when being defined first', function() { + 'standard configuration also when being defined first', function () { HandlebarsI18n.configure([ - ['en', 'NumberFormat', { minimumFractionDigits:4 }, 'my-custom-format'], - ['en', 'NumberFormat', { maximumFractionDigits:1 }] + ['en', 'NumberFormat', {minimumFractionDigits: 4}, 'my-custom-format'], + ['en', 'NumberFormat', {maximumFractionDigits: 1}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._num(4000000, {hash: {format: 'my-custom-format'}}); assert.equal('4,000,000.0000', res); }); - it('function _num when called after configure() should fall back to standard language format "en" when custom format is unknown', function() { + it('function _num when called after configure() should fall back to standard language format "en" when custom format is unknown', function () { HandlebarsI18n.configure([ - ['en', 'NumberFormat', { minimumFractionDigits:4 }, 'my-custom-format'], - ['en', 'NumberFormat', { minimumFractionDigits:1 }] + ['en', 'NumberFormat', {minimumFractionDigits: 4}, 'my-custom-format'], + ['en', 'NumberFormat', {minimumFractionDigits: 1}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._num(4000000, {hash: {format: 'my-unknown-format'}}); assert.equal('4,000,000.0', res); }); - it('function _num when called after configure() should fall back to standard language format "all" when custom format is unknown', function() { + it('function _num when called after configure() should fall back to standard language format "all" when custom format is unknown', function () { HandlebarsI18n.configure([ - ['en', 'NumberFormat', { minimumFractionDigits:4 }, 'my-custom-format'], - ['all', 'NumberFormat', { minimumFractionDigits:1 }] + ['en', 'NumberFormat', {minimumFractionDigits: 4}, 'my-custom-format'], + ['all', 'NumberFormat', {minimumFractionDigits: 1}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._num(4000000, {hash: {format: 'my-unknown-format'}}); assert.equal('4,000,000.0', res); }); - it('function _num when called after configure() should fall back to Intl default when custom format is unknown', function() { + it('function _num when called after configure() should fall back to Intl default when custom format is unknown', function () { HandlebarsI18n.reset(); HandlebarsI18n.configure([ - ['en', 'NumberFormat', { minimumFractionDigits:4 }, 'my-custom-format'] + ['en', 'NumberFormat', {minimumFractionDigits: 4}, 'my-custom-format'] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._num(4000000, { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._num(4000000, {hash: {format: 'my-unknown-format'}}); assert.equal('4,000,000', res); }); @@ -799,77 +823,77 @@ describe('handlebars-i18n Tests', function() { ********************************************************************/ it('function _price when called after configure() with defined custom format (minimumFractionDigits:4) should return ' + - 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function() { - HandlebarsI18n.configure('en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format'); + 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function () { + HandlebarsI18n.configure('en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format'); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-custom-format'}}); assert.equal('€2.000', res); }); it('function _price when called after configure() with defined custom format (minimumFractionDigits:4) should return ' + - 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function() { - HandlebarsI18n.configure('en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format'); + 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function () { + HandlebarsI18n.configure('en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format'); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-custom-format'}}); assert.equal('€2.000', res); }); it('function _price when called after configure() with defined custom format (minimumFractionDigits:4) given as ARRAY should return ' + - 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function() { - HandlebarsI18n.configure(['en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format']); + 'comma separated triples of decimals and 4 fraction of digits when language is "en"', function () { + HandlebarsI18n.configure(['en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format']); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-custom-format'}}); assert.equal('€2.000', res); }); it('function _price when called after configure() with defined custom format (minimumFractionDigits:3) should override' + - 'standard configuration when language is "en"', function() { + 'standard configuration when language is "en"', function () { HandlebarsI18n.configure([ - ['en', 'PriceFormat', { currency:'USD'}], - ['en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format'] + ['en', 'PriceFormat', {currency: 'USD'}], + ['en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format'] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-custom-format'}}); assert.equal('€2.000', res); }); it('function _price when called after configure() with defined custom format (minimumFractionDigits:3) should override' + - 'standard configuration also when being defined first', function() { + 'standard configuration also when being defined first', function () { HandlebarsI18n.configure([ - ['en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format'], - ['en', 'PriceFormat', { currency:'USD'}] + ['en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format'], + ['en', 'PriceFormat', {currency: 'USD'}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-custom-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-custom-format'}}); assert.equal('€2.000', res); }); - it('function _price when called after configure() should fall back to standard language format "en" when custom format is unknown', function() { + it('function _price when called after configure() should fall back to standard language format "en" when custom format is unknown', function () { HandlebarsI18n.configure([ - ['en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format'], - ['en', 'PriceFormat', { currency:'USD'}] + ['en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format'], + ['en', 'PriceFormat', {currency: 'USD'}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-unknown-format'}}); assert.equal('$2.00', res); }); - it('function _price when called after configure() should fall back to standard language format "all" when custom format is unknown', function() { + it('function _price when called after configure() should fall back to standard language format "all" when custom format is unknown', function () { HandlebarsI18n.configure([ - ['en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format'], - ['all', 'PriceFormat', { currency:'USD'}] + ['en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format'], + ['all', 'PriceFormat', {currency: 'USD'}] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-unknown-format'}}); assert.equal('$2.00', res); }); - it('function _price when called after configure() should fall back to Intl default when custom format is unknown', function() { + it('function _price when called after configure() should fall back to Intl default when custom format is unknown', function () { HandlebarsI18n.configure([ - ['en', 'PriceFormat', { currency:'EUR', minimumFractionDigits:3 }, 'my-custom-format'] + ['en', 'PriceFormat', {currency: 'EUR', minimumFractionDigits: 3}, 'my-custom-format'] ]); i18next.changeLanguage('en'); - const res = hI18n.helpers._price(2, { hash: { format: 'my-unknown-format'} }); + const res = hI18n.helpers._price(2, {hash: {format: 'my-unknown-format'}}); assert.equal('$2.00', res); }); @@ -895,12 +919,12 @@ describe('handlebars-i18n Private helper Function Tests (in production not expor expect(instance.b).to.equal(2); }); - /* it('should handle no arguments', () => { - const instance = HandlebarsI18n.private.applyToConstructor(TestConstructor, []); - expect(instance).to.be.an.instanceof(TestConstructor); - expect(instance.a).to.equal(null); - expect(instance.b).to.equal(undefined); // because 'undefined' is passed as second argument - });*/ + /* it('should handle no arguments', () => { + const instance = HandlebarsI18n.private.applyToConstructor(TestConstructor, []); + expect(instance).to.be.an.instanceof(TestConstructor); + expect(instance.a).to.equal(null); + expect(instance.b).to.equal(undefined); // because 'undefined' is passed as second argument + });*/ it('should handle constructor with no arguments', () => { function ConstructorWithNoArgs() { @@ -920,6 +944,7 @@ describe('handlebars-i18n Private helper Function Tests (in production not expor } const args = [new ComplexArgument(5)]; + function ConstructorWithComplexArg(arg) { this.arg = arg; } @@ -944,12 +969,12 @@ describe('handlebars-i18n Private helper Function Tests (in production not expor const lang = 'en'; const OCFormat = { standard: { - en: { /* Standard configuration for English */ }, - all: { /* Universal configuration for all languages */ } + en: { /* Standard configuration for English */}, + all: { /* Universal configuration for all languages */} }, custom: { customFormat: { - en: { /* Custom configuration for English */ } + en: { /* Custom configuration for English */} } } }; @@ -985,5 +1010,4 @@ describe('handlebars-i18n Private helper Function Tests (in production not expor expect(result).to.deep.equal({}); }); - }); \ No newline at end of file