| 30 | }, {}); |
| 31 | |
| 32 | function loadP5Constructors() { |
| 33 | // Make a list of all p5 classes to be used for argument validation |
| 34 | // This must be done only when everything has loaded otherwise we get |
| 35 | // an empty array |
| 36 | for (let key of Object.keys(p5)) { |
| 37 | // Get a list of all constructors in p5. They are functions whose names |
| 38 | // start with a capital letter |
| 39 | if (typeof p5[key] === 'function' && key[0] !== key[0].toLowerCase()) { |
| 40 | p5Constructors[key] = p5[key]; |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // `constantsMap` maps constants to their values, e.g. |
| 46 | // { |