diff options
Diffstat (limited to 'deps/npm/node_modules/libnpx/node_modules/y18n')
4 files changed, 78 insertions, 25 deletions
diff --git a/deps/npm/node_modules/libnpx/node_modules/y18n/CHANGELOG.md b/deps/npm/node_modules/libnpx/node_modules/y18n/CHANGELOG.md new file mode 100644 index 0000000000..c259076ad6 --- /dev/null +++ b/deps/npm/node_modules/libnpx/node_modules/y18n/CHANGELOG.md @@ -0,0 +1,21 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +<a name="4.0.0"></a> +# [4.0.0](https://github.com/yargs/y18n/compare/v3.2.1...v4.0.0) (2017-10-10) + + +### Bug Fixes + +* allow support for falsy values like 0 in tagged literal ([#45](https://github.com/yargs/y18n/issues/45)) ([c926123](https://github.com/yargs/y18n/commit/c926123)) + + +### Features + +* **__:** added tagged template literal support ([#44](https://github.com/yargs/y18n/issues/44)) ([0598daf](https://github.com/yargs/y18n/commit/0598daf)) + + +### BREAKING CHANGES + +* **__:** dropping Node 0.10/Node 0.12 support diff --git a/deps/npm/node_modules/libnpx/node_modules/y18n/README.md b/deps/npm/node_modules/libnpx/node_modules/y18n/README.md index 9859458f20..826474f209 100644 --- a/deps/npm/node_modules/libnpx/node_modules/y18n/README.md +++ b/deps/npm/node_modules/libnpx/node_modules/y18n/README.md @@ -4,6 +4,7 @@ [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url] [![js-standard-style][standard-image]][standard-url] +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) The bare-bones internationalization library used by yargs. @@ -23,6 +24,19 @@ output: `my awesome string foo` +_using tagged template literals_ + +```js +var __ = require('y18n').__ +var str = 'foo' + +console.log(__`my awesome string ${str}`) +``` + +output: + +`my awesome string foo` + _pluralization support:_ ```js @@ -60,6 +74,10 @@ Create an instance of y18n with the config provided, options include: Print a localized string, `%s` will be replaced with `arg`s. +This function can also be used as a tag for a template literal. You can use it +like this: <code>__`hello ${'world'}`</code>. This will be equivalent to +`__('hello %s', 'world')`. + ### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg) Print a localized string with appropriate pluralization. If `%d` is provided diff --git a/deps/npm/node_modules/libnpx/node_modules/y18n/index.js b/deps/npm/node_modules/libnpx/node_modules/y18n/index.js index 91b159e342..d720681628 100644 --- a/deps/npm/node_modules/libnpx/node_modules/y18n/index.js +++ b/deps/npm/node_modules/libnpx/node_modules/y18n/index.js @@ -16,6 +16,9 @@ function Y18N (opts) { } Y18N.prototype.__ = function () { + if (typeof arguments[0] !== 'string') { + return this._taggedLiteral.apply(this, arguments) + } var args = Array.prototype.slice.call(arguments) var str = args.shift() var cb = function () {} // start with noop. @@ -40,6 +43,19 @@ Y18N.prototype.__ = function () { return util.format.apply(util, [this.cache[this.locale][str] || str].concat(args)) } +Y18N.prototype._taggedLiteral = function (parts) { + var args = arguments + var str = '' + parts.forEach(function (part, i) { + var arg = args[i + 1] + str += part + if (typeof arg !== 'undefined') { + str += '%s' + } + }) + return this.__.apply(null, [str].concat([].slice.call(arguments, 1))) +} + Y18N.prototype._enqueueWrite = function (work) { this.writeQueue.push(work) if (this.writeQueue.length === 1) this._processWriteQueue() diff --git a/deps/npm/node_modules/libnpx/node_modules/y18n/package.json b/deps/npm/node_modules/libnpx/node_modules/y18n/package.json index 78945dc782..e60020d7f5 100644 --- a/deps/npm/node_modules/libnpx/node_modules/y18n/package.json +++ b/deps/npm/node_modules/libnpx/node_modules/y18n/package.json @@ -1,33 +1,27 @@ { - "_args": [ - [ - "y18n@3.2.1", - "/Users/zkat/Documents/code/npx" - ] - ], - "_from": "y18n@3.2.1", - "_id": "y18n@3.2.1", - "_inBundle": true, - "_integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "_from": "y18n@^4.0.0", + "_id": "y18n@4.0.0", + "_inBundle": false, + "_integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "_location": "/libnpx/y18n", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "y18n@3.2.1", + "raw": "y18n@^4.0.0", "name": "y18n", "escapedName": "y18n", - "rawSpec": "3.2.1", + "rawSpec": "^4.0.0", "saveSpec": null, - "fetchSpec": "3.2.1" + "fetchSpec": "^4.0.0" }, "_requiredBy": [ - "/libnpx", - "/libnpx/yargs" + "/libnpx" ], - "_resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "_spec": "3.2.1", - "_where": "/Users/zkat/Documents/code/npx", + "_resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "_shasum": "95ef94f85ecc81d007c264e190a120f0a3c8566b", + "_spec": "y18n@^4.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/libnpx", "author": { "name": "Ben Coe", "email": "ben@npmjs.com" @@ -35,14 +29,17 @@ "bugs": { "url": "https://github.com/yargs/y18n/issues" }, + "bundleDependencies": false, + "deprecated": false, "description": "the bare-bones internationalization library used by yargs", "devDependencies": { - "chai": "^3.4.1", - "coveralls": "^2.11.6", - "mocha": "^2.3.4", - "nyc": "^6.1.1", + "chai": "^4.0.1", + "coveralls": "^3.0.0", + "mocha": "^4.0.1", + "nyc": "^11.0.1", "rimraf": "^2.5.0", - "standard": "^5.4.1" + "standard": "^10.0.0-beta.0", + "standard-version": "^4.2.0" }, "files": [ "index.js" @@ -63,7 +60,8 @@ "scripts": { "coverage": "nyc report --reporter=text-lcov | coveralls", "pretest": "standard", + "release": "standard-version", "test": "nyc mocha" }, - "version": "3.2.1" + "version": "4.0.0" } |