280 lines
9.8 KiB
TypeScript
280 lines
9.8 KiB
TypeScript
// just for develop
|
||
|
||
export default {
|
||
json,
|
||
jsonP,
|
||
unJson,
|
||
yaml,
|
||
unYaml,
|
||
load,
|
||
save,
|
||
base64,
|
||
unBase64,
|
||
urlBase64,
|
||
unUrlBase64,
|
||
hex,
|
||
unHex,
|
||
aes,
|
||
unAes,
|
||
sm4,
|
||
unSM4,
|
||
genECDSA,
|
||
exportECDSAPrivateKey,
|
||
exportECDSAPublicKey,
|
||
importECDSAKey,
|
||
signECDSA,
|
||
verifyECDSA,
|
||
encryptECDSA,
|
||
decryptECDSA,
|
||
genSM2,
|
||
exportSM2PrivateKey,
|
||
exportSM2PublicKey,
|
||
importSM2Key,
|
||
signSM2,
|
||
verifySM2,
|
||
encryptSM2,
|
||
decryptSM2,
|
||
genRSA,
|
||
exportRSAPrivateKey,
|
||
exportRSAPublicKey,
|
||
importRSAKey,
|
||
signRSA,
|
||
verifyRSA,
|
||
encryptRSA,
|
||
decryptRSA,
|
||
gzip,
|
||
gunzip,
|
||
id,
|
||
idL,
|
||
uniqueId,
|
||
uniqueIdL,
|
||
token,
|
||
md5,
|
||
sha1,
|
||
sha256,
|
||
sha512,
|
||
sm3,
|
||
hmacMD5,
|
||
hmacSHA1,
|
||
hmacSHA256,
|
||
hmacSHA512,
|
||
hmacSM3,
|
||
tpl,
|
||
sleep,
|
||
setTimeout,
|
||
shell,
|
||
formatDate,
|
||
timestampMS,
|
||
timestamp,
|
||
toDatetime,
|
||
fromDatetime,
|
||
toDate,
|
||
fromDate,
|
||
os,
|
||
arch,
|
||
joinPath,
|
||
getPathDir,
|
||
getPathBase,
|
||
getPathVolume,
|
||
absPath,
|
||
cleanPath,
|
||
isLocalPath,
|
||
string,
|
||
int,
|
||
float,
|
||
bytes,
|
||
bool,
|
||
searchFile,
|
||
loadConfig,
|
||
keysBy,
|
||
countBy,
|
||
listBy,
|
||
hasBy,
|
||
getBy,
|
||
setBy,
|
||
indexBy,
|
||
removeBy,
|
||
removeArrayItem,
|
||
last,
|
||
len,
|
||
mergeBy,
|
||
sortBy,
|
||
in: _in,
|
||
uniquePush,
|
||
clearEmpty,
|
||
split,
|
||
splitWithoutEmpty,
|
||
joinWithoutEmpty,
|
||
makeDefault,
|
||
copy,
|
||
deepCopy,
|
||
isNumber,
|
||
isInt,
|
||
isFloat,
|
||
getByKey,
|
||
}
|
||
|
||
function json(data: any): string { return '' }
|
||
function jsonP(data: any): string { return '' }
|
||
function unJson(data: string): any { return null }
|
||
function yaml(data: any): string { return '' }
|
||
function unYaml(data: string): any { return null }
|
||
function load(filename: string): any { return null }
|
||
function save(filename: string, data: any) { }
|
||
function base64(data: any): string { return '' }
|
||
function unBase64(data: string): any { return null }
|
||
function urlBase64(data: any): string { return '' }
|
||
function unUrlBase64(data: string): any { return null }
|
||
function hex(data: any): string { return '' }
|
||
function unHex(data: string): any { return null }
|
||
function aes(data: any, key: string, iv: string): string { return '' }
|
||
function unAes(data: string, key: string, iv: string): any { return null }
|
||
function sm4(data: any, key: string, iv: string): string { return '' }
|
||
function unSM4(data: string, key: string, iv: string): any { return null }
|
||
function genECDSA(size?: number): any[] { return ['priKey', 'pubKey'] }
|
||
function exportECDSAPrivateKey(key: any): string { return '' }
|
||
function exportECDSAPublicKey(key: any): string { return '' }
|
||
function importECDSAKey(pemKeyOrBase64: string, private_or_public_for_base64?: string): any { return '' }
|
||
function signECDSA(data: any, priKey: any): any { return '' }
|
||
function verifyECDSA(data: any, signature: any, pubKey: any): any { return '' }
|
||
function encryptECDSA(data: any, pubKey: any): any { return '' }
|
||
function decryptECDSA(data: any, priKey: any): any { return '' }
|
||
function genSM2(): any[] { return ['priKey', 'pubKey'] }
|
||
function exportSM2PrivateKey(key: any): string { return '' }
|
||
function exportSM2PublicKey(key: any): string { return '' }
|
||
function importSM2Key(pemKeyOrBase64: string, private_or_public_for_base64?: string): any { return '' }
|
||
function signSM2(data: any, priKey: any): any { return '' }
|
||
function verifySM2(data: any, signature: any, pubKey: any): any { return '' }
|
||
function encryptSM2(data: any, pubKey: any): any { return '' }
|
||
function decryptSM2(data: any, priKey: any): any { return '' }
|
||
function genRSA(size?: number): any[] { return ['priKey', 'pubKey'] }
|
||
function exportRSAPrivateKey(key: any): string { return '' }
|
||
function exportRSAPublicKey(key: any): string { return '' }
|
||
function importRSAKey(pemKeyOrBase64: string, private_or_public_for_base64?: string): any { return '' }
|
||
function signRSA(data: any, priKey: any): any { return '' }
|
||
function verifyRSA(data: any, signature: any, pubKey: any): any { return '' }
|
||
function encryptRSA(data: any, pubKey: any): any { return '' }
|
||
function decryptRSA(data: any, priKey: any): any { return '' }
|
||
function gzip(data: any): string { return '' }
|
||
function gunzip(data: string): any { return null }
|
||
function id(size?: number): string { return '' }
|
||
function idL(size?: number): string { return '' }
|
||
function uniqueId(size?: number): string { return '' }
|
||
function uniqueIdL(size?: number): string { return '' }
|
||
function token(size: number): any { return '' }
|
||
function md5(...data: any[]): any { return '' }
|
||
function sha1(...data: any[]): any { return '' }
|
||
function sha256(...data: any[]): any { return '' }
|
||
function sha512(...data: any[]): any { return '' }
|
||
function sm3(...data: any[]): any { return '' }
|
||
function hmacMD5(key: any, ...data: any[]): any { return '' }
|
||
function hmacSHA1(key: any, ...data: any[]): any { return '' }
|
||
function hmacSHA256(key: any, ...data: any[]): any { return '' }
|
||
function hmacSHA512(key: any, ...data: any[]): any { return '' }
|
||
function hmacSM3(key: any, ...data: any[]): any { return '' }
|
||
function tpl(text: string, data: any, functions?: Object): string { return '' }
|
||
function sleep(ms: number): void { }
|
||
function setTimeout(callback: () => void, ms?: number, ...args: any): void { }
|
||
function shell(cmd: string, ...args: string[]): string[] { return [] }
|
||
function formatDate(format: string, timestamp?: number): string { return '' }
|
||
function timestampMS(): number { return 0 }
|
||
function timestamp(): number { return 0 }
|
||
function toDatetime(timestamp?: number): string { return '' }
|
||
function fromDatetime(datetimeStr: string): number { return 0 }
|
||
function toDate(timestamp?: number): string { return '' }
|
||
function fromDate(dateStr: string): number { return 0 }
|
||
function os(): string { return '' }
|
||
function arch(): string { return '' }
|
||
function joinPath(...paths: string[]): string { return '' }
|
||
function getPathDir(path: string): string { return '' }
|
||
function getPathBase(path: string): string { return '' }
|
||
function getPathVolume(path: string): string { return '' }
|
||
function absPath(path: string): string { return '' }
|
||
function cleanPath(path: string): string { return '' }
|
||
function isLocalPath(path: string): boolean { return false }
|
||
function string(value: any): string { return '' }
|
||
function int(value: any): number { return 0 }
|
||
function float(value: any): number { return 0 }
|
||
function bytes(value: any): any { return null }
|
||
function bool(value: any): boolean { return false }
|
||
function searchFile(filename: string, searchPath?: string): string { return '' }
|
||
function loadConfig(name: string): any { return null }
|
||
|
||
// 返回符合条件的key列表,支持数组和Object对象
|
||
function keysBy(obj: Array<Object>, ...fieldAndValues: any): any[] { return [] }
|
||
|
||
// 返回符合条件的对象个数,支持数组和Object对象
|
||
function countBy(obj: Array<Object>, ...fieldAndValues: any): number { return 0 }
|
||
|
||
// 返回符合条件的对象列表,支持数组和Object对象
|
||
function listBy(obj: Array<Object>, ...fieldAndValues: any): Array<Object> { return [] }
|
||
|
||
// 对象是否存在,支持数组和Object对象
|
||
function hasBy(obj: Array<Object>, ...fieldAndValues: any): boolean { return false }
|
||
|
||
// 返回符合条件的对象,支持数组和Object对象
|
||
function getBy(obj: Array<Object>, ...fieldAndValues: any): Object { return {} }
|
||
|
||
// 按条件替换对象,支持数组和Object对象
|
||
function setBy(obj: Array<Object>, value: any, ...fieldAndValues: any): void { }
|
||
|
||
// 返回符合条件的对象索引,支持数组和Object对象
|
||
function indexBy(obj: Array<Object>, ...fieldAndValues: any): number { return -1 }
|
||
|
||
// 删除符合条件的对象,支持数组和Object对象
|
||
function removeBy(obj: Array<Object>, ...fieldAndValues: any): number { return 0 }
|
||
|
||
// 数组删除对象
|
||
function removeArrayItem(list: Array<Object>, item: Object): void { }
|
||
|
||
// 返回数组的最后一个元素
|
||
function last(arr: Array<any>): any { return null }
|
||
|
||
// 返回数组或对象的元素个数
|
||
function len(obj: Object): number { return 0 }
|
||
|
||
// 按照指定的字段合并,支持数组和Object对象
|
||
function mergeBy(olds: Array<Object>, news: Array<Object>, ...fields: any): Array<Object> { return [] }
|
||
|
||
// 按照指定字段对数组排序,sortType支持:number、int、float、string等
|
||
function sortBy(obj: Array<Object>, field: string, isReverse = false, sortType?: string): Array<Object> { return [] }
|
||
|
||
// 检查是否包含,如果arr是一个字符串则用逗号分割再判断
|
||
function _in(arr: any[], checkValue: any): boolean { return false }
|
||
|
||
// 添加元素到数组(如果已经存在则忽略)
|
||
function uniquePush(arr: Array<any>, ...values: any): void { }
|
||
|
||
// 从数组中删除空元素
|
||
function clearEmpty(arr: Array<any>) { return null }
|
||
|
||
// 切割指定个数,剩余的部份保留在最后一个元素中
|
||
function split(str: string, sep: string, n: number = 0): string[] { return [] }
|
||
|
||
// 切割字符串,忽略空白的元素,如果指定了个数剩余的部份保留在最后一个元素中
|
||
function splitWithoutEmpty(str: string, sep: string, n: number = 0): string[] { return [] }
|
||
|
||
// 拼接数组,忽略空白的元素
|
||
function joinWithoutEmpty(arr: Array<any>, sep: string): string { return '' }
|
||
|
||
// 根据默认值填充对象中空的元素
|
||
function makeDefault(item: Object, defaults: Object): void { }
|
||
|
||
// 复制对象(浅拷贝,仅复制第一层),支持数组和Object对象
|
||
function copy(obj: Object): Object { return {} }
|
||
|
||
// 复制对象(深拷贝,递归复制),支持数组和Object对象
|
||
function deepCopy(obj: Object): Object { return {} }
|
||
|
||
// 判断是否是数字
|
||
function isNumber(v: any): boolean { return false }
|
||
|
||
// 判断是否是整数
|
||
function isInt(v: any): boolean { return false }
|
||
|
||
// 判断是否是浮点数
|
||
function isFloat(v: any): boolean { return false }
|
||
|
||
// 从对象中获取指定的key生成新的对象返回
|
||
function getByKey(obj: Object, ...keys: string[]): Object { return {} }
|