This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Promise.prototype.chunk = (arr, n) => Array.from({ | |
| length: Math.ceil(arr.length / n) | |
| }, (v, i) => arr.slice(i * n, i * n + n)) | |
| .reduce((ack, c) => ack.then(async () => await Promise.all(c)), Promise.all([])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const squel = require("squel"); | |
| const and = (...args) => squel.expr().and(...args); | |
| const or = (...args) => squel.expr().or(...args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array(100).fill([['l','k'],['u'],['n','k'],['a'],['r']]).map(i=>i.map(j=>j.length>1?j[Math.random()>.5?0:1]:j[0]).join('')).join(' '); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Given a list of fields, such as [ 'a', 'b', 'c' ] and ASTInfo, return an object | |
| on the form {a: true, b: false, c: true } where a property is true if the field is requested through the ASTInfo */ | |
| const getRequestedFields = (fieldNames, info) => { | |
| let { fieldNodes, fragments } = info; | |
| let result = {}; | |
| for (let i = 0; i < fieldNodes.length; i++) { | |
| if (!fieldNodes[i].selectionSet) { | |
| continue; | |
| } | |
| for (let j = 0; j < fieldNodes[i].selectionSet.selections.length; j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You need more Monsquaz |