UNPKG

myanimelist-api

Version:

A wrapper for Official MyAnimeList REST API V2.

20 lines (17 loc) 493 B
/** * PKCE Compliant Code Generator * */ module.exports = () => { const alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; const numeric = "0123456789"; const special = "-._~"; let text = ""; let possible = alpha + numeric + special; let limit = 128; for (let i = 0; i < limit; i++) { let random = Math.floor(Math.random() * possible.length); text += possible.charAt(random); } return text.join(""); }