@tldraw/utils
Advanced tools
Comparing version 3.7.0-internal.acaf9fbbd3cc to 3.7.0
@@ -0,1 +1,28 @@ | ||
# v3.7.0 (Tue Jan 07 2025) | ||
### Release Notes | ||
#### custom sync presence ([#5071](https://github.com/tldraw/tldraw/pull/5071)) | ||
- It's now possible to customise what presence data is synced between clients, or disable presence syncing entirely. | ||
--- | ||
#### 🐛 Bug Fix | ||
- [botcom] stress test fixes [#5126](https://github.com/tldraw/tldraw/pull/5126) ([@ds300](https://github.com/ds300)) | ||
- [botcom] slurp local files on sign in [#5059](https://github.com/tldraw/tldraw/pull/5059) ([@ds300](https://github.com/ds300)) | ||
- [botcom] retry user requests on connection failure [#5073](https://github.com/tldraw/tldraw/pull/5073) ([@ds300](https://github.com/ds300)) | ||
#### 🛠️ API Changes | ||
- custom sync presence [#5071](https://github.com/tldraw/tldraw/pull/5071) ([@SomeHats](https://github.com/SomeHats)) | ||
#### Authors: 2 | ||
- alex ([@SomeHats](https://github.com/SomeHats)) | ||
- David Sheldrick ([@ds300](https://github.com/ds300)) | ||
--- | ||
# v3.6.0 (Wed Dec 04 2024) | ||
@@ -2,0 +29,0 @@ |
@@ -84,2 +84,4 @@ import { default as throttle } from 'lodash.throttle'; | ||
/* Excluded from this release type: ExecutionQueue */ | ||
/* Excluded from this release type: exhaustiveSwitchError */ | ||
@@ -338,2 +340,4 @@ | ||
/* Excluded from this release type: maxBy */ | ||
/* Excluded from this release type: measureAverageDuration */ | ||
@@ -488,2 +492,4 @@ | ||
/* Excluded from this release type: retry */ | ||
/** | ||
@@ -490,0 +496,0 @@ * Seeded random number generator, using [xorshift](https://en.wikipedia.org/wiki/Xorshift). The |
@@ -34,2 +34,3 @@ "use strict"; | ||
DEFAULT_SUPPORT_VIDEO_TYPES: () => import_media.DEFAULT_SUPPORT_VIDEO_TYPES, | ||
ExecutionQueue: () => import_ExecutionQueue.ExecutionQueue, | ||
FileHelpers: () => import_file.FileHelpers, | ||
@@ -88,2 +89,3 @@ Image: () => import_network.Image, | ||
mapObjectMapValues: () => import_object.mapObjectMapValues, | ||
maxBy: () => import_array.maxBy, | ||
measureAverageDuration: () => import_perf.measureAverageDuration, | ||
@@ -105,2 +107,3 @@ measureCbDuration: () => import_perf.measureCbDuration, | ||
restoreUniqueId: () => import_id.restoreUniqueId, | ||
retry: () => import_retry.retry, | ||
rng: () => import_number.rng, | ||
@@ -128,2 +131,3 @@ rotateArray: () => import_array.rotateArray, | ||
var import_lodash2 = __toESM(require("lodash.uniq")); | ||
var import_ExecutionQueue = require("./lib/ExecutionQueue"); | ||
var import_PerformanceTracker = require("./lib/PerformanceTracker"); | ||
@@ -148,2 +152,3 @@ var import_array = require("./lib/array"); | ||
var import_reordering = require("./lib/reordering"); | ||
var import_retry = require("./lib/retry"); | ||
var import_sort = require("./lib/sort"); | ||
@@ -160,5 +165,5 @@ var import_storage = require("./lib/storage"); | ||
"@tldraw/utils", | ||
"3.7.0-internal.acaf9fbbd3cc", | ||
"3.7.0", | ||
"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 = []; |
{ | ||
"name": "@tldraw/utils", | ||
"description": "A tiny little drawing app (private utilities).", | ||
"version": "3.7.0-internal.acaf9fbbd3cc", | ||
"version": "3.7.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "tldraw Inc.", |
@@ -5,2 +5,3 @@ import { registerTldrawLibraryVersion } from './lib/version' | ||
export { default as uniq } from 'lodash.uniq' | ||
export { ExecutionQueue } from './lib/ExecutionQueue' | ||
export { PerformanceTracker } from './lib/PerformanceTracker' | ||
@@ -12,2 +13,3 @@ export { | ||
last, | ||
maxBy, | ||
minBy, | ||
@@ -72,2 +74,3 @@ partition, | ||
} from './lib/reordering' | ||
export { retry } from './lib/retry' | ||
export { sortById } from './lib/sort' | ||
@@ -74,0 +77,0 @@ export { |
@@ -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 |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
532418
194
7968
0