@solid-primitives/utils 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -36,6 +36,7 @@ __export(src_exports, {
36
36
  access: () => access,
37
37
  accessArray: () => accessArray,
38
38
  accessWith: () => accessWith,
39
+ arrayEquals: () => arrayEquals,
39
40
  asAccessor: () => asAccessor,
40
41
  asArray: () => asArray,
41
42
  chain: () => chain,
@@ -78,6 +79,7 @@ function isObject(value) {
78
79
  return value !== null && (typeof value === "object" || typeof value === "function");
79
80
  }
80
81
  var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
82
+ var arrayEquals = (a, b) => a === b || a.length === b.length && a.every((e, i) => e === b[i]);
81
83
  function chain(callbacks) {
82
84
  return (...args) => {
83
85
  for (const callback of callbacks) {
@@ -242,6 +244,7 @@ function handleDiffArray(current, prev, handleAdded, handleRemoved) {
242
244
  access,
243
245
  accessArray,
244
246
  accessWith,
247
+ arrayEquals,
245
248
  asAccessor,
246
249
  asArray,
247
250
  chain,
package/dist/index.d.ts CHANGED
@@ -110,6 +110,10 @@ declare const ofClass: (v: any, c: AnyClass) => boolean;
110
110
  /** Check if value is typeof "object" or "function" */
111
111
  declare function isObject(value: any): value is AnyObject;
112
112
  declare const compare: (a: any, b: any) => number;
113
+ /**
114
+ * Check shallow array equality
115
+ */
116
+ declare const arrayEquals: (a: readonly unknown[], b: readonly unknown[]) => boolean;
113
117
  /**
114
118
  * Returns a function that will call all functions in the order they were chained with the same arguments.
115
119
  */
@@ -268,4 +272,4 @@ declare function createStaticStore<T extends Readonly<AnyStatic>>(init: T): [acc
268
272
  */
269
273
  declare function handleDiffArray<T>(current: T[], prev: T[], handleAdded: (item: T) => void, handleRemoved: (item: T) => void): void;
270
274
 
271
- export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Definite, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, Mutable, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterValue, Simplify, StaticStoreSetter, Tail, Trigger, TriggerCache, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, createTrigger, createTriggerCache, entries, forEachEntry, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, promiseTimeout, raceTimeout, warn, withAccess };
275
+ export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Definite, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, Mutable, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterValue, Simplify, StaticStoreSetter, Tail, Trigger, TriggerCache, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, createTrigger, createTriggerCache, entries, forEachEntry, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, promiseTimeout, raceTimeout, warn, withAccess };
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ function isObject(value) {
29
29
  return value !== null && (typeof value === "object" || typeof value === "function");
30
30
  }
31
31
  var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
32
+ var arrayEquals = (a, b) => a === b || a.length === b.length && a.every((e, i) => e === b[i]);
32
33
  function chain(callbacks) {
33
34
  return (...args) => {
34
35
  for (const callback of callbacks) {
@@ -192,6 +193,7 @@ export {
192
193
  access,
193
194
  accessArray,
194
195
  accessWith,
196
+ arrayEquals,
195
197
  asAccessor,
196
198
  asArray,
197
199
  chain,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solid-primitives/utils",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A bunch of reactive utility types and functions, for building primitives with Solid.js",
5
5
  "author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",
6
6
  "license": "MIT",