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

@bedrock-ui/utils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bedrock-ui/utils - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

3

lib/cjs/utils/keyBy/keyBy.js

@@ -7,2 +7,5 @@ "use strict";

array.forEach((element) => {
if (map.has(element[property])) {
console.warn(`duplicate key for keyBy: "${element[property]}" already exists in the map`);
}
map.set(element[property], element);

@@ -9,0 +12,0 @@ });

3

lib/cjs/utils/orderBy/orderBy.d.ts

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

export declare function orderBy<T>(array: T, property: string): T;
import type { TypeofArray } from '../../types/array';
export declare function orderBy<T extends TypeofArray<T>[], P extends keyof TypeofArray<T>>(array: T, property: P): T[number][];

@@ -5,4 +5,17 @@ "use strict";

function orderBy(array, property) {
return array;
return [...array].sort((a, b) => {
const aValue = a[property];
const bValue = b[property];
if (typeof aValue === 'string' && typeof bValue === 'string') {
return aValue.localeCompare(bValue, 'en', { sensitivity: 'base' });
}
if (aValue < bValue) {
return -1;
}
if (aValue > bValue) {
return 1;
}
return 0;
});
}
exports.orderBy = orderBy;
export function keyBy(array, property) {
const map = new Map();
array.forEach((element) => {
if (map.has(element[property])) {
console.warn(`duplicate key for keyBy: "${element[property]}" already exists in the map`);
}
map.set(element[property], element);

@@ -5,0 +8,0 @@ });

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

export declare function orderBy<T>(array: T, property: string): T;
import type { TypeofArray } from '../../types/array';
export declare function orderBy<T extends TypeofArray<T>[], P extends keyof TypeofArray<T>>(array: T, property: P): T[number][];
export function orderBy(array, property) {
return array;
return [...array].sort((a, b) => {
const aValue = a[property];
const bValue = b[property];
if (typeof aValue === 'string' && typeof bValue === 'string') {
return aValue.localeCompare(bValue, 'en', { sensitivity: 'base' });
}
if (aValue < bValue) {
return -1;
}
if (aValue > bValue) {
return 1;
}
return 0;
});
}
{
"name": "@bedrock-ui/utils",
"version": "0.0.7",
"version": "0.0.8",
"description": "Bedrock UI Utils",

@@ -35,4 +35,5 @@ "author": "Matthew Wolfe",

"test": "jest",
"test:coverage": "jest --coverage",
"typecheck": "tsc --noEmit"
}
}
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