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

@tldraw/utils

Package Overview
Dependencies
Maintainers
4
Versions
2183
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 2.0.0-canary.fa74666a to 2.0.0-canary.fadf4f301

29

CHANGELOG.md

@@ -0,1 +1,30 @@

# v2.0.0-alpha.12 (Mon Apr 03 2023)
#### 🐛 Bug Fix
- Make sure all types and build stuff get run in CI [#1548](https://github.com/tldraw/tldraw-lite/pull/1548) ([@SomeHats](https://github.com/SomeHats))
- make sure error annotations can't throw [#1550](https://github.com/tldraw/tldraw-lite/pull/1550) ([@SomeHats](https://github.com/SomeHats))
- Fix an error with importing certain files. [#1547](https://github.com/tldraw/tldraw-lite/pull/1547) ([@MitjaBezensek](https://github.com/MitjaBezensek))
- add pre-commit api report generation [#1517](https://github.com/tldraw/tldraw-lite/pull/1517) ([@SomeHats](https://github.com/SomeHats))
- [chore] restore api extractor [#1500](https://github.com/tldraw/tldraw-lite/pull/1500) ([@steveruizok](https://github.com/steveruizok))
- [improvement] docs / api cleanup [#1491](https://github.com/tldraw/tldraw-lite/pull/1491) ([@steveruizok](https://github.com/steveruizok))
- David/publish good [#1488](https://github.com/tldraw/tldraw-lite/pull/1488) ([@ds300](https://github.com/ds300))
- [chore] alpha 10 [#1486](https://github.com/tldraw/tldraw-lite/pull/1486) ([@ds300](https://github.com/ds300))
- [chore] bump for alpha 8 [#1485](https://github.com/tldraw/tldraw-lite/pull/1485) ([@steveruizok](https://github.com/steveruizok))
- stop using broken-af turbo for publishing [#1476](https://github.com/tldraw/tldraw-lite/pull/1476) ([@ds300](https://github.com/ds300))
- [chore] add canary release script [#1423](https://github.com/tldraw/tldraw-lite/pull/1423) ([@ds300](https://github.com/ds300) [@steveruizok](https://github.com/steveruizok))
- [chore] upgrade yarn [#1430](https://github.com/tldraw/tldraw-lite/pull/1430) ([@ds300](https://github.com/ds300))
- repo cleanup [#1426](https://github.com/tldraw/tldraw-lite/pull/1426) ([@steveruizok](https://github.com/steveruizok))
- Vscode extension [#1253](https://github.com/tldraw/tldraw-lite/pull/1253) ([@steveruizok](https://github.com/steveruizok) [@MitjaBezensek](https://github.com/MitjaBezensek) [@orangemug](https://github.com/orangemug))
#### Authors: 5
- alex ([@SomeHats](https://github.com/SomeHats))
- David Sheldrick ([@ds300](https://github.com/ds300))
- Mitja Bezenšek ([@MitjaBezensek](https://github.com/MitjaBezensek))
- Orange Mug ([@orangemug](https://github.com/orangemug))
- Steve Ruiz ([@steveruizok](https://github.com/steveruizok))
---
# @tldraw/utils

@@ -2,0 +31,0 @@

24

dist-cjs/index.d.ts

@@ -13,2 +13,3 @@ /* Excluded from this release type: annotateError */

* @example
*
* ```ts

@@ -18,3 +19,2 @@ * const A = debounce(myFunction, 1000)

*
*
* @public

@@ -39,2 +39,3 @@ * @see source - https://gist.github.com/ca0v/73a31f57b397606c9813472f7493a940

* @example
*
* ```ts

@@ -52,3 +53,3 @@ * const A = deepCopy({ a: 1, b: { c: 2 } })

declare type ErrorAnnotations = {
tags: Record<string, number | string | boolean | bigint | symbol | null | undefined>;
tags: Record<string, bigint | boolean | null | number | string | symbol | undefined>;
extras: Record<string, unknown>;

@@ -71,9 +72,10 @@ };

* @example
*
* ```ts
* const A = getFirstItem(new Set([1, 2, 3])) // 1
* const B = getFirstItem(
* new Map([
* ['a', 1],
* ['b', 2],
* ])
* new Map([
* ['a', 1],
* ['b', 2],
* ])
* ) // 1

@@ -85,6 +87,7 @@ * ```

*/
export declare function getFirstFromIterable<T = unknown>(set: Set<T> | Map<any, T>): T;
export declare function getFirstFromIterable<T = unknown>(set: Map<any, T> | Set<T>): T;
/**
* Hash a string using the FNV-1a algorithm.
*
* @public

@@ -96,2 +99,3 @@ */

* Hash a string using the FNV-1a algorithm.
*
* @public

@@ -135,2 +139,3 @@ */

* @example
*
* ```ts

@@ -153,2 +158,3 @@ * const A = lerp(0, 1, 0.5)

* @example
*
* ```ts

@@ -185,3 +191,3 @@ * const A = modulate(0, [0, 1], [0, 100])

/** @public */
export declare type Result<T, E> = OkResult<T> | ErrorResult<E>;
export declare type Result<T, E> = ErrorResult<E> | OkResult<T>;

@@ -199,2 +205,3 @@ /** @public */

* Adapted from [seedrandom](https://github.com/davidbau/seedrandom).
*
* @public

@@ -219,2 +226,3 @@ */

* @example
*
* ```ts

@@ -221,0 +229,0 @@ * const A = throttle(myFunction, 1000)

@@ -6,2 +6,6 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {

@@ -15,7 +19,50 @@ if (from && typeof from === "object" || typeof from === "function") {

};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export(src_exports, {
Result: () => import_control.Result,
annotateError: () => import_error.annotateError,
assert: () => import_control.assert,
assertExists: () => import_control.assertExists,
compact: () => import_array.compact,
debounce: () => import_debounce.debounce,
dedupe: () => import_array.dedupe,
deepCopy: () => import_object.deepCopy,
exhaustiveSwitchError: () => import_control.exhaustiveSwitchError,
getErrorAnnotations: () => import_error.getErrorAnnotations,
getFirstFromIterable: () => import_iterable.getFirstFromIterable,
getHashForObject: () => import_hash.getHashForObject,
getHashForString: () => import_hash.getHashForString,
getOwnProperty: () => import_object.getOwnProperty,
hasOwnProperty: () => import_object.hasOwnProperty,
isDefined: () => import_value.isDefined,
isNonNull: () => import_value.isNonNull,
isNonNullish: () => import_value.isNonNullish,
last: () => import_array.last,
lerp: () => import_number.lerp,
lns: () => import_hash.lns,
minBy: () => import_array.minBy,
modulate: () => import_number.modulate,
objectMapEntries: () => import_object.objectMapEntries,
objectMapKeys: () => import_object.objectMapKeys,
objectMapValues: () => import_object.objectMapValues,
omitFromStackTrace: () => import_function.omitFromStackTrace,
partition: () => import_array.partition,
promiseWithResolve: () => import_control.promiseWithResolve,
rng: () => import_number.rng,
rotateArray: () => import_array.rotateArray,
structuredClone: () => import_value.structuredClone,
throttle: () => import_function.throttle
});
module.exports = __toCommonJS(src_exports);
__reExport(src_exports, require("./lib"), module.exports);
var import_array = require("./lib/array");
var import_control = require("./lib/control");
var import_debounce = require("./lib/debounce");
var import_error = require("./lib/error");
var import_function = require("./lib/function");
var import_hash = require("./lib/hash");
var import_iterable = require("./lib/iterable");
var import_number = require("./lib/number");
var import_object = require("./lib/object");
var import_value = require("./lib/value");
//# sourceMappingURL=index.js.map
{
"name": "@tldraw/utils",
"description": "A tiny little drawing app (private utilities).",
"version": "2.0.0-canary.fa74666a",
"version": "2.0.0-canary.fadf4f301",
"author": {

@@ -36,3 +36,2 @@ "name": "tldraw GB Ltd.",

"test:coverage": "yarn run -T jest --coverage",
"build:types": "yarn run -T tsx ../../scripts/build-types.ts",
"build": "echo 'build should be run by turbo'",

@@ -39,0 +38,0 @@ "build:package": "yarn run -T tsx ../../scripts/build-package.ts",

@@ -1,1 +0,25 @@

export * from './lib'
export { compact, dedupe, last, minBy, partition, rotateArray } from './lib/array'
export {
Result,
assert,
assertExists,
exhaustiveSwitchError,
promiseWithResolve,
type ErrorResult,
type OkResult,
} from './lib/control'
export { debounce } from './lib/debounce'
export { annotateError, getErrorAnnotations } from './lib/error'
export { omitFromStackTrace, throttle } from './lib/function'
export { getHashForObject, getHashForString, lns } from './lib/hash'
export { getFirstFromIterable } from './lib/iterable'
export { lerp, modulate, rng } from './lib/number'
export {
deepCopy,
getOwnProperty,
hasOwnProperty,
objectMapEntries,
objectMapKeys,
objectMapValues,
} from './lib/object'
export { isDefined, isNonNull, isNonNullish, structuredClone } from './lib/value'

@@ -53,9 +53,11 @@ /**

/**
* Partitions an array into two arrays, one with items that satisfy the predicate, and one with items that do not.
* Partitions an array into two arrays, one with items that satisfy the predicate, and one with
* items that do not.
*
* @param arr - The array to partition
* @param predicate - The predicate to use to partition the array
* @returns A tuple of two arrays, the first one with items that satisfy the predicate and the second one with the ones that dont
*
* @internal */
* @returns A tuple of two arrays, the first one with items that satisfy the predicate and the
* second one with the ones that dont
* @internal
*/
export function partition<T>(arr: T[], predicate: (item: T) => boolean): [T[], T[]] {

@@ -62,0 +64,0 @@ const satisfies: T[] = []

@@ -5,2 +5,3 @@ /**

* @example
*
* ```ts

@@ -10,3 +11,2 @@ * const A = debounce(myFunction, 1000)

*
*
* @public

@@ -13,0 +13,0 @@ * @see source - https://gist.github.com/ca0v/73a31f57b397606c9813472f7493a940

@@ -9,4 +9,5 @@ type ErrorAnnotations = {

/**
* Annotate an error with tags and additional data. Annotations won't overwrite
* existing ones. Retrieve them with `getErrorAnnotations`.
* Annotate an error with tags and additional data. Annotations won't overwrite existing ones.
* Retrieve them with `getErrorAnnotations`.
*
* @internal

@@ -13,0 +14,0 @@ */

@@ -5,2 +5,3 @@ /**

* @example
*
* ```ts

@@ -30,6 +31,6 @@ * const A = throttle(myFunction, 1000)

/**
* When a function is wrapped in `omitFromStackTrace`, if it throws an error the
* stack trace won't include the function itself or any stack frames above it.
* Useful for assertion-style function where the error will ideally originate
* from the call-site rather than within the implementation of the assert fn.
* When a function is wrapped in `omitFromStackTrace`, if it throws an error the stack trace won't
* include the function itself or any stack frames above it. Useful for assertion-style function
* where the error will ideally originate from the call-site rather than within the implementation
* of the assert fn.
*

@@ -36,0 +37,0 @@ * Only works in platforms that support `Error.captureStackTrace` (ie v8).

/**
* Hash a string using the FNV-1a algorithm.
*
* @public

@@ -16,2 +17,3 @@ */

* Hash a string using the FNV-1a algorithm.
*
* @public

@@ -18,0 +20,0 @@ */

@@ -5,9 +5,10 @@ /**

* @example
*
* ```ts
* const A = getFirstItem(new Set([1, 2, 3])) // 1
* const B = getFirstItem(
* new Map([
* ['a', 1],
* ['b', 2],
* ])
* new Map([
* ['a', 1],
* ['b', 2],
* ])
* ) // 1

@@ -14,0 +15,0 @@ * ```

@@ -5,2 +5,3 @@ /**

* @example
*
* ```ts

@@ -21,2 +22,3 @@ * const A = lerp(0, 1, 0.5)

* Adapted from [seedrandom](https://github.com/davidbau/seedrandom).
*
* @public

@@ -51,2 +53,3 @@ */

* @example
*
* ```ts

@@ -53,0 +56,0 @@ * const A = modulate(0, [0, 1], [0, 100])

@@ -26,2 +26,3 @@ /** @internal */

* @example
*
* ```ts

@@ -57,4 +58,4 @@ * const A = deepCopy({ a: 1, b: { c: 2 } })

/**
* An alias for `Object.keys` that treats the object as a map and so
* preserves the type of the keys.
* An alias for `Object.keys` that treats the object as a map and so preserves the type of the keys.
*
* @internal

@@ -69,4 +70,5 @@ */

/**
* An alias for `Object.values` that treats the object as a map and so
* preserves the type of the keys.
* An alias for `Object.values` that treats the object as a map and so preserves the type of the
* keys.
*
* @internal

@@ -81,4 +83,5 @@ */

/**
* An alias for `Object.entries` that treats the object as a map and so
* preserves the type of the keys.
* An alias for `Object.entries` that treats the object as a map and so preserves the type of the
* keys.
*
* @internal

@@ -85,0 +88,0 @@ */

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

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