diff options
author | Rebecca Turner <me@re-becca.org> | 2016-06-24 01:12:07 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2016-06-24 03:32:42 +0300 |
commit | 6c3f7f043f09fc2aa19ffd3f956787635fa6f4d0 (patch) | |
tree | 852582e16d86ee078b48dbf7ab32636f1be7a633 /node_modules/has-unicode | |
parent | e44d2db1ad0d860ca08e99c81135bd399fb733b1 (diff) |
has-unicode@2.0.1
Fix unicode dection on a number of Linux distributions.
Credit: @Darkhogg
Credit: @gagern
Reviewed-By: @iarna
PR-URL: https://github.com/iarna/has-unicode/pull/3
PR-URL: https://github.com/iarna/has-unicode/pull/4
Diffstat (limited to 'node_modules/has-unicode')
-rw-r--r-- | node_modules/has-unicode/.npmignore | 32 | ||||
-rw-r--r-- | node_modules/has-unicode/index.js | 11 | ||||
-rw-r--r-- | node_modules/has-unicode/package.json | 67 | ||||
-rw-r--r-- | node_modules/has-unicode/test/index.js | 26 |
4 files changed, 46 insertions, 90 deletions
diff --git a/node_modules/has-unicode/.npmignore b/node_modules/has-unicode/.npmignore deleted file mode 100644 index 7e17cf19b..000000000 --- a/node_modules/has-unicode/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# Commenting this out is preferred by some people, see -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- -node_modules - -# Users Environment Variables -.lock-wscript - -# Editor temp files -*~ -.#* diff --git a/node_modules/has-unicode/index.js b/node_modules/has-unicode/index.js index 9bf537b1c..9b0fe4454 100644 --- a/node_modules/has-unicode/index.js +++ b/node_modules/has-unicode/index.js @@ -10,12 +10,7 @@ var hasUnicode = module.exports = function () { // appropriate. if (os.type() == "Windows_NT") { return false } - var isUTF8 = /[.]UTF-8/ - if (isUTF8.test(process.env.LC_ALL) - || process.env.LC_CTYPE == 'UTF-8' - || isUTF8.test(process.env.LANG)) { - return true - } - - return false + var isUTF8 = /UTF-?8$/i + var ctype = process.env.LC_ALL || process.env.LC_CTYPE || process.env.LANG + return isUTF8.test(ctype) } diff --git a/node_modules/has-unicode/package.json b/node_modules/has-unicode/package.json index 924e3b7a0..4bfc95ee4 100644 --- a/node_modules/has-unicode/package.json +++ b/node_modules/has-unicode/package.json @@ -1,41 +1,57 @@ { "_args": [ [ - "has-unicode@2.0.0", + { + "raw": "has-unicode@~2.0.0", + "scope": null, + "escapedName": "has-unicode", + "name": "has-unicode", + "rawSpec": "~2.0.0", + "spec": ">=2.0.0 <2.1.0", + "type": "range" + }, "/Users/rebecca/code/npm" ] ], - "_from": "has-unicode@2.0.0", - "_id": "has-unicode@2.0.0", + "_from": "has-unicode@>=2.0.0 <2.1.0", + "_id": "has-unicode@2.0.1", "_inCache": true, "_installable": true, "_location": "/has-unicode", - "_nodeVersion": "4.2.2", + "_nodeVersion": "4.4.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/has-unicode-2.0.1.tgz_1466719828333_0.48896647873334587" + }, "_npmUser": { - "email": "me@re-becca.org", - "name": "iarna" + "name": "iarna", + "email": "me@re-becca.org" }, - "_npmVersion": "2.14.7", + "_npmVersion": "3.10.2", "_phantomChildren": {}, "_requested": { - "name": "has-unicode", - "raw": "has-unicode@2.0.0", - "rawSpec": "2.0.0", + "raw": "has-unicode@~2.0.0", "scope": null, - "spec": "2.0.0", - "type": "version" + "escapedName": "has-unicode", + "name": "has-unicode", + "rawSpec": "~2.0.0", + "spec": ">=2.0.0 <2.1.0", + "type": "range" }, "_requiredBy": [ - "/" + "#USER", + "/", + "/node-gyp/npmlog/gauge", + "/npmlog/gauge" ], - "_resolved": "file:../has-unicode", - "_shasum": "a3cd96c307ba41d559c5a2ee408c12a11c4c2ec3", + "_resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "_shasum": "e0e6fe6a28cf51138855e086d1691e771de2a8b9", "_shrinkwrap": null, - "_spec": "has-unicode@2.0.0", + "_spec": "has-unicode@~2.0.0", "_where": "/Users/rebecca/code/npm", "author": { - "email": "me@re-becca.org", - "name": "Rebecca Turner" + "name": "Rebecca Turner", + "email": "me@re-becca.org" }, "bugs": { "url": "https://github.com/iarna/has-unicode/issues" @@ -48,14 +64,17 @@ }, "directories": {}, "dist": { - "shasum": "a3cd96c307ba41d559c5a2ee408c12a11c4c2ec3", - "tarball": "http://registry.npmjs.org/has-unicode/-/has-unicode-2.0.0.tgz" + "shasum": "e0e6fe6a28cf51138855e086d1691e771de2a8b9", + "tarball": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz" }, - "gitHead": "fdd5de141a5564bdb5bc991d951209da40f6a598", + "files": [ + "index.js" + ], + "gitHead": "0a05df154e8d89a7fb9798da60b68c78c2df6646", "homepage": "https://github.com/iarna/has-unicode", "keywords": [ - "terminal", - "unicode" + "unicode", + "terminal" ], "license": "ISC", "main": "index.js", @@ -75,5 +94,5 @@ "scripts": { "test": "tap test/*.js" }, - "version": "2.0.0" + "version": "2.0.1" } diff --git a/node_modules/has-unicode/test/index.js b/node_modules/has-unicode/test/index.js deleted file mode 100644 index cbdfda335..000000000 --- a/node_modules/has-unicode/test/index.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict" -var test = require("tap").test -var requireInject = require("require-inject") - -test("Windows", function (t) { - t.plan(1) - var hasUnicode = requireInject("../index.js", { - os: { type: function () { return "Windows_NT" } } - }) - t.is(hasUnicode(), false, "Windows is assumed NOT to be unicode aware") -}) -test("Unix Env", function (t) { - t.plan(3) - var hasUnicode = requireInject("../index.js", { - os: { type: function () { return "Linux" } }, - child_process: { exec: function (cmd,cb) { cb(new Error("not available")) } } - }) - process.env.LANG = "en_US.UTF-8" - process.env.LC_ALL = null - t.is(hasUnicode(), true, "Linux with a UTF8 language") - process.env.LANG = null - process.env.LC_ALL = "en_US.UTF-8" - t.is(hasUnicode(), true, "Linux with UTF8 locale") - process.env.LC_ALL = null - t.is(hasUnicode(), false, "Linux without UTF8 language or locale") -}) |