Comparing version 1.3.1 to 1.4.0
14
index.js
@@ -13,5 +13,5 @@ 'use strict'; | ||
function getEnvLocale() { | ||
var env = process.env; | ||
var ret = env.LC_ALL || env.LANGUAGE || env.LANG || env.LC_MESSAGES; | ||
function getEnvLocale(env) { | ||
env = env || process.env; | ||
var ret = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE; | ||
cache = getLocale(ret); | ||
@@ -22,4 +22,8 @@ return ret; | ||
function parseLocale(x) { | ||
var res = /(?:LC_ALL|LANG|LC_MESSAGES|LC_CTYPE|)="([^"]{2,})"/.exec(x); | ||
return res && res[1]; | ||
var env = x.split('\n').reduce(function (env, def) { | ||
def = def.split('='); | ||
env[def[0]] = def[1]; | ||
return env; | ||
}, {}); | ||
return getEnvLocale(env); | ||
} | ||
@@ -26,0 +30,0 @@ |
{ | ||
"name": "os-locale", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "Get the system locale", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,3 +7,5 @@ # os-locale [![Build Status](https://travis-ci.org/sindresorhus/os-locale.svg?branch=master)](https://travis-ci.org/sindresorhus/os-locale) | ||
POSIX systems: The returned locale refers to the [`LC_MESSAGE`](http://www.gnu.org/software/libc/manual/html_node/Locale-Categories.html#Locale-Categories) category, suitable for selecting the language used in the user interface for message translation. | ||
## Install | ||
@@ -10,0 +12,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5474
105
48
1