@suspensive/react-await
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -6,3 +6,3 @@ "use client" | ||
useAwait | ||
} from "./chunk-KHB6EI6J.js"; | ||
} from "./chunk-WMR3YGYO.js"; | ||
export { | ||
@@ -9,0 +9,0 @@ Await, |
@@ -6,3 +6,3 @@ "use client" | ||
useAwait | ||
} from "./chunk-KHB6EI6J.js"; | ||
} from "./chunk-WMR3YGYO.js"; | ||
export { | ||
@@ -9,0 +9,0 @@ Await, |
{ | ||
"name": "@suspensive/react-await", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Useful interfaces for React Suspense", | ||
@@ -48,13 +48,14 @@ "keywords": [ | ||
"dependencies": { | ||
"use-sync-external-store": "^1.2.0" | ||
"use-sync-external-store": "^1.2.2" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.2.48", | ||
"@types/react-dom": "^18.2.18", | ||
"@types/react": "^18.3.2", | ||
"@types/react-dom": "^18.3.0", | ||
"@types/use-sync-external-store": "^0.0.6", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"@suspensive/package-json-name": "0.0.0", | ||
"@suspensive/react": "1.25.2", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"@suspensive/eslint-config": "0.0.0", | ||
"@suspensive/react": "1.27.0", | ||
"@suspensive/test-utils": "0.0.0", | ||
"@suspensive/tsconfig": "0.0.0-development", | ||
"@suspensive/tsup": "0.0.0" | ||
@@ -70,11 +71,11 @@ }, | ||
"build": "tsup", | ||
"build:watch": "tsup --watch", | ||
"ci:attw": "attw --pack", | ||
"ci:eslint": "eslint \"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}\"", | ||
"ci:publint": "publint --strict", | ||
"ci:type": "tsc --noEmit", | ||
"clean": "rimraf ./dist && rimraf ./coverage", | ||
"lint": "eslint \"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}\"", | ||
"lint:attw": "attw --pack", | ||
"lint:pub": "publint --strict", | ||
"dev": "tsup --watch", | ||
"test": "vitest run --coverage --typecheck", | ||
"test:watch": "vitest --ui --coverage --typecheck", | ||
"type:check": "tsc --noEmit" | ||
"test:watch": "vitest --ui --coverage --typecheck" | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { hashKey } from './hashKey' | ||
@@ -3,0 +2,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { hasResetKeysChanged } from '.' | ||
@@ -9,47 +8,51 @@ | ||
describe('hasResetKeysChanged', () => { | ||
it('should return true if the two arrays have different lengths.', () => { | ||
const array1 = Array.from({ length: 1 }).map((_, index) => primitive + index) | ||
const array2 = Array.from({ length: 2 }).map((_, index) => primitive + index) | ||
describe('true cases', () => { | ||
it('should return true if the two arrays have different lengths.', () => { | ||
const array1 = Array.from({ length: 1 }).map((_, index) => primitive + index) | ||
const array2 = Array.from({ length: 2 }).map((_, index) => primitive + index) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
}) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
}) | ||
it('should return false if the two arrays have same lengths and same primitive element in each index of arrays.', () => { | ||
const array1 = Array.from({ length: 1 }).map((_, index) => primitive + index) | ||
const array2 = Array.from({ length: 1 }).map((_, index) => primitive + index) | ||
it('should return true if the two arrays have same lengths but at least one primitive element is different in each index of arrays.', () => { | ||
const array1 = [primitive, primitive + 1] | ||
const array2 = [primitive, primitive] | ||
expect(hasResetKeysChanged(array1, array2)).toBe(false) | ||
}) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
}) | ||
it('should return true if the two arrays have same lengths but at least one primitive element is different in each index of arrays.', () => { | ||
const array1 = [primitive, primitive + 1] | ||
const array2 = [primitive, primitive] | ||
it('should return true if the two arrays have same lengths and have all same primitive elements but order is different', () => { | ||
const array1 = [primitive, primitive + 1] | ||
const array2 = [primitive + 1, primitive] | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
}) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
}) | ||
it('should return true if the two arrays have same lengths and have all same primitive elements but order is different', () => { | ||
const array1 = [primitive, primitive + 1] | ||
const array2 = [primitive + 1, primitive] | ||
it('should return true when two arrays have each references elements in index of array have different references', () => { | ||
const array1 = [reference1, { test: 2 }] | ||
const array2 = [reference1, { test: 2 }] | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
}) | ||
}) | ||
it('should return true when two arrays have each references elements in index of array have different references', () => { | ||
const array1 = [reference1, { test: 2 }] | ||
const array2 = [reference1, { test: 2 }] | ||
describe('false cases', () => { | ||
it('should return false if the two arrays have same lengths and same primitive element in each index of arrays.', () => { | ||
const array1 = Array.from({ length: 1 }).map((_, index) => primitive + index) | ||
const array2 = Array.from({ length: 1 }).map((_, index) => primitive + index) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(true) | ||
}) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(false) | ||
}) | ||
it('should return false when two arrays have each references elements in index of array have same references', () => { | ||
const array1 = [reference1, reference2] | ||
const array2 = [reference1, reference2] | ||
it('should return false when two arrays have each references elements in index of array have same references', () => { | ||
const array1 = [reference1, reference2] | ||
const array2 = [reference1, reference2] | ||
expect(hasResetKeysChanged(array1, array2)).toBe(false) | ||
}) | ||
expect(hasResetKeysChanged(array1, array2)).toBe(false) | ||
}) | ||
it('should return false when no arrays as parameters. because of default value', () => { | ||
expect(hasResetKeysChanged()).toBe(false) | ||
it('should return false when no arrays as parameters. because of default value', () => { | ||
expect(hasResetKeysChanged()).toBe(false) | ||
}) | ||
}) | ||
}) |
@@ -1,45 +0,48 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { isPlainObject } from './isPlainObject' | ||
describe('isPlainObject', () => { | ||
it('should return true for a plain object', () => { | ||
expect(isPlainObject({})).toBe(true) | ||
}) | ||
describe('true cases', () => { | ||
it('should return true for a plain object', () => { | ||
expect(isPlainObject({})).toBe(true) | ||
}) | ||
it('should return true for an object without a constructor', () => { | ||
expect(isPlainObject(Object.create(null))).toBe(true) | ||
it('should return true for an object without a constructor', () => { | ||
expect(isPlainObject(Object.create(null))).toBe(true) | ||
}) | ||
}) | ||
it('should return false for an array', () => { | ||
expect(isPlainObject([])).toBe(false) | ||
}) | ||
describe('false cases', () => { | ||
it('should return false for an array', () => { | ||
expect(isPlainObject([])).toBe(false) | ||
}) | ||
it('should return false for a null value', () => { | ||
expect(isPlainObject(null)).toBe(false) | ||
}) | ||
it('should return false for a null value', () => { | ||
expect(isPlainObject(null)).toBe(false) | ||
}) | ||
it('should return false for an undefined value', () => { | ||
expect(isPlainObject(undefined)).toBe(false) | ||
}) | ||
it('should return false for an undefined value', () => { | ||
expect(isPlainObject(undefined)).toBe(false) | ||
}) | ||
it('should return false for an object instance without an Object-specific method', () => { | ||
class Foo { | ||
abc: any | ||
constructor() { | ||
this.abc = {} | ||
it('should return false for an object instance without an Object-specific method', () => { | ||
class Foo { | ||
abc: any | ||
constructor() { | ||
this.abc = {} | ||
} | ||
} | ||
} | ||
expect(isPlainObject(new Foo())).toBe(false) | ||
}) | ||
expect(isPlainObject(new Foo())).toBe(false) | ||
}) | ||
it('should return false for an object with a custom prototype', () => { | ||
function Graph(this: any) { | ||
this.vertices = [] | ||
this.edges = [] | ||
} | ||
Graph.prototype.addVertex = function (v: any) { | ||
this.vertices.push(v) | ||
} | ||
expect(isPlainObject(Object.create(Graph))).toBe(false) | ||
it('should return false for an object with a custom prototype', () => { | ||
function Graph(this: any) { | ||
this.vertices = [] | ||
this.edges = [] | ||
} | ||
Graph.prototype.addVertex = function (v: any) { | ||
this.vertices.push(v) | ||
} | ||
expect(isPlainObject(Object.create(Graph))).toBe(false) | ||
}) | ||
}) | ||
}) |
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
70581
1072
10