Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solid-primitives/utils

Package Overview
Dependencies
Maintainers
3
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/utils - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

32

dist/index.d.ts

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

import { Accessor, Setter, onCleanup } from 'solid-js';
import { Accessor, Setter, AccessorArray, NoInfer, EffectFunction, onCleanup } from 'solid-js';
export { EffectOptions, MemoOptions, OnOptions, SignalOptions } from 'solid-js/types/reactive/signal';

@@ -15,3 +16,3 @@ /**

type ItemsOfMany<T> = T extends any[] ? ItemsOf<T> : T;
type SetterValue<T> = Parameters<Setter<T>>[0];
type SetterParam<T> = Parameters<Setter<T>>[0];
/**

@@ -117,3 +118,3 @@ * T or a reactive/non-reactive function returning T

declare const access: <T extends unknown>(v: T) => MaybeAccessorValue<T>;
declare const asArray: <T>(value: T) => T extends any[] ? T : T[];
declare const asArray: <T>(value: T) => (T extends any[] ? T[number] : T)[];
/**

@@ -136,2 +137,11 @@ * Access an array of MaybeAccessors

/**
* Solid's `on` helper, but always defers and returns a provided initial value when if does instead of `undefined`.
*
* @param deps
* @param fn
* @param initialValue
*/
declare function defer<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: (input: S, prevInput: S, prev: undefined | NoInfer<Prev>) => Next, initialValue: Next): EffectFunction<undefined | NoInfer<Next>, NoInfer<Next>>;
declare function defer<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: (input: S, prevInput: S, prev: undefined | NoInfer<Prev>) => Next, initialValue?: undefined): EffectFunction<undefined | NoInfer<Next>>;
/**
* Get entries of an object

@@ -147,3 +157,3 @@ */

*/
declare const onRootCleanup: typeof onCleanup;
declare const tryOnCleanup: typeof onCleanup;
declare const createCallbackStack: <A0 = void, A1 = void, A2 = void, A3 = void>() => {

@@ -160,15 +170,6 @@ push: (...callbacks: ((arg0: A0, arg1: A1, arg2: A2, arg3: A3) => void)[]) => void;

declare function createMicrotask<A extends any[] | []>(fn: (...a: A) => void): (...a: A) => void;
/** WIP: an easier to setup and type Proxy */
declare function createProxy<T extends Record<string | symbol, any>>(traps: {
get: <K extends keyof T>(key: K) => T[K];
set: <K extends keyof T>(key: K, value: T[K]) => void;
}): T;
declare function createProxy<T extends Record<string | symbol, any>>(traps: {
get: <K extends keyof T>(key: K) => T[K];
set?: undefined;
}): Readonly<T>;
type StaticStoreSetter<T extends Readonly<AnyStatic>> = {
(setter: (prev: T) => Partial<T>): T;
(state: Partial<T>): T;
<K extends keyof T>(key: K, state: SetterValue<T[K]>): T;
<K extends keyof T>(key: K, state: SetterParam<T[K]>): T;
};

@@ -193,4 +194,3 @@ /**

declare function handleDiffArray<T>(current: readonly T[], prev: readonly T[], handleAdded: (item: T) => void, handleRemoved: (item: T) => void): void;
declare const forEachEntry: <T>(obj: Record<string, T>, fn: (key: string, value: T) => void) => void;
export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterValue, Simplify, StaticStoreSetter, Tail, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, entries, forEachEntry, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, withAccess };
export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterParam, Simplify, StaticStoreSetter, Tail, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, tryOnCleanup, withAccess };

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

import { DEV, getOwner, onCleanup, createSignal, untrack, batch } from 'solid-js';
import { DEV, untrack, getOwner, onCleanup, createSignal, batch } from 'solid-js';
import { isServer as isServer$1 } from 'solid-js/web';

@@ -36,5 +36,27 @@

}
function defer(deps, fn, initialValue) {
const isArray = Array.isArray(deps);
let prevInput;
let shouldDefer = true;
return (prevValue) => {
let input;
if (isArray) {
input = Array(deps.length);
for (let i = 0; i < deps.length; i++)
input[i] = deps[i]();
} else
input = deps();
if (shouldDefer) {
shouldDefer = false;
prevInput = input;
return initialValue;
}
const result = untrack(() => fn(input, prevInput, prevValue));
prevInput = input;
return result;
};
}
var entries = Object.entries;
var keys = Object.keys;
var onRootCleanup = (fn) => getOwner() ? onCleanup(fn) : fn;
var tryOnCleanup = (fn) => getOwner() ? onCleanup(fn) : fn;
var createCallbackStack = () => {

@@ -60,14 +82,2 @@ let stack = [];

}
function createProxy(traps) {
return new Proxy(
{},
{
get: (_, k) => traps.get(k),
set: (_, k, v) => {
traps.set?.(k, v);
return false;
}
}
);
}
function createStaticStore(init) {

@@ -146,4 +156,3 @@ const copy = { ...init };

}
var forEachEntry = (obj, fn) => Object.entries(obj).forEach(([key, value]) => fn(key, value));
export { access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, entries, forEachEntry, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, withAccess };
export { access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, tryOnCleanup, withAccess };
{
"name": "@solid-primitives/utils",
"version": "4.0.1",
"version": "5.0.0",
"description": "A bunch of reactive utility types and functions, for building primitives with Solid.js",

@@ -5,0 +5,0 @@ "author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",

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