Module

urlSafeBase64

安全的 base64 编码, 将 base64 中的 '+', '/', '=' 分别替换为 '-', '_', '.'
以此避免 base64 编码值被代码扫描工具识别为有害代码

View Source urlSafeBase64.js, line 17

Methods

# static decode(safe) → {String}

对安全再编码后的 base64 字符串进行解码, 将字符串中的 '-', '_', '.' 分别替换为 '+', '/', '='
Parameters:
Name Type Description
safe String 再编码后的 base64 字符串

View Source urlSafeBase64.js, line 34

执行解码还原后的 base64 字符串
String

# static encode(base64) → {String}

对 base64 编码字符串进行再编码, 将字符串中的 '+', '/', '=' 分别替换为 '-', '_', '.'
Parameters:
Name Type Description
base64 String base64 编码后的字符串

View Source urlSafeBase64.js, line 23

执行替换后的 base64 字符串
String

# static isBase64(string) → {Boolean}

检测传入字符串是否是 base64 编码的字符串
Parameters:
Name Type Description
string String 传入字符串

View Source urlSafeBase64.js, line 54

是否是 base64 编码的字符串
Boolean

# static isUrlSafeBase64(string) → {Boolean}

检测传入字符串是否是安全的 base64 编码的字符串
Parameters:
Name Type Description
string String 传入字符串

View Source urlSafeBase64.js, line 63

是否是安全 base64 编码的字符串
Boolean

# static trim(string) → {String}

去除 base64 编码后的字符串中的 '=' 和 '.'
Parameters:
Name Type Description
string String base64 编码后的字符串

View Source urlSafeBase64.js, line 45

去除 base64 编码字符串中的 '=' 和 '.' 后的字符串
String