MCPcopy
hub / github.com/e-oj/Magic-Grid / checkParams

Function checkParams

src/utils.js:11–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9 * @param config - configuration object
10 */
11const checkParams = config => {
12 const DEFAULT_GUTTER = 25;
13 const booleanProps = ["useTransform", "center"];
14
15
16 if (!config) {
17 throw new Error("No config object has been provided.");
18 }
19
20 for(let prop of booleanProps){
21 if(typeof config[prop] !== "boolean"){
22 config[prop] = true;
23 }
24 }
25
26
27 if(typeof config.gutter !== "number"){
28 config.gutter = DEFAULT_GUTTER;
29 }
30
31 if (!config.container) error("container");
32 if (!config.items && !config.static) error("items or static");
33};
34
35
36/**

Callers 1

constructorMethod · 0.85

Calls 1

errorFunction · 0.85

Tested by

no test coverage detected