Comparing version 0.2.21 to 0.2.22
export function last<L>(arr: L[]): L; | ||
export function create<T_1>(): T[]; | ||
export function copy<T_1>(a: T[]): T[]; | ||
export function create<C>(): C[]; | ||
export function copy<D>(a: D[]): D[]; | ||
export function appendTo<M>(dest: M[], src: M[]): void; | ||
@@ -20,4 +20,4 @@ /** | ||
export function every<ITEM>(arr: ITEM[], f: (arg0: ITEM, arg1: number, arg2: ITEM[]) => boolean): boolean; | ||
export function some<T_1>(arr: T[], f: (arg0: T, arg1: number, arg2: T[]) => boolean): boolean; | ||
export function some<S>(arr: S[], f: (arg0: S, arg1: number, arg2: S[]) => boolean): boolean; | ||
export function equalFlat<ELEM>(a: ELEM[], b: ELEM[]): boolean; | ||
//# sourceMappingURL=array.d.ts.map |
21
array.js
@@ -17,13 +17,13 @@ /** | ||
/** | ||
* @template T | ||
* @return {Array<T>} | ||
* @template C | ||
* @return {Array<C>} | ||
*/ | ||
export const create = () => [] | ||
export const create = () => /** @type {Array<C>} */ ([]) | ||
/** | ||
* @template T | ||
* @param {Array<T>} a | ||
* @return {Array<T>} | ||
* @template D | ||
* @param {Array<D>} a | ||
* @return {Array<D>} | ||
*/ | ||
export const copy = a => a.slice() | ||
export const copy = a => /** @type {Array<D>} */ (a.slice()) | ||
@@ -69,6 +69,5 @@ /** | ||
* @function | ||
* @template T | ||
* | ||
* @param {Array<T>} arr | ||
* @param {function(T, number, Array<T>):boolean} f | ||
* @template S | ||
* @param {Array<S>} arr | ||
* @param {function(S, number, Array<S>):boolean} f | ||
* @return {boolean} | ||
@@ -75,0 +74,0 @@ */ |
@@ -33,2 +33,5 @@ /* eslint-env browser */ | ||
/** | ||
* @todo rename to lib0-component-upgradet before next major release | ||
*/ | ||
const upgradedEventName = 'upgraded' | ||
@@ -252,3 +255,3 @@ | ||
this.state = state | ||
if (this._init && (state !== prevState || forceStateUpdates)) { | ||
if (this._init && (!func.equalityFlat(state, prevState) || forceStateUpdates)) { | ||
// fill slots | ||
@@ -255,0 +258,0 @@ if (state) { |
@@ -61,2 +61,2 @@ /** | ||
*/ | ||
export const equalityFlat = (a, b) => a.constructor === b.constructor && ((a instanceof Array && array.equalFlat(a, /** @type {Array<T>} */ (b))) || object.equalFlat(a, b)) | ||
export const equalityFlat = (a, b) => a === b || (a != null && b != null && a.constructor === b.constructor && ((a instanceof Array && array.equalFlat(a, /** @type {Array<T>} */ (b))) || (typeof a === 'object' && object.equalFlat(a, b)))) |
{ | ||
"name": "lib0", | ||
"version": "0.2.21", | ||
"version": "0.2.22", | ||
"description": "", | ||
@@ -27,3 +27,3 @@ "sideEffects": false, | ||
"clean": "rm -rf dist *.d.ts */*.d.ts *.d.ts.map */*.d.ts.map", | ||
"types": "tsc --outDir .", | ||
"types": "npm run clean && tsc --outDir .", | ||
"dist": "npm run clean && rollup -c", | ||
@@ -30,0 +30,0 @@ "debug": "rollup -c && concurrently 'rollup -wc' 'http-server -o test.html'", |
@@ -57,4 +57,4 @@ | ||
<dd><p>Return the last element of an array. The element must exist</p></dd> | ||
<b><code>array.create(): Array<T></code></b><br> | ||
<b><code>array.copy(a: Array<T>): Array<T></code></b><br> | ||
<b><code>array.create(): Array<C></code></b><br> | ||
<b><code>array.copy(a: Array<D>): Array<D></code></b><br> | ||
<b><code>array.appendTo(dest: Array<M>, src: Array<M>)</code></b><br> | ||
@@ -66,3 +66,3 @@ <dd><p>Append elements from src to dest</p></dd> | ||
<dd><p>True iff condition holds on every element in the Array.</p></dd> | ||
<b><code>array.some(arr: Array<T>, f: function(T, number, Array<T>):boolean): boolean</code></b><br> | ||
<b><code>array.some(arr: Array<S>, f: function(S, number, Array<S>):boolean): boolean</code></b><br> | ||
<dd><p>True iff condition holds on some element in the Array.</p></dd> | ||
@@ -69,0 +69,0 @@ <b><code>array.equalFlat(a: Array<ELEM>, b: Array<ELEM>): boolean</code></b><br> |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
3
286869
199
6767
1