Socket
Book a DemoInstallSign in
Socket

@tldraw/utils

Package Overview
Dependencies
Maintainers
4
Versions
2977
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

to
3.16.0-canary.460bdab3938b

2

dist-cjs/index.d.ts

@@ -12,3 +12,3 @@ import { default as isEqual } from 'lodash.isequal';

/* Excluded from this release type: assert */
/* Excluded from this release type: assert_2 */

@@ -15,0 +15,0 @@ /* Excluded from this release type: assertExists */

@@ -170,5 +170,5 @@ "use strict";

"@tldraw/utils",
"3.16.0-canary.410cbabb5392",
"3.16.0-canary.460bdab3938b",
"cjs"
);
//# sourceMappingURL=index.js.map
{
"name": "@tldraw/utils",
"description": "tldraw infinite canvas SDK (private utilities).",
"version": "3.16.0-canary.410cbabb5392",
"version": "3.16.0-canary.460bdab3938b",
"author": {

@@ -35,5 +35,5 @@ "name": "tldraw Inc.",

"scripts": {
"test-ci": "lazy inherit",
"test": "yarn run -T jest",
"test-coverage": "lazy inherit",
"test-ci": "yarn run -T vitest run --passWithNoTests",
"test": "yarn run -T vitest --passWithNoTests",
"test-coverage": "yarn run -T vitest run --coverage --passWithNoTests",
"build": "yarn run -T tsx ../../internal/scripts/build-package.ts",

@@ -44,13 +44,5 @@ "build-api": "yarn run -T tsx ../../internal/scripts/build-api.ts",

"pack-tarball": "yarn pack",
"lint": "yarn run -T tsx ../../internal/scripts/lint.ts"
"lint": "yarn run -T tsx ../../internal/scripts/lint.ts",
"context": "yarn run -T tsx ../../internal/scripts/context.ts"
},
"jest": {
"preset": "../../internal/config/jest/node/jest-preset.js",
"setupFiles": [
"raf/polyfill"
],
"moduleNameMapper": {
"^~(.*)": "<rootDir>/src/$1"
}
},
"dependencies": {

@@ -68,4 +60,4 @@ "fractional-indexing-jittered": "^1.0.0",

"@types/lodash.uniq": "^4.5.9",
"jest-environment-jsdom": "^29.7.0",
"lazyrepo": "0.0.0-alpha.27"
"lazyrepo": "0.0.0-alpha.27",
"vitest": "^3.2.4"
},

@@ -72,0 +64,0 @@ "module": "dist-esm/index.mjs",

@@ -0,8 +1,9 @@

import { vi } from 'vitest'
import { debounce } from './debounce'
jest.useFakeTimers()
vi.useFakeTimers()
describe(debounce, () => {
it('should debounce a function', async () => {
const fn = jest.fn()
const fn = vi.fn()
const debounced = debounce(fn, 100)

@@ -13,7 +14,7 @@ debounced()

expect(fn).not.toHaveBeenCalled()
jest.advanceTimersByTime(200)
vi.advanceTimersByTime(200)
expect(fn).toHaveBeenCalledTimes(1)
jest.advanceTimersByTime(200)
vi.advanceTimersByTime(200)
expect(fn).toHaveBeenCalledTimes(1)
jest.advanceTimersByTime(200)
vi.advanceTimersByTime(200)
expect(fn).toHaveBeenCalledTimes(1)

@@ -23,3 +24,3 @@ })

it('should debounce a function with arguments', async () => {
const fn = jest.fn()
const fn = vi.fn()
const debounced = debounce(fn, 100)

@@ -30,3 +31,3 @@ debounced('a', 'b')

expect(fn).not.toHaveBeenCalled()
jest.advanceTimersByTime(200)
vi.advanceTimersByTime(200)
expect(fn).toHaveBeenCalledTimes(1)

@@ -37,3 +38,3 @@ expect(fn).toHaveBeenCalledWith('a', 'b')

it('should debounce a function with arguments and return a promise', async () => {
const fn = jest.fn((a, b) => a + b)
const fn = vi.fn((a, b) => a + b)
const debounced = debounce(fn, 100)

@@ -44,3 +45,3 @@ const promiseA = debounced('a', 'b')

expect(fn).not.toHaveBeenCalled()
jest.advanceTimersByTime(200)
vi.advanceTimersByTime(200)
expect(fn).toHaveBeenCalledTimes(1)

@@ -53,3 +54,3 @@ const results = await Promise.all([promiseA, promiseB, promiseC])

it('can be called across multiple debounce windows', async () => {
const fn = jest.fn((a, b) => a + b)
const fn = vi.fn((a, b) => a + b)
const debounced = debounce(fn, 100)

@@ -59,3 +60,3 @@ const promiseA = debounced('a', 'b')

expect(fn).not.toHaveBeenCalled()
jest.advanceTimersByTime(200)
vi.advanceTimersByTime(200)
expect(fn).toHaveBeenCalledTimes(1)

@@ -69,3 +70,3 @@

jest.advanceTimersByTime(200)
vi.advanceTimersByTime(200)

@@ -72,0 +73,0 @@ expect(fn).toHaveBeenCalledTimes(2)

@@ -0,4 +1,5 @@

import { vi } from 'vitest'
import { clearRegisteredVersionsForTests, registerTldrawLibraryVersion } from './version'
jest.useFakeTimers()
vi.useFakeTimers()

@@ -8,7 +9,7 @@ describe('registerTldrawLibraryVersion', () => {

clearRegisteredVersionsForTests()
jest.restoreAllMocks()
vi.restoreAllMocks()
})
it('doesnt log anything if all versions are the same', () => {
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {})

@@ -20,3 +21,3 @@ registerTldrawLibraryVersion('tldraw', '1.0.0', 'esm')

jest.runAllTimers()
vi.runAllTimers()

@@ -27,3 +28,3 @@ expect(consoleLogSpy).toHaveBeenCalledTimes(0)

it('logs if not all versions match', () => {
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {})

@@ -36,3 +37,3 @@ registerTldrawLibraryVersion('tldraw', '1.0.0', 'esm')

jest.runAllTimers()
vi.runAllTimers()

@@ -56,3 +57,3 @@ expect(consoleLogSpy).toHaveBeenCalledTimes(1)

it('logs if multiple versions of te same library are installed', () => {
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {})

@@ -66,3 +67,3 @@ registerTldrawLibraryVersion('tldraw', '1.1.0', 'esm')

jest.runAllTimers()
vi.runAllTimers()

@@ -69,0 +70,0 @@ expect(consoleLogSpy).toHaveBeenCalledTimes(1)

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.