carto.js/test/spec/api/createVis/scenarios/index.js
2020-06-13 18:34:34 +08:00

20 lines
432 B
JavaScript

/**
* Load a vis.json from the scenarios folder
* It returns a copy from the object to easy reusing.
*/
function load (index) {
// We use a switch because our current build system doesn't support variables in the require.
switch (index) {
case 'basic':
return clone(require('./basic_vis.json.js'));
}
}
function clone (object) {
return JSON.parse(JSON.stringify(object));
}
module.exports = {
load: load
};