Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/acc-js-sdk

Package Overview
Dependencies
Maintainers
22
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/acc-js-sdk - npm Package Compare versions

Comparing version 1.1.42 to 1.1.43

2

package.json
{
"name": "@adobe/acc-js-sdk",
"version": "1.1.42",
"version": "1.1.43",
"description": "ACC Javascript SDK",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -199,2 +199,4 @@ /*

let isNumKey = false;
let updateIndex = -1;
if (key) {

@@ -205,4 +207,6 @@ // reserved keyworkds

// already a child with the name => there's a problem with the schema
if (!isReserved && this[key])
throw new Error(`Failed to add element '${key}' to ArrayMap. There's already an item with the same name`);
// it seems the current behavior is to replace the existing item with the new one
if (!isReserved && this[key]) {
updateIndex = this._items.indexOf(this[key]);
}

@@ -227,10 +231,15 @@ // Set key as a enumerable property, so that elements can be accessed by key,

// However, make it non-enumerable to make sure indexes do not show up in a for .. in loop
Object.defineProperty(this, this._items.length, {
const numKey = updateIndex == -1 ? this._items.length : updateIndex;
Object.defineProperty(this, numKey, {
value: value,
writable: false,
enumerable: false,
configurable: true, // Allow to redefine the property later in case there's a duplicate key
});
}
// Add to array and set length
this._items.push(value);
if (updateIndex == -1)
this._items.push(value);
else
this._items[updateIndex] = value;
this.length = this._items.length;

@@ -237,0 +246,0 @@ }

@@ -374,8 +374,24 @@ /*

it("Should not support adding the same key twice", () => {
it("Should support adding the same key twice. The last value overwrites", () => {
const am = new ArrayMap();
am._push("hello", "Hello");
expect(() => { am._push("hello", "World"); }).toThrow("Failed to add element 'hello' to ArrayMap. There's already an item with the same name");
expect(am.length).toBe(1);
am._push("hello", "World");
expect(am.length).toBe(1);
expect(am.get(0)).toBe("World");
});
it("Should support adding the same key twice. The last value overwrites in the middle of the array", () => {
const am = new ArrayMap();
am._push("hello", "Hello");
am._push("cruel", "Cruel");
am._push("world", "World");
expect(am.length).toBe(3);
am._push("cruel", "*cruel*");
expect(am.length).toBe(3);
expect(am.get(0)).toBe("Hello");
expect(am.get(1)).toBe("*cruel*");
expect(am.get(2)).toBe("World");
});
it("Should support missing names", () => {

@@ -382,0 +398,0 @@ const am = new ArrayMap();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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