Matt
Matt
```ts export enum TrimType { LEADING, TRAILING, MIDDLE, ALL, } export function trim(str: string, type: TrimType) { switch (type) { case TrimType.LEADING: return str.replace(/^\s+/, ""); case TrimType.TRAILING: return str.replace(/\s+$/, "");...
```js function shuffle(arr){ return arr.sort(() => { return Math.random() - 0.5 }) } function shuffle2(arr){ const a = [...arr] const res = [] while (a.length) { const idx = Math.floor(Math.random()...
```js function create(fun, ...args) { const obj = Object.create(fun.prototype); obj.constructor = fun; const res = fun.call(obj, ...args); return isPrimitive(res) ? obj : res; } const isPrimitive = (val) => Object(val)...
# 贴一个每次生成不同的密文同时支持解密的方法。 ### 思路 1. 获取原字符串中每个字符的unicode码 2. 每一位之前插入随机数 3. 合成新的字符串 4. 解码的时候排除掉随机数 ```js function extend(num, len) { let res = `${num}`; while (res.length < len) { res = "0" +...
same issue, i'm using google and it shows "Please login and pass Cloudflare check at chat.openai.com"