json-light
Version:
Allow to extend yaml or json files configuration
31 lines • 843 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonLightServiceImp = void 0;
class JsonLightServiceImp {
json(value) {
if (value === null || value === undefined) {
return false;
}
if (typeof value === 'string') {
if (value.indexOf('{') > -1 || value.indexOf('[') > -1) {
try {
return JSON.parse(value);
}
catch (_a) {
return null;
}
}
else {
return null;
}
}
if (typeof value === 'object') {
return value;
}
else {
return null;
}
}
}
exports.JsonLightServiceImp = JsonLightServiceImp;
//# sourceMappingURL=jsonLightService.js.map