This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let startTime = Date.now(); | |
const prestand = () => { | |
const result = Date.now() - startTime; | |
startTime = Date.now(); | |
return `${result} ms`; | |
}; | |
let startTime = performance.now(); | |
const prestand2 = () => { | |
const result = performance.now() - startTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type JsonPrimitives = string | number | boolean | String | Number | Boolean | null; | |
type NonJsonPrimitives = undefined | Function | symbol; | |
type SerializeType<T> = T extends JsonPrimitives | |
? T | |
: T extends NonJsonPrimitives | |
? never | |
: T extends { toJSON(): infer U } | |
? U | |
: T extends [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const urlToTest = new URL("AddUrl"); | |
let query = {}; | |
for ([key, value] of urlToTest.searchParams) { | |
query[key] = value; | |
} | |
console.log({ | |
host: urlToTest.host, | |
query: query, | |
path: urlToTest.pathname, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Prettify<T> = { | |
[K in keyof T]: T[K]; | |
} & {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const W3CEmailRegExp = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; |
OlderNewer