New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eurodigit

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eurodigit - npm Package Compare versions

Comparing version 2.1.1 to 3.0.0

src/to_non_euro.js

2

kanso.json
{
"name": "eurodigit",
"version": "2.1.1",
"version": "3.0.0",
"description": "Convert Hindu-Arabic numerals of different scripts into Western Arabic (European) digits.",

@@ -5,0 +5,0 @@ "modules": "src/index.js",

{
"name": "eurodigit",
"version": "2.1.1",
"version": "3.0.0",
"description": "Convert Hindu-Arabic numerals of different scripts into Western Arabic (European) digits.",
"main": "src/index.js",
"scripts": {
"test": "grunt test"
"test": "grunt"
},

@@ -9,0 +9,0 @@ "repository": {

'use strict';
/* Magic number: 2406 is the char code for '०' */
function replacer(c) { return c.charCodeAt(0) - 2406; }
function replacer(c) {
c = c.charCodeAt(0);
if(c < 1642) return c - 1632; // western arabic
if(c < 1786) return c - 1776; // perso-arabic
return c - 2406; // devanagari
}
module.exports = function(original) {
return original && original.toString().replace(/[०-९]/g, replacer);
return original && original.toString().replace(/[٠-٩۰-۹०-९]/g, replacer);
};

@@ -22,2 +22,14 @@ var assert = require('chai').assert;

it('should translate Eastern Arabic numerals', function() {
// expect
assertTranslation('0 1 2 3 4 5 6 7 8 9',
'٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩');
});
it('should translate Perso-Arabic numerals', function() {
// expect
assertTranslation('0 1 2 3 4 5 6 7 8 9',
'۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹');
});
it('should ignore irrelevant text', function() {

@@ -24,0 +36,0 @@ // expect

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