source: frontend/node_modules/axios/lib/platform/node/index.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 837 bytes
Line 
1import crypto from 'crypto';
2import URLSearchParams from './classes/URLSearchParams.js';
3import FormData from './classes/FormData.js';
4
5const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
6
7const DIGIT = '0123456789';
8
9const ALPHABET = {
10 DIGIT,
11 ALPHA,
12 ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT,
13};
14
15const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
16 let str = '';
17 const { length } = alphabet;
18 const randomValues = new Uint32Array(size);
19 crypto.randomFillSync(randomValues);
20 for (let i = 0; i < size; i++) {
21 str += alphabet[randomValues[i] % length];
22 }
23
24 return str;
25};
26
27export default {
28 isNode: true,
29 classes: {
30 URLSearchParams,
31 FormData,
32 Blob: (typeof Blob !== 'undefined' && Blob) || null,
33 },
34 ALPHABET,
35 generateString,
36 protocols: ['http', 'https', 'file', 'data'],
37};
Note: See TracBrowser for help on using the repository browser.