boats
Version:
Beautiful Open / Async Template System - Write less yaml with BOATS and Nunjucks.
21 lines (20 loc) • 525 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Breaks strings on = sign and returns as a key value object into the arr arg
* @param val The value to parse
* @param arr Always an array is given
* @returns {*}
*/
exports.default = (val, arr) => {
const parts = val.split('=');
const obj = {};
if (parts.length === 1) {
obj[parts[0].trim()] = true;
}
else {
obj[parts.shift().trim()] = parts.join().trim();
}
arr.push(obj);
return arr;
};