@stoplight/json
Advanced tools
Comparing version 0.0.43 to 0.0.44-alpha.0
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./json"), exports); | ||
export * from './json'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fast_safe_stringify_1 = require("@stoplight/fast-safe-stringify"); | ||
var _get = require('lodash.get'); | ||
var _trimStart = require('lodash.trimstart'); | ||
var _set = require('lodash.set'); | ||
exports.stringify = function (target, replacer, offset) { | ||
import fastStringify from '@stoplight/fast-safe-stringify'; | ||
const _get = require('lodash.get'); | ||
const _trimStart = require('lodash.trimstart'); | ||
const _set = require('lodash.set'); | ||
export const stringify = (target, replacer, offset) => { | ||
if (!target || typeof target === 'string') | ||
@@ -16,6 +14,6 @@ return target; | ||
// @ts-ignore | ||
return fast_safe_stringify_1.default(target, replacer, offset); | ||
return fastStringify(target, replacer, offset); | ||
} | ||
}; | ||
exports.parse = function (target) { | ||
export const parse = (target) => { | ||
if (typeof target !== 'string') | ||
@@ -25,15 +23,15 @@ return target; | ||
}; | ||
exports.decycle = function (target, replacer) { | ||
export const decycle = (target, replacer) => { | ||
if (typeof target !== 'object') | ||
return target; | ||
fast_safe_stringify_1.default.decycle(target, replacer); | ||
fastStringify.decycle(target, replacer); | ||
return target; | ||
}; | ||
exports.getValue = function (obj, path, defaultVal) { | ||
export const getValue = (obj, path, defaultVal) => { | ||
return _get(obj, path, defaultVal); | ||
}; | ||
exports.setValue = function (obj, path, value) { | ||
export const setValue = (obj, path, value) => { | ||
return _set(obj, path, value); | ||
}; | ||
exports.startsWith = function (source, val) { | ||
export const startsWith = (source, val) => { | ||
if (source instanceof Array) { | ||
@@ -43,7 +41,7 @@ if (val instanceof Array) { | ||
return false; | ||
for (var i in val) { | ||
for (const i in val) { | ||
if (!val.hasOwnProperty(i)) | ||
continue; | ||
var si = parseInt(source[i]); | ||
var vi = parseInt(val[i]); | ||
const si = parseInt(source[i]); | ||
const vi = parseInt(val[i]); | ||
// support if numeric index is stringified in one but not the other | ||
@@ -76,3 +74,3 @@ if (!isNaN(si) || !isNaN(vi)) { | ||
*/ | ||
exports.trimStart = function (target, elems) { | ||
export const trimStart = (target, elems) => { | ||
if (typeof target === 'string') { | ||
@@ -83,4 +81,4 @@ return _trimStart(target, elems); | ||
return target; | ||
var toRemove = 0; | ||
for (var i in target) { | ||
let toRemove = 0; | ||
for (const i in target) { | ||
if (!target.hasOwnProperty(i)) | ||
@@ -87,0 +85,0 @@ continue; |
{ | ||
"name": "@stoplight/json", | ||
"version": "0.0.43", | ||
"version": "0.0.44-alpha.0", | ||
"description": "Stoplight json type and interface definitions.", | ||
"main": "lib/index.js", | ||
"module": "lib/index.es.js", | ||
"jsnext:main": "lib/index.es.js", | ||
"sideEffects": false, | ||
"author": "Stoplight <dev@stoplight.io>", | ||
@@ -33,3 +32,3 @@ "homepage": "https://stoplight.io", | ||
}, | ||
"gitHead": "863127087b0dcfaebf40e7c0ed86bedcd2835468" | ||
"gitHead": "ba495e3f8984dd68df510ccfbc2d8401515c4161" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7600
100