-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerators.js
More file actions
25 lines (24 loc) · 775 Bytes
/
Copy pathgenerators.js
File metadata and controls
25 lines (24 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use-strict';
class TooManyBoxesError extends Error {}
/*
Pass functions as arguments through an options object.
Allows for customization of the generated boxes and
the customization of generated boxes' content
*/
module.exports = {
// boxAmount is the amount of boxes you want to generate
engines: {
generateBoxes: function ({ boxAmount, boxOptions }) {
if (boxAmount > 1000) throw new TooManyBoxesError('You cannot create more than 1000 boxes') // You cannot create more than 1000 boxes
let boxArr = [];
let token = boxAmount;
do {
boxArr[token] = boxOptions();
boxArr[token].unlock();
boxArr[token].lock();
token--;
} while (token >= 0);
return boxArr;
},
},
};