feat: add parsers for TimeWatched

This commit is contained in:
LuanRT
2022-08-24 06:13:19 -03:00
parent c000bd8d5f
commit 541cdc455f
11 changed files with 159 additions and 32 deletions

View File

@@ -205,19 +205,6 @@ export function hasKeys<T extends object, R extends (keyof T)[]>(params: T, ...k
return true;
}
/**
* Turns the ntoken transform data into a valid json array
*/
export function refineNTokenData(data: string) {
return data
.replace(/function\(d,e\)/g, '"function(d,e)').replace(/function\(d\)/g, '"function(d)')
.replace(/function\(\)/g, '"function()').replace(/function\(d,e,f\)/g, '"function(d,e,f)')
.replace(/\[function\(d,e,f\)/g, '["function(d,e,f)').replace(/,b,/g, ',"b",')
.replace(/,b/g, ',"b"').replace(/b,/g, '"b",').replace(/b]/g, '"b"]')
.replace(/\[b/g, '["b"').replace(/}]/g, '"]').replace(/},/g, '}",')
.replace(/""/g, '').replace(/length]\)}"/g, 'length])}');
}
export function uuidv4() {
if (getRuntime() === 'node') {
return Reflect.get(module, 'require')('crypto').webcrypto.randomUUID();