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

@wix/sdk-runtime

Package Overview
Dependencies
Maintainers
21
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/sdk-runtime - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

33

build/transformations/transform-paths.js
function transformPath(obj, { path, isRepeated, isMap, }, transformFn) {
const pathParts = path.split('.');
if (pathParts.length === 1) {
if (!(path in obj)) {
// we can assume that the current obj is a map and we need
// to transform inside the values of the map
obj = Object.fromEntries(Object.entries(obj).map(([key, value]) => [
key,
transformPath(value, { path, isRepeated, isMap }, transformFn),
]));
}
else {
obj[path] = isRepeated
? obj[path].map(transformFn)
: isMap
? Object.fromEntries(Object.entries(obj[path]).map(([key, value]) => [key, transformFn(value)]))
: transformFn(obj[path]);
}
if (pathParts.length === 1 && path in obj) {
obj[path] = isRepeated
? obj[path].map(transformFn)
: isMap
? Object.fromEntries(Object.entries(obj[path]).map(([key, value]) => [key, transformFn(value)]))
: transformFn(obj[path]);
return obj;
}
const [first, ...rest] = pathParts;
if (!(first in obj)) {
// we can assume that the current obj is a map and we need
// to find the rest of the path inside the values of the map
obj = Object.fromEntries(Object.entries(obj).map(([key, value]) => [
if (first.endsWith('{}')) {
const cleanPath = first.slice(0, -2);
obj[cleanPath] = Object.fromEntries(Object.entries(obj[cleanPath]).map(([key, value]) => [
key,
transformPath(value, { path, isRepeated, isMap }, transformFn),
transformPath(value, { path: rest.join('.'), isRepeated, isMap }, transformFn),
]));

@@ -33,3 +22,3 @@ }

}
else {
else if (first in obj) {
obj[first] = transformPath(obj[first], { path: rest.join('.'), isRepeated, isMap }, transformFn);

@@ -36,0 +25,0 @@ }

@@ -6,27 +6,16 @@ "use strict";

const pathParts = path.split('.');
if (pathParts.length === 1) {
if (!(path in obj)) {
// we can assume that the current obj is a map and we need
// to transform inside the values of the map
obj = Object.fromEntries(Object.entries(obj).map(([key, value]) => [
key,
transformPath(value, { path, isRepeated, isMap }, transformFn),
]));
}
else {
obj[path] = isRepeated
? obj[path].map(transformFn)
: isMap
? Object.fromEntries(Object.entries(obj[path]).map(([key, value]) => [key, transformFn(value)]))
: transformFn(obj[path]);
}
if (pathParts.length === 1 && path in obj) {
obj[path] = isRepeated
? obj[path].map(transformFn)
: isMap
? Object.fromEntries(Object.entries(obj[path]).map(([key, value]) => [key, transformFn(value)]))
: transformFn(obj[path]);
return obj;
}
const [first, ...rest] = pathParts;
if (!(first in obj)) {
// we can assume that the current obj is a map and we need
// to find the rest of the path inside the values of the map
obj = Object.fromEntries(Object.entries(obj).map(([key, value]) => [
if (first.endsWith('{}')) {
const cleanPath = first.slice(0, -2);
obj[cleanPath] = Object.fromEntries(Object.entries(obj[cleanPath]).map(([key, value]) => [
key,
transformPath(value, { path, isRepeated, isMap }, transformFn),
transformPath(value, { path: rest.join('.'), isRepeated, isMap }, transformFn),
]));

@@ -37,3 +26,3 @@ }

}
else {
else if (first in obj) {
obj[first] = transformPath(obj[first], { path: rest.join('.'), isRepeated, isMap }, transformFn);

@@ -40,0 +29,0 @@ }

{
"name": "@wix/sdk-runtime",
"version": "0.2.5",
"version": "0.2.6",
"license": "UNLICENSED",

@@ -82,3 +82,3 @@ "sideEffects": false,

},
"falconPackageHash": "4065860b3b32a19242e9d7552a2dce5560b3abc84701818688dfc6fb"
"falconPackageHash": "926ce38187a1c4338b958073dbcc7c3979c2d010bfef043024e34687"
}
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