Socket
Socket
Sign inDemoInstall

make-plural

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-plural - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

10

lib/make-plural.js

@@ -87,7 +87,7 @@ /**

function test(fn, tests) {
function test(fn, tests, opt) {
var ok = true,
_e = function(t) {
ok = false;
console.error(
if (!opt['quiet']) console.error(
'ERROR: plural rule self-test failed for v = '

@@ -118,3 +118,3 @@ + (typeof t == 'string' ? '"' + t + '"' : t)

if (!rules) exports.set_rules();
if (!rules[lc]) { console.error('ERROR: locale "' + lc + '" not found'); return null; }
if (!rules[lc]) { if (!opt['quiet']) console.error('ERROR: locale "' + lc + '" not found'); return null; }
for (var r in rules[lc]) {

@@ -130,7 +130,7 @@ var key = r.replace('pluralRule-count-', ''),

fn = new Function('n', lines.join('\n').trim());
if (!test(fn, tests)) return null;
if (!opt['no_tests'] && !test(fn, tests, opt)) return null;
if (opt['return_function']) return fn;
fn_str = 'function(n) {\n ' + lines.join('\n ') + '\n}';
fn_str = 'function(n) {\n ' + lines.join('\n ').trim() + '\n}';
if (opt['minify']) fn_str = fn_str.replace(/\s+/g, '').replace(/{var/, '{var ');
return fn_str;
};
{
"name": "make-plural",
"version": "1.1.2",
"version": "1.1.3",
"description": "Translates Unicode CLDR pluralization rules to executable JavaScript",
"keywords": ["unicode", "CLDR", "i18n", "internationalization", "pluralization"],
"keywords": ["unicode", "cldr", "i18n", "internationalization", "pluralization"],
"author": "Eemeli Aro <eemeli@gmail.com>",

@@ -7,0 +7,0 @@ "license": "ISC",

@@ -59,6 +59,10 @@ make-plural

argument `n` and returns its plural category for the given locale `lc`. The
optional `opt` object may contain the following members:
* `return_function` -- if true, `build` returns an executable function of `n`
optional `opt` object may contain the following members, each of which is
assumed as false by default:
* `minify` — if true, the string output of `build` is minified
* `no_tests` — if true, the generated function is not verified by testing it
with each of the example values included in the CLDR rules
* `quiet` — if true, no output is reported to `console.error` on error
* `return_function` — if true, `build` returns an executable function of `n`
rather than a string
* `minify` -- if true, the string output of `build` is minified

@@ -65,0 +69,0 @@ ### set_rules(cldr)

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