UNPKG

sussy-util

Version:
14 lines (13 loc) 359 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * @param {string} str The string to convert * @returns {Object} The converted string value */ exports.default = (str) => { const obj = JSON.parse(str); if (typeof obj !== 'object') { throw new TypeError('Invalid JSON string passed'); } return obj; };