@stoplight/common
Advanced tools
Comparing version 0.0.29 to 0.0.30-0
@@ -7,1 +7,7 @@ export declare const stringify: (target: any, replacer?: ((key: any, value: any) => any) | undefined, offset?: number | undefined) => any; | ||
export declare const startsWith: (source: string | any[], val: string | any[]) => boolean; | ||
/** | ||
* Removes elems from target, matched in order, starting on the left | ||
* trimStart([1, 2, 3], [1, 2]) === [3] | ||
* trimStart([1, 2, 3], [999, 2]) === [1, 2, 3] since source[0] does not equal elems[0] | ||
*/ | ||
export declare const trimStart: (target: string | any[], elems: string | any[]) => any; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var _get = require('lodash.get'); | ||
var _trimStart = require('lodash.trimstart'); | ||
var _set = require('lodash.set'); | ||
@@ -68,2 +69,23 @@ exports.stringify = function (target, replacer, offset) { | ||
}; | ||
/** | ||
* Removes elems from target, matched in order, starting on the left | ||
* trimStart([1, 2, 3], [1, 2]) === [3] | ||
* trimStart([1, 2, 3], [999, 2]) === [1, 2, 3] since source[0] does not equal elems[0] | ||
*/ | ||
exports.trimStart = function (target, elems) { | ||
if (typeof target === 'string') { | ||
return _trimStart(target, elems); | ||
} | ||
if (!elems || !elems.length || !(elems instanceof Array)) | ||
return target; | ||
var toRemove = 0; | ||
for (var i in target) { | ||
if (!target.hasOwnProperty(i)) | ||
continue; | ||
if (target[i] !== elems[i]) | ||
break; | ||
toRemove++; | ||
} | ||
return target.slice(toRemove); | ||
}; | ||
//# sourceMappingURL=json.js.map |
@@ -86,3 +86,3 @@ import { ILocation, IUriComponents } from './types'; | ||
* | ||
* @param skipEncoding Do not encode the result, default is `false` | ||
* @param skipEncoding Do not encode the result, default is `true` | ||
*/ | ||
@@ -89,0 +89,0 @@ toString(skipEncoding?: boolean): string; |
@@ -430,6 +430,6 @@ "use strict"; | ||
* | ||
* @param skipEncoding Do not encode the result, default is `false` | ||
* @param skipEncoding Do not encode the result, default is `true` | ||
*/ | ||
URI.prototype.toString = function (skipEncoding) { | ||
if (skipEncoding === void 0) { skipEncoding = false; } | ||
if (skipEncoding === void 0) { skipEncoding = true; } | ||
if (!skipEncoding) { | ||
@@ -471,3 +471,3 @@ if (!this._formatted) { | ||
fsPath: this.fsPath, | ||
external: this.toString(), | ||
external: this.toString(true), | ||
$mid: 1, | ||
@@ -474,0 +474,0 @@ }; |
{ | ||
"name": "@stoplight/common", | ||
"version": "0.0.29", | ||
"version": "0.0.30-0", | ||
"description": "Stoplight common type and interface definitions.", | ||
@@ -28,5 +28,6 @@ "main": "lib/index.js", | ||
"lodash.set": "4.x.x", | ||
"lodash.trimstart": "4.x.x", | ||
"tslib": "1.x.x" | ||
}, | ||
"gitHead": "a6aa6007e3ed76ecbc3c5f4f7f16fb2a0ddfb5ec" | ||
"gitHead": "a98c777087af5c29587ae62168ed8c0196b3efd6" | ||
} |
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
86408
1597
7
+ Addedlodash.trimstart@4.x.x
+ Addedlodash.trimstart@4.5.1(transitive)