This commit is contained in:
tatianamac
2019-11-26 14:50:43 -08:00
parent 8a55660ed0
commit 6d5445ecc5
13894 changed files with 2233957 additions and 0 deletions

127
node_modules/os-locale/index.js generated vendored Normal file
View File

@ -0,0 +1,127 @@
'use strict';
var childProcess = require('child_process');
var execFileSync = childProcess.execFileSync;
var lcid = require('lcid');
var defaultOpts = {spawn: true};
var cache;
function fallback() {
cache = 'en_US';
return cache;
}
function getEnvLocale(env) {
env = env || process.env;
var ret = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE;
cache = getLocale(ret);
return ret;
}
function parseLocale(x) {
var env = x.split('\n').reduce(function (env, def) {
def = def.split('=');
env[def[0]] = def[1];
return env;
}, {});
return getEnvLocale(env);
}
function getLocale(str) {
return (str && str.replace(/[.:].*/, '')) || fallback();
}
module.exports = function (opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = defaultOpts;
} else {
opts = opts || defaultOpts;
}
if (cache || getEnvLocale() || opts.spawn === false) {
setImmediate(cb, null, cache);
return;
}
var getAppleLocale = function () {
childProcess.execFile('defaults', ['read', '-g', 'AppleLocale'], function (err, stdout) {
if (err) {
fallback();
return;
}
cache = stdout.trim() || fallback();
cb(null, cache);
});
};
if (process.platform === 'win32') {
childProcess.execFile('wmic', ['os', 'get', 'locale'], function (err, stdout) {
if (err) {
fallback();
return;
}
var lcidCode = parseInt(stdout.replace('Locale', ''), 16);
cache = lcid.from(lcidCode) || fallback();
cb(null, cache);
});
} else {
childProcess.execFile('locale', function (err, stdout) {
if (err) {
fallback();
return;
}
var res = parseLocale(stdout);
if (!res && process.platform === 'darwin') {
getAppleLocale();
return;
}
cache = getLocale(res);
cb(null, cache);
});
}
};
module.exports.sync = function (opts) {
opts = opts || defaultOpts;
if (cache || getEnvLocale() || !execFileSync || opts.spawn === false) {
return cache;
}
if (process.platform === 'win32') {
var stdout;
try {
stdout = execFileSync('wmic', ['os', 'get', 'locale'], {encoding: 'utf8'});
} catch (err) {
return fallback();
}
var lcidCode = parseInt(stdout.replace('Locale', ''), 16);
cache = lcid.from(lcidCode) || fallback();
return cache;
}
var res;
try {
res = parseLocale(execFileSync('locale', {encoding: 'utf8'}));
} catch (err) {}
if (!res && process.platform === 'darwin') {
try {
cache = execFileSync('defaults', ['read', '-g', 'AppleLocale'], {encoding: 'utf8'}).trim() || fallback();
return cache;
} catch (err) {
return fallback();
}
}
cache = getLocale(res);
return cache;
};

21
node_modules/os-locale/license generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

80
node_modules/os-locale/package.json generated vendored Normal file
View File

@ -0,0 +1,80 @@
{
"_args": [
[
"os-locale@1.4.0",
"/Users/tatiana/selfdefined"
]
],
"_from": "os-locale@1.4.0",
"_id": "os-locale@1.4.0",
"_inBundle": false,
"_integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"_location": "/os-locale",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "os-locale@1.4.0",
"name": "os-locale",
"escapedName": "os-locale",
"rawSpec": "1.4.0",
"saveSpec": null,
"fetchSpec": "1.4.0"
},
"_requiredBy": [
"/localtunnel/yargs",
"/nunjucks/yargs",
"/yargs"
],
"_resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"_spec": "1.4.0",
"_where": "/Users/tatiana/selfdefined",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/os-locale/issues"
},
"dependencies": {
"lcid": "^1.0.0"
},
"description": "Get the system locale",
"devDependencies": {
"ava": "*",
"require-uncached": "^1.0.2",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/os-locale#readme",
"keywords": [
"locale",
"lang",
"language",
"system",
"os",
"string",
"str",
"user",
"country",
"id",
"identifier",
"region"
],
"license": "MIT",
"name": "os-locale",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/os-locale.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "1.4.0"
}

47
node_modules/os-locale/readme.md generated vendored Normal file
View File

@ -0,0 +1,47 @@
# os-locale [![Build Status](https://travis-ci.org/sindresorhus/os-locale.svg?branch=master)](https://travis-ci.org/sindresorhus/os-locale)
> Get the system [locale](http://en.wikipedia.org/wiki/Locale)
Useful for localizing your module or app.
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
```
$ npm install --save os-locale
```
## Usage
```js
var osLocale = require('os-locale');
osLocale(function (err, locale) {
console.log(locale);
//=> 'en_US'
});
```
## API
### osLocale([options], callback(error, locale))
### osLocale.sync([options])
Returns the locale.
#### options.spawn
Type: `boolean`
Default: `true`
Set to `false` to avoid spawning subprocesses and instead only resolve the locale from environment variables.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)