@mometa/materials-resolver
Version:
Resolve materials config
27 lines • 589 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.flatten = exports.toArray = void 0;
function toArray(v) {
if (Array.isArray(v)) {
return v;
}
if (v == null) {
return v;
}
return [v];
}
exports.toArray = toArray;
function flatten(v) {
const newArr = [];
toArray(v).forEach((x) => {
if (Array.isArray(x)) {
newArr.push(...flatten(x));
}
else {
newArr.push(x);
}
});
return newArr;
}
exports.flatten = flatten;
//# sourceMappingURL=to-array.js.map