Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

os-locale

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

os-locale - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

24

index.js

@@ -6,3 +6,3 @@ 'use strict';

const defaultOpts = {spawn: true};
const defaultOptions = {spawn: true};
const defaultLocale = 'en_US';

@@ -24,4 +24,4 @@

function getLocale(str) {
return (str && str.replace(/[.:].*/, ''));
function getLocale(string) {
return (string && string.replace(/[.:].*/, ''));
}

@@ -63,3 +63,3 @@

function getWinLocaleSync() {
const stdout = execa.sync('wmic', ['os', 'get', 'locale']).stdout;
const {stdout} = execa.sync('wmic', ['os', 'get', 'locale']);
const lcidCode = parseInt(stdout.replace('Locale', ''), 16);

@@ -69,8 +69,7 @@ return lcid.from(lcidCode);

module.exports = mem(opts => {
opts = opts || defaultOpts;
module.exports = mem((options = defaultOptions) => {
const envLocale = getEnvLocale();
let thenable;
if (envLocale || opts.spawn === false) {
if (envLocale || options.spawn === false) {
thenable = Promise.resolve(getLocale(envLocale));

@@ -87,8 +86,7 @@ } else if (process.platform === 'win32') {

module.exports.sync = mem(opts => {
opts = opts || defaultOpts;
module.exports.sync = mem((options = defaultOptions) => {
const envLocale = getEnvLocale();
let res;
if (envLocale || opts.spawn === false) {
if (envLocale || options.spawn === false) {
res = getLocale(envLocale);

@@ -102,3 +100,3 @@ } else {

}
} catch (err) {}
} catch (_) {}
}

@@ -105,0 +103,0 @@

{
"name": "os-locale",
"version": "2.1.0",
"version": "3.0.0",
"description": "Get the system locale",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=4"
"node": ">=6"
},

@@ -37,5 +37,5 @@ "scripts": {

"dependencies": {
"execa": "^0.7.0",
"lcid": "^1.0.0",
"mem": "^1.1.0"
"execa": "^0.10.0",
"lcid": "^2.0.0",
"mem": "^3.0.1"
},

@@ -42,0 +42,0 @@ "devDependencies": {

@@ -13,3 +13,3 @@ # os-locale [![Build Status](https://travis-ci.org/sindresorhus/os-locale.svg?branch=master)](https://travis-ci.org/sindresorhus/os-locale)

```
$ npm install --save os-locale
$ npm install os-locale
```

@@ -23,6 +23,6 @@

osLocale().then(locale => {
console.log(locale);
(async () => {
console.log(await osLocale());
//=> 'en_US'
});
})();
```

@@ -29,0 +29,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc