Skip to content

Instantly share code, notes, and snippets.

View 117's full-sized avatar
🥰
egirl 4 vbux

uwu 117

🥰
egirl 4 vbux
View GitHub Profile
@aqilc
aqilc / fetch.js
Created July 11, 2020 02:43
A simple fetch module.
// HTTPS API
import https from "https";
/**
* Executes an HTTP request
* @param {string | URL} url The url
* @returns {Promise<any>} The response
*/
export default (url, { method, headers, data } = {}) => new Promise((res, rej) => {
import crypto from 'crypto'
// WARNING: DO NOT CHANGE THESE WITH OPEN POSITIONS
const PREFIX = 'X'
const CHARSET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ'
const RANDOM_LENGTH = 16
const EXPRESSION = new RegExp(`^${PREFIX}-[0-9A-Z]{${RANDOM_LENGTH}}-\\d+$`)
// UNIQ-SEQ
export class PositionId {