Sha256: cc4e72d22f7d521945300dc4d3f1b7c58acb5b4d5bdb481d49bb111272fbb2d2
Contents?: true
Size: 436 Bytes
Versions: 88
Compression:
Stored size: 436 Bytes
Contents
'use strict'; function parseString(str) { try { if (str[0] === '"') { return JSON.parse(str); } if (str[0] === "'" && str.substr(str.length - 1) === "'") { return parseString( str .replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x)) .replace(/^'|'$/g, '"') ); } return JSON.parse('"' + str + '"'); } catch (e) { return str; } } module.exports = parseString;
Version data entries
88 entries across 28 versions & 9 rubygems