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

@tldraw/utils

Package Overview
Dependencies
Maintainers
4
Versions
2086
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tldraw/utils - npm Package Compare versions

Comparing version 3.7.0-canary.9aeff86e695c to 3.7.0-canary.a152d144c038

2

dist-cjs/index.d.ts

@@ -339,2 +339,4 @@ import { default as throttle } from 'lodash.throttle';

/* Excluded from this release type: maxBy */
/* Excluded from this release type: measureAverageDuration */

@@ -341,0 +343,0 @@

3

dist-cjs/index.js

@@ -88,2 +88,3 @@ "use strict";

mapObjectMapValues: () => import_object.mapObjectMapValues,
maxBy: () => import_array.maxBy,
measureAverageDuration: () => import_perf.measureAverageDuration,

@@ -160,5 +161,5 @@ measureCbDuration: () => import_perf.measureCbDuration,

"@tldraw/utils",
"3.7.0-canary.9aeff86e695c",
"3.7.0-canary.a152d144c038",
"cjs"
);
//# sourceMappingURL=index.js.map

@@ -25,2 +25,3 @@ "use strict";

last: () => last,
maxBy: () => maxBy,
minBy: () => minBy,

@@ -64,2 +65,14 @@ partition: () => partition,

}
function maxBy(arr, fn) {
let max;
let maxVal = -Infinity;
for (const item of arr) {
const val = fn(item);
if (val > maxVal) {
max = item;
maxVal = val;
}
}
return max;
}
function partition(arr, predicate) {

@@ -66,0 +79,0 @@ const satisfies = [];

@@ -52,3 +52,6 @@ "use strict";

}
close() {
this.queue = [];
}
}
//# sourceMappingURL=ExecutionQueue.js.map
{
"name": "@tldraw/utils",
"description": "A tiny little drawing app (private utilities).",
"version": "3.7.0-canary.9aeff86e695c",
"version": "3.7.0-canary.a152d144c038",
"author": {

@@ -6,0 +6,0 @@ "name": "tldraw Inc.",

@@ -12,2 +12,3 @@ import { registerTldrawLibraryVersion } from './lib/version'

last,
maxBy,
minBy,

@@ -14,0 +15,0 @@ partition,

@@ -52,2 +52,16 @@ /**

/** @internal */
export function maxBy<T>(arr: readonly T[], fn: (item: T) => number): T | undefined {
let max: T | undefined
let maxVal: number = -Infinity
for (const item of arr) {
const val = fn(item)
if (val > maxVal) {
max = item
maxVal = val
}
}
return max
}
/**

@@ -54,0 +68,0 @@ * Partitions an array into two arrays, one with items that satisfy the predicate, and one with

@@ -34,2 +34,6 @@ import { sleep } from './control'

}
close() {
this.queue = []
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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