Comparing version 0.0.1 to 0.0.2
17
index.js
(function(){ | ||
var unorm, out$ = typeof exports != 'undefined' && exports || this; | ||
var unorm; | ||
unorm = require('unorm'); | ||
out$.toFullwidth = toFullwidth; | ||
function toFullwidth(it){ | ||
return unorm.nfd(it).replace(/ /g, '\u3000').replace(/[\u0020-\u007E]/g, function(it){ | ||
return unorm.nfd(it + "").replace(/ /g, '\u3000').replace(/[\u0020-\u007E]/g, function(it){ | ||
return String.fromCharCode(it.charCodeAt(0) + 0xFEE0); | ||
}); | ||
} | ||
out$.toFullwidthNFC = toFullwidthNFC; | ||
function toFullwidthNFC(it){ | ||
return unorm.nfc(toFullwidth(it)); | ||
} | ||
out$.toHalfwidth = toHalfwidth; | ||
function toHalfwidth(x){ | ||
return unorm.nfd(it).replace(/\u3000/g, ' ').replace(/[\uFF01-\uFF5E]/g, function(it){ | ||
return unorm.nfd(it + "").replace(/\u3000/g, ' ').replace(/[\uFF01-\uFF5E]/g, function(it){ | ||
return String.fromCharCode(it.charCodeAt(0) - 0xFEE0); | ||
}); | ||
} | ||
out$.toHalfwidthNFC = toHalfwidthNFC; | ||
function toHalfwidthNFC(it){ | ||
return unorm.nfc(toHalfwidth(it)); | ||
} | ||
module.exports = function(str, cb){ | ||
return cb(toFullwidth(str)); | ||
}; | ||
module.exports.toFullwidth = toFullwidthNFC; | ||
module.exports.toHalfwidth = toHalfwidthNFC; | ||
module.exports.toFullwidthNFC = toFullwidthNFC; | ||
module.exports.toHalfwidthNFC = toFullwidthNFC; | ||
}).call(this); |
{ | ||
"name": "uax11", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "index.js", | ||
@@ -18,5 +18,5 @@ "description": "Convert between full/half-width ASCII characters", | ||
}, | ||
"homepage": "https://github.com/audreyt/node-convert-eastasianwidth", | ||
"homepage": "https://github.com/audreyt/node-uax11", | ||
"bugs": { | ||
"url": "http://github.com/audreyt/node-convert-eastasianwidth/issues", | ||
"url": "http://github.com/audreyt/node-uax11/issues", | ||
"email": "audreyt@audreyt.org" | ||
@@ -30,3 +30,3 @@ }, | ||
"type": "git", | ||
"url": "http://github.com/audreyt/node-convert-eastasianwidth.git" | ||
"url": "http://github.com/audreyt/node-uax11.git" | ||
}, | ||
@@ -33,0 +33,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
7782
6
27
1
1