"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmpty = exports.isJsonString = exports.isStringAndNonEmpty = void 0;
const isStringAndNonEmpty = (str) => !!str && typeof str === 'string';
exports.isStringAndNonEmpty = isStringAndNonEmpty;
// taken from https://github.com/douglascrockford/JSON-js/blob/master/json2.js
const isJsonString = (str) => (0, exports.isStringAndNonEmpty)(str) &&
    /^[\],:{}\s]*$/.test(str
        .replace(/\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
        .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/g, ']')
        .replace(/(?:^|:|,)(?:\s*\[)+/g, ''));
exports.isJsonString = isJsonString;
const isEmpty = (v) => v === null ||
    v === undefined ||
    (typeof v === 'string' && v.replace(/ /g, '') === '') ||
    (typeof v === 'object' && Object.keys(v).length === 0);
exports.isEmpty = isEmpty;
//# sourceMappingURL=strings.js.map