Socket
Socket
Sign inDemoInstall

vn-str

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.3.0

README-vn.md

2

dist/index.js

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.vnStr=r():e.vnStr=r()}(this,(function(){return(()=>{var e={492:(e,r,t)=>{var n=t(665).H,o=t(54).i,i=t(500),a=i.rmNonAlphanumeric,s=i.rmVnTones,u=t(31),p=u.strToTelex,m=u.strToVNI;e.exports.isVietnamesePhoneNumber=n,e.exports.numToText=o,e.exports.rmNonAlphanumeric=a,e.exports.rmVnTones=s,e.exports.strToTelex=p,e.exports.strToVNI=m},54:(e,r,t)=>{"use strict";t.d(r,{i:()=>l});var n=["không","một","hai","ba","bốn","năm","sáu","bảy","tám","chín"],o=["mười","hai mươi","ba mươi","bốn mươi","năm mươi","sáu mươi","bảy mươi","tám mươi","chín mươi"],i=["không trăm","một trăm","hai trăm","ba trăm","bốn trăm","năm trăm","sáu trăm","bảy trăm","tám trăm","chín trăm"];function a(e){var r=(""+e).split(""),t=parseInt(r[0]),i=parseInt(r[1]);return 0===i?o[t-1]:5===i?o[t-1]+" lăm":4===i?o[t-1]+" tư":1===i?1===t?o[t-1]+" một":o[t-1]+" mốt":o[t-1]+" "+n[i]}function s(e){var r=(""+e).split(""),t=parseInt(r[0]),o=parseInt(r[1]),s=parseInt(r[2]);return o>0?i[t]+" "+a(""+o+s):0===s?""+i[t]:4===s?i[t]+" linh tư":i[t]+" linh "+n[s]}function u(e){var r=(""+e).split("").reverse(),t=r.slice(0,3).reverse().join(""),o=parseInt(r.slice(3,r.length).reverse().join("")),i=(""+o).length,u="";return parseInt(t)>1&&(u=s(t)),1===i?n[o]+" nghìn "+u:2===i?a(""+o)+" nghìn "+u:s(""+o)+" nghìn "+u}function p(e){var r=(""+e).split("").reverse(),t=r.slice(0,6).reverse().join(""),o=parseInt(r.slice(6,r.length).reverse().join("")),i=(""+o).length,p="";return parseInt(t)>999?p=u(t):parseInt(t)<=999&&parseInt(t)>=1&&(p=s((""+t).split("").slice(3,6).join(""))),1===i?n[o]+" triệu "+p:2===i?a(""+o)+" triệu "+p:s(""+o)+" triệu "+p}function m(e){var r=(""+e).split("").reverse(),t=r.slice(0,9).reverse().join(""),o=parseInt(r.slice(9,r.length).reverse().join("")),i="";parseInt(t)>999999&&parseInt(t)<=999999999?i=p(t):parseInt(t)<=999999&&parseInt(t)>999?i=u((""+t).split("").slice(3,9).join("")):parseInt(t)<=999&&parseInt(t)>=1&&(i=s((""+t).split("").slice(6,9).join("")));var l=(""+o).length;return 1===l?n[o]+" tỷ "+i:2===l?a(""+o)+" tỷ "+i:3===l?s(""+o)+" tỷ "+i:l>3&&l<=6?u(""+o)+" tỷ "+i:l>6&&l<=9?p(""+o)+" tỷ "+i:l>9?m(""+o)+" tỷ "+i:void 0}function l(e){if(e<0)return"âm "+l(Math.abs(e));var r=(""+e).length;return 1===r?n[e].trim():2===r?a(""+e).trim():3===r?s(""+e).trim():r>3&&r<=6?u(""+e).trim():r>6&&r<=9?p(""+e).trim():r>9?m(""+e).trim():null}},31:(e,r,t)=>{"use strict";t.r(r),t.d(r,{strToTelex:()=>i,strToVNI:()=>a});var n={á:"as",à:"af",ả:"ar",ã:"ax",ạ:"aj",ắ:"aws",ằ:"awf",ẳ:"awr",ẵ:"awx",ặ:"awj",ă:"aw",ấ:"aas",ầ:"aaf",ẩ:"aar",ẫ:"aax",ậ:"aaj",â:"aa",đ:"dd",é:"es",è:"ef",ẻ:"er",ẽ:"ex",ẹ:"ej",ế:"ees",ề:"eef",ể:"eer",ễ:"eex",ệ:"eej",ê:"ee",í:"is",ì:"if",ỉ:"ir",ĩ:"ix",ị:"ij",ó:"os",ò:"of",ỏ:"or",õ:"ox",ọ:"oj",ố:"oos",ồ:"oof",ổ:"oor",ỗ:"oox",ộ:"ooj",ô:"oo",ớ:"ows",ờ:"owf",ở:"owr",ỡ:"owx",ợ:"owj",ơ:"ow",ú:"us",ù:"uf",ủ:"ur",ũ:"ux",ụ:"uj",ứ:"uws",ừ:"uwf",ử:"uwr",ữ:"uwx",ự:"uwj",ư:"uw",ý:"ys",ỳ:"yf",ỷ:"yr",ỹ:"yx",ỵ:"yj"},o={á:"a1",à:"a2",ả:"a3",ã:"a4",ạ:"a5",ắ:"a81",ằ:"a82",ẳ:"a83",ẵ:"a84",ặ:"a85",ă:"a8",ấ:"a61",ầ:"a62",ẩ:"a63",ẫ:"a64",ậ:"a65",â:"a6",đ:"d9",é:"e1",è:"e2",ẻ:"e3",ẽ:"e4",ẹ:"e5",ế:"e61",ề:"e62",ể:"e63",ễ:"e64",ệ:"e65",ê:"e6",í:"i1",ì:"i2",ỉ:"i3",ĩ:"i4",ị:"i5",ó:"o1",ò:"o2",ỏ:"o3",õ:"o4",ọ:"o5",ố:"o61",ồ:"o62",ổ:"o63",ỗ:"o64",ộ:"o65",ô:"o6",ớ:"o71",ờ:"o72",ở:"o73",ỡ:"o74",ợ:"o75",ơ:"o7",ú:"u1",ù:"u2",ủ:"u3",ũ:"u4",ụ:"u5",ứ:"u71",ừ:"u72",ử:"u73",ữ:"u74",ự:"u75",ư:"u7",ý:"y1",ỳ:"y2",ỷ:"y3",ỹ:"y4",ỵ:"y5"};function i(e){return e.split("").map((function(e){return n[e]||e})).join("")}function a(e){return e.split("").map((function(e){return o[e]||e})).join("")}},500:(e,r,t)=>{"use strict";function n(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/đ/g,"d").replace(/Đ/g,"D")}function o(e){return e.replace(/[^0-9a-zàáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ\s]/gi,"")}t.r(r),t.d(r,{rmVnTones:()=>n,rmNonAlphanumeric:()=>o})},665:(e,r,t)=>{"use strict";function n(e){return/((^(\+84|84|0|0084){1})(3|5|7|8|9))+([0-9]{8})$/.test(e)}t.d(r,{H:()=>n})}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}return t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t(492)})()}));
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.vnStr=r():e.vnStr=r()}(this,(function(){return(()=>{var e={492:(e,r,t)=>{var n=t(665),o=n.isVietnamesePhoneNumber,i=n.isVietnameseTones,s=t(54).i,a=t(500),u=a.rmNonAlphanumeric,m=a.rmVnTones,p=t(31),l=p.strToTelex,c=p.strToVNI;e.exports.isVietnamesePhoneNumber=o,e.exports.isVietnameseTones=i,e.exports.numToText=s,e.exports.rmNonAlphanumeric=u,e.exports.rmVnTones=m,e.exports.strToTelex=l,e.exports.strToVNI=c},54:(e,r,t)=>{"use strict";t.d(r,{i:()=>l});var n=["không","một","hai","ba","bốn","năm","sáu","bảy","tám","chín"],o=["mười","hai mươi","ba mươi","bốn mươi","năm mươi","sáu mươi","bảy mươi","tám mươi","chín mươi"],i=["không trăm","một trăm","hai trăm","ba trăm","bốn trăm","năm trăm","sáu trăm","bảy trăm","tám trăm","chín trăm"];function s(e){var r=(""+e).split(""),t=parseInt(r[0]),i=parseInt(r[1]);return 0===i?o[t-1]:5===i?o[t-1]+" lăm":4===i?o[t-1]+" tư":1===i?1===t?o[t-1]+" một":o[t-1]+" mốt":o[t-1]+" "+n[i]}function a(e){var r=(""+e).split(""),t=parseInt(r[0]),o=parseInt(r[1]),a=parseInt(r[2]);return o>0?i[t]+" "+s(""+o+a):0===a?""+i[t]:4===a?i[t]+" linh tư":i[t]+" linh "+n[a]}function u(e){var r=(""+e).split("").reverse(),t=r.slice(0,3).reverse().join(""),o=parseInt(r.slice(3,r.length).reverse().join("")),i=(""+o).length,u="";return parseInt(t)>1&&(u=a(t)),1===i?n[o]+" nghìn "+u:2===i?s(""+o)+" nghìn "+u:a(""+o)+" nghìn "+u}function m(e){var r=(""+e).split("").reverse(),t=r.slice(0,6).reverse().join(""),o=parseInt(r.slice(6,r.length).reverse().join("")),i=(""+o).length,m="";return parseInt(t)>999?m=u(t):parseInt(t)<=999&&parseInt(t)>=1&&(m=a((""+t).split("").slice(3,6).join(""))),1===i?n[o]+" triệu "+m:2===i?s(""+o)+" triệu "+m:a(""+o)+" triệu "+m}function p(e){var r=(""+e).split("").reverse(),t=r.slice(0,9).reverse().join(""),o=parseInt(r.slice(9,r.length).reverse().join("")),i="";parseInt(t)>999999&&parseInt(t)<=999999999?i=m(t):parseInt(t)<=999999&&parseInt(t)>999?i=u((""+t).split("").slice(3,9).join("")):parseInt(t)<=999&&parseInt(t)>=1&&(i=a((""+t).split("").slice(6,9).join("")));var l=(""+o).length;return 1===l?n[o]+" tỷ "+i:2===l?s(""+o)+" tỷ "+i:3===l?a(""+o)+" tỷ "+i:l>3&&l<=6?u(""+o)+" tỷ "+i:l>6&&l<=9?m(""+o)+" tỷ "+i:l>9?p(""+o)+" tỷ "+i:void 0}function l(e){if(e<0)return"âm "+l(Math.abs(e));var r=(""+e).length;return 1===r?n[e].trim():2===r?s(""+e).trim():3===r?a(""+e).trim():r>3&&r<=6?u(""+e).trim():r>6&&r<=9?m(""+e).trim():r>9?p(""+e).trim():null}},31:(e,r,t)=>{"use strict";t.r(r),t.d(r,{strToTelex:()=>i,strToVNI:()=>s});var n={á:"as",à:"af",ả:"ar",ã:"ax",ạ:"aj",ắ:"aws",ằ:"awf",ẳ:"awr",ẵ:"awx",ặ:"awj",ă:"aw",ấ:"aas",ầ:"aaf",ẩ:"aar",ẫ:"aax",ậ:"aaj",â:"aa",đ:"dd",é:"es",è:"ef",ẻ:"er",ẽ:"ex",ẹ:"ej",ế:"ees",ề:"eef",ể:"eer",ễ:"eex",ệ:"eej",ê:"ee",í:"is",ì:"if",ỉ:"ir",ĩ:"ix",ị:"ij",ó:"os",ò:"of",ỏ:"or",õ:"ox",ọ:"oj",ố:"oos",ồ:"oof",ổ:"oor",ỗ:"oox",ộ:"ooj",ô:"oo",ớ:"ows",ờ:"owf",ở:"owr",ỡ:"owx",ợ:"owj",ơ:"ow",ú:"us",ù:"uf",ủ:"ur",ũ:"ux",ụ:"uj",ứ:"uws",ừ:"uwf",ử:"uwr",ữ:"uwx",ự:"uwj",ư:"uw",ý:"ys",ỳ:"yf",ỷ:"yr",ỹ:"yx",ỵ:"yj"},o={á:"a1",à:"a2",ả:"a3",ã:"a4",ạ:"a5",ắ:"a81",ằ:"a82",ẳ:"a83",ẵ:"a84",ặ:"a85",ă:"a8",ấ:"a61",ầ:"a62",ẩ:"a63",ẫ:"a64",ậ:"a65",â:"a6",đ:"d9",é:"e1",è:"e2",ẻ:"e3",ẽ:"e4",ẹ:"e5",ế:"e61",ề:"e62",ể:"e63",ễ:"e64",ệ:"e65",ê:"e6",í:"i1",ì:"i2",ỉ:"i3",ĩ:"i4",ị:"i5",ó:"o1",ò:"o2",ỏ:"o3",õ:"o4",ọ:"o5",ố:"o61",ồ:"o62",ổ:"o63",ỗ:"o64",ộ:"o65",ô:"o6",ớ:"o71",ờ:"o72",ở:"o73",ỡ:"o74",ợ:"o75",ơ:"o7",ú:"u1",ù:"u2",ủ:"u3",ũ:"u4",ụ:"u5",ứ:"u71",ừ:"u72",ử:"u73",ữ:"u74",ự:"u75",ư:"u7",ý:"y1",ỳ:"y2",ỷ:"y3",ỹ:"y4",ỵ:"y5"};function i(e){return e.split("").map((function(e){return n[e]||e})).join("")}function s(e){return e.split("").map((function(e){return o[e]||e})).join("")}},500:(e,r,t)=>{"use strict";function n(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/đ/g,"d").replace(/Đ/g,"D")}function o(e){return e.replace(/[^0-9a-zàáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ\s]/gi,"")}t.r(r),t.d(r,{rmVnTones:()=>n,rmNonAlphanumeric:()=>o})},665:(e,r,t)=>{"use strict";function n(e){return/((^(\+84|84|0|0084){1})(3|5|7|8|9))+([0-9]{8})$/.test(e)}function o(e){return e.split("").map((function(e){return new RegExp("^[ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚĂĐĨŨƠàáâãèéêìíòóôõùúăđĩũơƯĂẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼỀỀỂẾưăạảấầẩẫậắằẳẵặẹẻẽềềểếỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪễệỉịọỏốồổỗộớờởỡợụủứừỬỮỰỲỴÝỶỸửữựỳỵỷỹ]+$").test(e)})).some((function(e){return e}))}t.r(r),t.d(r,{isVietnamesePhoneNumber:()=>n,isVietnameseTones:()=>o})}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}return t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t(492)})()}));
{
"name": "vn-str",
"version": "0.2.0",
"version": "0.3.0",
"description": "Vietnamese string processing library.",

@@ -9,3 +9,4 @@ "main": "dist/index.js",

"test": "webpack && jest",
"build": "webpack"
"build": "webpack",
"publish": "npm publish"
},

@@ -12,0 +13,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc