New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@finnair/path

Package Overview
Dependencies
Maintainers
4
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finnair/path - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [4.0.0](https://github.com/finnair/v-validation/compare/v3.2.0...v4.0.0) (2022-11-07)
**Note:** Version bump only for package @finnair/path
# [3.1.0](https://github.com/finnair/v-validation/compare/v3.0.0...v3.1.0) (2022-10-24)

@@ -8,0 +16,0 @@

20

dist/Path.js

@@ -59,7 +59,7 @@ "use strict";

}
let index = -1;
let pathIndex = -1;
const _root = toObject(root, this.path);
let current = _root;
for (index = 0; index < this.path.length - 1 && current; index++) {
const component = this.path[index];
for (pathIndex = 0; pathIndex < this.path.length - 1 && current; pathIndex++) {
const component = this.path[pathIndex];
const child = toObject(current[component], this.path);

@@ -71,7 +71,15 @@ current[component] = child;

if (current !== undefined) {
delete current[this.path[index]];
delete current[this.path[pathIndex]];
// Truncate undefined tail of an array
if (Array.isArray(current)) {
let i = current.length - 1;
while (i >= 0 && current[i] === undefined) {
i--;
}
current.length = i + 1;
}
}
}
else {
current[this.path[index]] = value;
current[this.path[pathIndex]] = value;
}

@@ -84,3 +92,3 @@ return _root;

else if (value !== undefined) {
if (typeof path[index + 1] === 'number') {
if (typeof path[pathIndex + 1] === 'number') {
return [];

@@ -87,0 +95,0 @@ }

{
"name": "@finnair/path",
"version": "3.1.0",
"version": "4.0.0",
"private": false,

@@ -25,3 +25,3 @@ "description": "Simple object path as array of strings and numbers",

},
"gitHead": "5182a63fa61cc1f5c8991e1482c5bbffe14798c3"
"gitHead": "d6540b51c4f1c57563602f66bd3157637703529b"
}

@@ -67,2 +67,5 @@ # Path

NOTE: Updating an array with `Path.set` will truncate possible undefined values from the end of the array. This allows
removing trailing elements without leaving undefined elements in place.
### Include/Exclude Projection

@@ -96,5 +99,3 @@

// Constructing with fluent syntax
Path.of()
.property('array')
.index(0); // $.array[0]
Path.of().property('array').index(0); // $.array[0]

@@ -124,2 +125,5 @@ // Concatenating Paths

// Trailing undefined elements will be removed from an array (i.e. array is resized)
Path.of('array', 2).set({ array: [1, undefined, 3] }, undefined); // { array: [1] } where array.length === 1
// toJSON() returns JsonPath compatible serialization

@@ -126,0 +130,0 @@ Path.of('array', 0, 'property with spaces').toJSON(); // $.array[0]["property with spaces"]

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc