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

nepali-number

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nepali-number - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

50

dist/index.es.js

@@ -29,3 +29,6 @@ var NepaliNumber = /** @class */ (function () {

}
return numberString.toString().split("").map(function (char) {
return numberString
.toString()
.split("")
.map(function (char) {
// tslint:disable-next-line:radix

@@ -36,3 +39,4 @@ if (isNaN(parseInt(char))) {

return _this.digitMapping[char] || char;
}).join("");
})
.join("");
};

@@ -45,6 +49,10 @@ NepaliNumber.prototype.toEnglish = function (numberString) {

}
return numberString.toString().split("").map(function (char) {
return numberString
.toString()
.split("")
.map(function (char) {
var englishDigit = _this.digitMapping.findIndex(function (digit) { return digit === char; });
return englishDigit === -1 ? char : "" + englishDigit;
}).join("");
})
.join("");
};

@@ -60,3 +68,3 @@ NepaliNumber.prototype.formatNumber = function (type) {

}
var formatted = (new Intl.NumberFormat(type)).format(englishNumber);
var formatted = new Intl.NumberFormat(type).format(englishNumber);
return this.outputLocale === "en" ? this.toEnglish(formatted) : this.toNepali(formatted);

@@ -74,6 +82,6 @@ };

}
var formatted = (new Intl.NumberFormat(type, {
var formatted = new Intl.NumberFormat(type, {
maximumFractionDigits: precision,
minimumFractionDigits: precision,
})).format(englishAmount);
}).format(englishAmount);
return this.outputLocale === "en" ? this.toEnglish(formatted) : this.toNepali(formatted);

@@ -84,11 +92,21 @@ };

var englishToNepaliNumber = function (numberString) { return (new NepaliNumber()).setNumber(numberString).toNepali(); };
var nepaliToEnglishNumber = function (numberString) { return (new NepaliNumber()).setNumber(numberString).toEnglish(); };
var englishToNepaliNumber = function (numberString) {
return new NepaliNumber().setNumber(numberString).toNepali();
};
var nepaliToEnglishNumber = function (numberString) {
return new NepaliNumber().setNumber(numberString).toEnglish();
};
var nepaliNumberFormat = function (numberString, locale) {
if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatNumber("en-IN");
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatNumber("en-IN");
};
var englishNumberFormat = function (numberString, locale) {
if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatNumber("en-US");
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatNumber("en-US");
};

@@ -98,3 +116,6 @@ var nepaliAmountFormat = function (numberString, precision, locale) {

if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatAmount("en-IN", precision);
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatAmount("en-IN", precision);
};

@@ -104,3 +125,6 @@ var englishAmountFormat = function (numberString, precision, locale) {

if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatAmount("en-US", precision);
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatAmount("en-US", precision);
};

@@ -107,0 +131,0 @@

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

}
return numberString.toString().split("").map(function (char) {
return numberString
.toString()
.split("")
.map(function (char) {
// tslint:disable-next-line:radix

@@ -40,3 +43,4 @@ if (isNaN(parseInt(char))) {

return _this.digitMapping[char] || char;
}).join("");
})
.join("");
};

@@ -49,6 +53,10 @@ NepaliNumber.prototype.toEnglish = function (numberString) {

}
return numberString.toString().split("").map(function (char) {
return numberString
.toString()
.split("")
.map(function (char) {
var englishDigit = _this.digitMapping.findIndex(function (digit) { return digit === char; });
return englishDigit === -1 ? char : "" + englishDigit;
}).join("");
})
.join("");
};

@@ -64,3 +72,3 @@ NepaliNumber.prototype.formatNumber = function (type) {

}
var formatted = (new Intl.NumberFormat(type)).format(englishNumber);
var formatted = new Intl.NumberFormat(type).format(englishNumber);
return this.outputLocale === "en" ? this.toEnglish(formatted) : this.toNepali(formatted);

@@ -78,6 +86,6 @@ };

}
var formatted = (new Intl.NumberFormat(type, {
var formatted = new Intl.NumberFormat(type, {
maximumFractionDigits: precision,
minimumFractionDigits: precision,
})).format(englishAmount);
}).format(englishAmount);
return this.outputLocale === "en" ? this.toEnglish(formatted) : this.toNepali(formatted);

@@ -88,11 +96,21 @@ };

var englishToNepaliNumber = function (numberString) { return (new NepaliNumber()).setNumber(numberString).toNepali(); };
var nepaliToEnglishNumber = function (numberString) { return (new NepaliNumber()).setNumber(numberString).toEnglish(); };
var englishToNepaliNumber = function (numberString) {
return new NepaliNumber().setNumber(numberString).toNepali();
};
var nepaliToEnglishNumber = function (numberString) {
return new NepaliNumber().setNumber(numberString).toEnglish();
};
var nepaliNumberFormat = function (numberString, locale) {
if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatNumber("en-IN");
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatNumber("en-IN");
};
var englishNumberFormat = function (numberString, locale) {
if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatNumber("en-US");
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatNumber("en-US");
};

@@ -102,3 +120,6 @@ var nepaliAmountFormat = function (numberString, precision, locale) {

if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatAmount("en-IN", precision);
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatAmount("en-IN", precision);
};

@@ -108,3 +129,6 @@ var englishAmountFormat = function (numberString, precision, locale) {

if (locale === void 0) { locale = "en"; }
return (new NepaliNumber()).setOutputLocale(locale).setNumber(numberString).formatAmount("en-US", precision);
return new NepaliNumber()
.setOutputLocale(locale)
.setNumber(numberString)
.formatAmount("en-US", precision);
};

@@ -111,0 +135,0 @@

{
"name": "nepali-number",
"version": "1.0.1",
"description": "Nepali numbers",
"version": "1.0.2",
"description": "Conversion and transliteration of English to Nepali numbers and vice versa",
"main": "dist/index.js",

@@ -19,3 +19,3 @@ "module": "dist/index.es.js",

"start": "npm-run-all -p watch:*",
"format": "prettier --write \"src/**/*.js\"",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "tslint -p tsconfig.json",

@@ -44,3 +44,3 @@ "prepare": "yarn build",

},
"homepage": "https://puncoz-official.github.io/nepali-number",
"homepage": "https://github.com/puncoz-official/nepali-number",
"devDependencies": {

@@ -47,0 +47,0 @@ "@types/jest": "^24.0.17",

# Nepali Number
Operation with numbers in nepali (Devnagari) and english with unicode supports.
Translations and formatting numbers in nepali (Devnagari) and english with unicode supports.

@@ -5,0 +5,0 @@ [![Version](https://img.shields.io/npm/v/nepali-number?logo=npm)](https://www.npmjs.com/package/nepali-number)

Sorry, the diff of this file is not supported yet

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