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

@solid-primitives/utils

Package Overview
Dependencies
Maintainers
2
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 0.2.0 to 0.2.1

17

dist/index.d.ts

@@ -10,2 +10,3 @@ import { Accessor, onCleanup } from 'solid-js';

declare type Fn<R = void> = () => R;
declare type Get<T> = (v: T) => void;
/**

@@ -18,2 +19,3 @@ * Can be single or in an array

declare type Noop = (...a: any[]) => void;
declare type Directive<P = true> = (el: Element, props: Accessor<P>) => void;
/**

@@ -23,2 +25,3 @@ * Infers the type of the array elements

declare type ItemsOf<T> = T extends (infer E)[] ? E : never;
declare type ItemsOfMany<T> = T extends any[] ? ItemsOf<T> : T;
/**

@@ -55,8 +58,13 @@ * T or a reactive/non-reactive function returning T

};
/** `A | B => A & B` */
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
declare type ExtractIfPossible<T, U> = Extract<T, U> extends never ? U : Extract<T, U>;
declare type AnyObject = Record<string, any>;
declare type AnyFunction = (...args: any[]) => any;
declare type AnyClass = abstract new (...args: any) => any;
declare type LiteralKey = string | number | symbol;
declare type PrimitiveValue = string | boolean | number | bigint | symbol | null | undefined;
declare type FalsyValue = false | 0 | "" | null | undefined;
declare type Truthy<T> = T extends FalsyValue ? never : T;
declare type Falsy<T> = T extends FalsyValue ? T : never;
declare type Truthy<T> = Exclude<T, FalsyValue>;
declare type Falsy<T> = Extract<T, FalsyValue>;
/**

@@ -83,2 +91,3 @@ * Destructible store object, with values changed to accessors

declare const isArray: (val: any) => val is any[];
declare const ofClass: (v: any, c: AnyClass) => boolean;
declare const compare: (a: any, b: any) => number;

@@ -92,2 +101,4 @@ /**

declare const tuple: <T extends any[] | []>(input: T) => T;
/** `Array.prototype.includes()` without so strict types. Also allows for checking for multiple items */
declare const includes: (arr: any[], ...items: any) => boolean;
/**

@@ -212,2 +223,2 @@ * Accesses the value of a MaybeAccessor

export { AccessReturnTypes, AnyFunction, AnyObject, DeepPartialAny, Destore, Falsy, FalsyValue, Fn, ItemsOf, Keys, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, Noop, OnAccessEffectFunction, PrimitiveValue, Truthy, Values, access, accessArray, accessAsArray, asAccessor, asArray, compare, createCallbackStack, destore, entries, forEach, isArray, isBoolean, isClient, isDefined, isFunction, isNumber, isObject, isString, keys, noop, onAccess, onRootCleanup, promiseTimeout, raceTimeout, tuple, withAccess };
export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, DeepPartialAny, Destore, Directive, ExtractIfPossible, Falsy, FalsyValue, Fn, Get, ItemsOf, ItemsOfMany, Keys, LiteralKey, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, Noop, OnAccessEffectFunction, PrimitiveValue, Truthy, UnionToIntersection, Values, access, accessArray, accessAsArray, asAccessor, asArray, compare, createCallbackStack, destore, entries, forEach, includes, isArray, isBoolean, isClient, isDefined, isFunction, isNumber, isObject, isString, keys, noop, ofClass, onAccess, onRootCleanup, promiseTimeout, raceTimeout, tuple, withAccess };

@@ -13,4 +13,12 @@ // src/index.ts

var isArray = (val) => Array.isArray(val);
var ofClass = (v, c) => v instanceof c || v && v.constructor === c;
var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
var tuple = (input) => input;
var includes = (arr, ...items) => {
for (const item of arr) {
if (items.includes(item))
return true;
}
return false;
};
var access = (v) => isFunction(v) ? v() : v;

@@ -73,2 +81,3 @@ var accessAsArray = (value) => asArray(access(value));

forEach,
includes,
isArray,

@@ -85,2 +94,3 @@ isBoolean,

noop,
ofClass,
onAccess,

@@ -87,0 +97,0 @@ onRootCleanup,

2

package.json
{
"name": "@solid-primitives/utils",
"version": "0.2.0",
"version": "0.2.1",
"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