UNPKG

qcobjects

Version:

QCObjects is an Open-source framework that empowers full-stack developers to make micro-services and micro-frontends into an N-Tier architecture.

12 lines (10 loc) 562 B
import { _Crypt } from "./Crypt"; export const shortCode = (): string => { const length = 1000; const code1 = _Crypt.encrypt((Math.random() * length).toString().replace(".", ""), (new Date()).getTime().toString()); const code2 = _Crypt.encrypt((Math.random() * length).toString().replace(".", ""), (new Date((new Date()).getTime() - 1000 * 1000)).getTime().toString()); const shortCode = [...code2].map((o1: any, index: any): any => { return [...code1][index] === o1 ? null : o1; }).filter((c: any) => c !== null).join(""); return shortCode; };