You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ass/zws.js

12 lines
304 B

4 years ago
const { randomBytes } = require('crypto');
const zeroWidthCap = '\u200B';
const zeroWidthChars = [
zeroWidthCap,
'\u200C',
'\u200D',
'\u2060',
'\u180E'
];
module.exports = (size) => [...randomBytes(size)].map(byte => zeroWidthChars[+byte % zeroWidthChars.length]).join('').slice(1) + zeroWidthCap;