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

@cloudinary-util/util

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudinary-util/util - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

33

./dist/index.js

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

objectHasKey: () => objectHasKey,
parseUrl: () => parseUrl
parseUrl: () => parseUrl,
sortByKey: () => sortByKey
});

@@ -72,2 +73,29 @@ module.exports = __toCommonJS(src_exports);

}
function sortByKey(array = [], key, type = "asc") {
function compare(a, b) {
let keyA = a[key];
let keyB = b[key];
if (typeof keyA === "string") {
keyA = keyA.toLowerCase();
}
if (typeof keyB === "string") {
keyB = keyB.toLowerCase();
}
if (keyA < keyB) {
return -1;
}
if (keyA > keyB) {
return 1;
}
return 0;
}
let newArray = [...array];
if (typeof key !== "string")
return newArray;
newArray = newArray.sort(compare);
if (type === "desc") {
return newArray.reverse();
}
return newArray;
}
// Annotate the CommonJS export names for ESM import in node:

@@ -79,3 +107,4 @@ 0 && (module.exports = {

objectHasKey,
parseUrl
parseUrl,
sortByKey
});

@@ -44,3 +44,8 @@ /**

declare function objectHasKey<T>(obj: T, key: PropertyKey): key is keyof T;
/**
* sortByKey
* @description Sort the given array by the key of an object
*/
declare function sortByKey(array: object[] | undefined, key: string, type?: string): object[];
export { encodeBase64, getPublicId, getTransformations, objectHasKey, parseUrl };
export { encodeBase64, getPublicId, getTransformations, objectHasKey, parseUrl, sortByKey };

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

objectHasKey: () => objectHasKey,
parseUrl: () => parseUrl
parseUrl: () => parseUrl,
sortByKey: () => sortByKey
});

@@ -72,2 +73,29 @@ module.exports = __toCommonJS(src_exports);

}
function sortByKey(array = [], key, type = "asc") {
function compare(a, b) {
let keyA = a[key];
let keyB = b[key];
if (typeof keyA === "string") {
keyA = keyA.toLowerCase();
}
if (typeof keyB === "string") {
keyB = keyB.toLowerCase();
}
if (keyA < keyB) {
return -1;
}
if (keyA > keyB) {
return 1;
}
return 0;
}
let newArray = [...array];
if (typeof key !== "string")
return newArray;
newArray = newArray.sort(compare);
if (type === "desc") {
return newArray.reverse();
}
return newArray;
}
// Annotate the CommonJS export names for ESM import in node:

@@ -79,3 +107,4 @@ 0 && (module.exports = {

objectHasKey,
parseUrl
parseUrl,
sortByKey
});

2

package.json
{
"name": "@cloudinary-util/util",
"version": "1.2.1",
"version": "1.2.2",
"main": "./dist/index.js",

@@ -5,0 +5,0 @@ "module": "./dist/index.mjs",

Sorry, the diff of this file is not supported yet

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