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
2184
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.36c15841 to 2.0.0-canary.388807f10

src/index.ts

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 @@

28

dist-cjs/index.d.ts

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

/* Excluded from this release type: _annotateError */
/* Excluded from this release type: annotateError */

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

* @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

@@ -180,6 +186,8 @@ * const A = modulate(0, [0, 1], [0, 100])

/* Excluded from this release type: partition */
/* Excluded from this release type: promiseWithResolve */
/** @public */
export declare type Result<T, E> = OkResult<T> | ErrorResult<E>;
export declare type Result<T, E> = ErrorResult<E> | OkResult<T>;

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

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

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

* @example
*
* ```ts

@@ -219,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

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

minBy: () => minBy,
partition: () => partition,
rotateArray: () => rotateArray

@@ -63,2 +64,14 @@ });

}
function partition(arr, predicate) {
const satisfies = [];
const doesNotSatisfy = [];
for (const item of arr) {
if (predicate(item)) {
satisfies.push(item);
} else {
doesNotSatisfy.push(item);
}
}
return [satisfies, doesNotSatisfy];
}
//# sourceMappingURL=array.js.map

@@ -21,3 +21,3 @@ "use strict";

__export(error_exports, {
_annotateError: () => _annotateError,
annotateError: () => annotateError,
getErrorAnnotations: () => getErrorAnnotations

@@ -27,3 +27,3 @@ });

const annotationsByError = /* @__PURE__ */ new WeakMap();
function _annotateError(error, annotations) {
function annotateError(error, annotations) {
if (typeof error !== "object" || error === null)

@@ -30,0 +30,0 @@ return;

{
"name": "@tldraw/utils",
"description": "A tiny little drawing app (private utilities).",
"version": "2.0.0-canary.36c15841",
"version": "2.0.0-canary.388807f10",
"author": {

@@ -29,17 +29,19 @@ "name": "tldraw GB Ltd.",

"files": [
"dist-esm/**/*",
"dist-cjs/**/*"
"dist-esm",
"dist-cjs",
"src"
],
"scripts": {
"test": "yarn run -T jest",
"test:coverage": "yarn run -T jest --coverage",
"typecheck": "yarn run -T tsc --build",
"build": "echo 'build should be run by turbo'",
"build:package": "yarn run -T tsx ../../scripts/build-package.ts",
"build:types": "yarn run -T tsx ../../scripts/build-types.ts",
"build:api": "yarn run -T tsx ../../scripts/build-api.ts",
"prepack": "yarn run -T tsx ../../scripts/prepack.ts",
"postpack": "../../scripts/postpack.sh",
"lint": "yarn run -T tsx ../../scripts/lint.ts"
"test": "lazy inherit",
"test:coverage": "lazy inherit",
"build:package": "yarn run -T tsx ../../../scripts/build-package.ts",
"build:api": "yarn run -T tsx ../../../scripts/build-api.ts",
"prepack": "yarn run -T tsx ../../../scripts/prepack.ts",
"postpack": "../../../scripts/postpack.sh",
"pack-tarball": "yarn pack",
"lint": "yarn run -T tsx ../../../scripts/lint.ts"
},
"devDependencies": {
"lazyrepo": "0.0.0-alpha.12"
},
"jest": {

@@ -46,0 +48,0 @@ "preset": "config/jest/node",

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

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