fix: base64encode crash if number given

master 1.0.1
宇天 2017-03-12 02:00:32 +08:00
parent 33e49c43ea
commit e3aa7aeb72
2 changed files with 2 additions and 2 deletions

View File

@ -172,7 +172,7 @@ class C {
*/
base64encode(str, urlFriendly){
if(!Buffer.isBuffer(str))
str = Buffer.from(str)
str = Buffer.from(str + '')
let encode = str.toString('base64')
if(urlFriendly)
encode = encode.replace(/[+\/]/g, m => {return m === '+' ? '-' : '_'}).replace(/=/g, '')

View File

@ -1,6 +1,6 @@
{
"name": "crypto.js",
"version": "1.0.0",
"version": "1.0.1",
"description": "原生crypto加密模块的二次封装,简化常用加密函数的使用",
"keywords": [
"md5",