Socket
Socket
Sign inDemoInstall

@arkecosystem/utils

Package Overview
Dependencies
5
Maintainers
6
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.6 to 1.1.7

dist/get-path-segments.d.ts

7

CHANGELOG.md

@@ -8,2 +8,8 @@ # Changelog

## [1.1.7] - 2019-11-19
## Fixed
- Add `deepmerge` as dependency
## [1.1.6] - 2019-10-25

@@ -433,2 +439,3 @@

[1.1.7]: https://github.com/ArkEcosystem/utils/compare/1.1.6...1.1.7
[1.1.6]: https://github.com/ArkEcosystem/utils/compare/1.1.5...1.1.6

@@ -435,0 +442,0 @@ [1.1.5]: https://github.com/ArkEcosystem/utils/compare/1.1.4...1.1.5

15

dist/get.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const internal_1 = require("./internal");
const get_path_segments_1 = require("./get-path-segments");
const is_enumerable_1 = require("./is-enumerable");
const is_object_1 = require("./is-object");

@@ -10,12 +11,14 @@ const is_string_1 = require("./is-string");

}
const pathArray = internal_1.castPath(path);
for (let i = 0; i < pathArray.length; i++) {
if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) {
const pathSegments = get_path_segments_1.getPathSegments(path);
for (let i = 0; i < pathSegments.length; i++) {
if (!is_enumerable_1.isEnumerable(object, pathSegments[i])) {
return defaultValue;
}
object = object[pathArray[i]];
object = object[pathSegments[i]];
if (object === undefined || object === null) {
if (i !== pathArray.length - 1) {
/* istanbul ignore else */
if (i !== pathSegments.length - 1) {
return defaultValue;
}
/* istanbul ignore next */
break;

@@ -22,0 +25,0 @@ }

10

dist/has.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const internal_1 = require("./internal");
const get_path_segments_1 = require("./get-path-segments");
const is_object_1 = require("./is-object");

@@ -10,11 +10,11 @@ const is_string_1 = require("./is-string");

}
const pathArray = internal_1.castPath(path);
for (let i = 0; i < pathArray.length; i++) {
const pathSegments = get_path_segments_1.getPathSegments(path);
for (let i = 0; i < pathSegments.length; i++) {
if (!is_object_1.isObject(object)) {
return false;
}
if (!(pathArray[i] in object)) {
if (!(pathSegments[i] in object)) {
return false;
}
object = object[pathArray[i]];
object = object[pathSegments[i]];
}

@@ -21,0 +21,0 @@ return true;

@@ -38,2 +38,3 @@ export * from "./internal";

export * from "./format-string";
export * from "./get-path-segments";
export * from "./get-type";

@@ -69,2 +70,3 @@ export * from "./get";

export * from "./is-empty";
export * from "./is-enumerable";
export * from "./is-equal";

@@ -102,2 +104,3 @@ export * from "./is-error";

export * from "./is-undefined";
export * from "./is-uri";
export * from "./is-url";

@@ -133,2 +136,3 @@ export * from "./is-weak-map";

export * from "./parse-git-url";
export * from "./parse-uri";
export * from "./parse";

@@ -135,0 +139,0 @@ export * from "./partition";

@@ -52,2 +52,3 @@ "use strict";

__export(require("./format-string"));
__export(require("./get-path-segments"));
__export(require("./get-type"));

@@ -83,2 +84,3 @@ __export(require("./get"));

__export(require("./is-empty"));
__export(require("./is-enumerable"));
__export(require("./is-equal"));

@@ -116,2 +118,3 @@ __export(require("./is-error"));

__export(require("./is-undefined"));
__export(require("./is-uri"));
__export(require("./is-url"));

@@ -147,2 +150,3 @@ __export(require("./is-weak-map"));

__export(require("./parse-git-url"));
__export(require("./parse-uri"));
__export(require("./parse"));

@@ -149,0 +153,0 @@ __export(require("./partition"));

@@ -1,3 +0,2 @@

export * from "./cast-path";
export * from "./compound-words";
export * from "./types";

@@ -6,4 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./cast-path"));
__export(require("./compound-words"));
//# sourceMappingURL=index.js.map

@@ -1,3 +0,1 @@

/// <reference types="node" />
import { Binary } from "crypto";
export declare const safeEqual: (a: Binary, b: Binary) => boolean;
export declare const safeEqual: (a: any, b: any) => boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const has_property_1 = require("./has-property");
const internal_1 = require("./internal");
const get_path_segments_1 = require("./get-path-segments");
const is_object_1 = require("./is-object");
const is_string_1 = require("./is-string");
exports.set = (object, path, value) => {
if (!is_object_1.isObject(object)) {
if (!is_object_1.isObject(object) || !is_string_1.isString(path)) {
return false;
}
const fragments = internal_1.castPath(path);
let index = 0;
const length = fragments.length;
while (object != null && index < length) {
const key = fragments[index++];
if (index === length) {
object[key] = value;
break;
const pathSegments = get_path_segments_1.getPathSegments(path);
for (let i = 0; i < pathSegments.length; i++) {
const pathSegment = pathSegments[i];
if (!is_object_1.isObject(object[pathSegment])) {
object[pathSegment] = {};
}
if (!has_property_1.hasProperty(object, key)) {
object[key] = {};
if (i === pathSegments.length - 1) {
object[pathSegment] = value;
}
object = object[key];
object = object[pathSegment];
}
return !!object;
return true;
};
//# sourceMappingURL=set.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const internal_1 = require("./internal");
const is_empty_1 = require("./is-empty");
const get_path_segments_1 = require("./get-path-segments");
const is_object_1 = require("./is-object");
const is_string_1 = require("./is-string");
exports.unset = (object, path) => {
if (is_empty_1.isEmpty(object)) {
if (!is_object_1.isObject(object) || !is_string_1.isString(path)) {
return false;
}
const fragments = internal_1.castPath(path);
let index = 0;
const length = fragments.length;
while (object != null && index < length) {
const key = fragments[index++];
if (index === length) {
break;
const pathSegments = get_path_segments_1.getPathSegments(path);
for (let i = 0; i < pathSegments.length; i++) {
const pathSegment = pathSegments[i];
if (i === pathSegments.length - 1) {
delete object[pathSegment];
return true;
}
object = object[key];
object = object[pathSegment];
if (!is_object_1.isObject(object)) {
return false;
}
}
return object === null || delete object[fragments[index - 1]];
/* istanbul ignore next */
return false;
};
//# sourceMappingURL=unset.js.map
{
"name": "@arkecosystem/utils",
"description": "Performance oriented implementations of commonly used functions in TypeScript.",
"version": "1.1.6",
"version": "1.1.7",
"contributors": [

@@ -30,2 +30,3 @@ "Brian Faust <brian@ark.io>",

"@hapi/bourne": "^1.3.2",
"deepmerge": "^4.2.2",
"fast-copy": "^2.0.3",

@@ -57,7 +58,6 @@ "fast-deep-equal": "^2.0.1",

"cross-env": "^6.0.3",
"deepmerge": "^4.1.1",
"del-cli": "^3.0.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-jest": "^22.19.0",
"eslint-plugin-jest": "^23.0.0",
"eslint-plugin-prettier": "^3.1.1",

@@ -64,0 +64,0 @@ "eslint-plugin-simple-import-sort": "^4.0.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc