@solid-primitives/utils
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -51,10 +51,2 @@ import { Accessor, Setter, onCleanup } from 'solid-js'; | ||
}; | ||
/** An opposite of `Partial`. Makes all the keys required. */ | ||
declare type Definite<T> = { | ||
[K in keyof T]-?: T[K]; | ||
}; | ||
/** An opposite of `Readonly`. Makes all the params mutable. */ | ||
declare type Mutable<T> = { | ||
-readonly [K in keyof T]: T[K]; | ||
}; | ||
/** Unwraps the type definition of an object, making it more readable */ | ||
@@ -98,4 +90,2 @@ declare type Simplify<T> = T extends object ? { | ||
declare const isProd = false; | ||
/** `console.warn` only during development */ | ||
declare const warn: typeof console.warn; | ||
/** | ||
@@ -146,6 +136,2 @@ * Check if the value is an instance of ___ | ||
/** | ||
* Iterate through object entries. | ||
*/ | ||
declare function forEachEntry<O extends AnyObject>(object: O, iterator: (key: keyof O, item: Values<O>, index: number, pairs: [keyof O, Values<O>][], object: O) => void): void; | ||
/** | ||
* Get entries of an object | ||
@@ -260,3 +246,4 @@ */ | ||
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, 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, WeakTriggerCache, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, createTrigger, createTriggerCache, createWeakTriggerCache, entries, forEachEntry, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, warn, 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, SetterValue, Simplify, StaticStoreSetter, Tail, Trigger, TriggerCache, Truthy, UnboxLazy, UnionToIntersection, Values, WeakTriggerCache, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, createTrigger, createTriggerCache, createWeakTriggerCache, entries, forEachEntry, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, withAccess }; |
@@ -0,18 +1,10 @@ | ||
import { DEV, getOwner, onCleanup, createSignal, getListener, untrack, batch } from 'solid-js'; | ||
import { isServer as isServer$1 } from 'solid-js/web'; | ||
// src/index.ts | ||
import { | ||
getOwner, | ||
onCleanup, | ||
createSignal, | ||
DEV, | ||
untrack, | ||
batch, | ||
getListener | ||
} from "solid-js"; | ||
import { isServer as _isServer } from "solid-js/web"; | ||
var noop = () => void 0; | ||
var isServer = _isServer; | ||
var isServer = isServer$1; | ||
var isClient = !isServer; | ||
var isDev = DEV && isClient; | ||
var isProd = !isDev; | ||
var warn = (...a) => isDev && console.warn(...a); | ||
var ofClass = (v, c) => v instanceof c || v && v.constructor === c; | ||
@@ -44,7 +36,2 @@ function isObject(value) { | ||
} | ||
function forEachEntry(object, iterator) { | ||
Object.entries(object).forEach( | ||
([key, item], index, pairs) => iterator(key, item, index, pairs, object) | ||
); | ||
} | ||
var entries = Object.entries; | ||
@@ -193,33 +180,4 @@ var keys = Object.keys; | ||
} | ||
export { | ||
access, | ||
accessArray, | ||
accessWith, | ||
arrayEquals, | ||
asAccessor, | ||
asArray, | ||
chain, | ||
clamp, | ||
compare, | ||
createCallbackStack, | ||
createMicrotask, | ||
createProxy, | ||
createStaticStore, | ||
createTrigger, | ||
createTriggerCache, | ||
createWeakTriggerCache, | ||
entries, | ||
forEachEntry, | ||
handleDiffArray, | ||
isClient, | ||
isDev, | ||
isObject, | ||
isProd, | ||
isServer, | ||
keys, | ||
noop, | ||
ofClass, | ||
onRootCleanup, | ||
warn, | ||
withAccess | ||
}; | ||
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, createTrigger, createTriggerCache, createWeakTriggerCache, entries, forEachEntry, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, withAccess }; |
{ | ||
"name": "@solid-primitives/utils", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "A bunch of reactive utility types and functions, for building primitives with Solid.js", | ||
@@ -17,9 +17,17 @@ "author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>", | ||
"sideEffects": false, | ||
"type": "module", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
"browser": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"keywords": [ | ||
@@ -34,17 +42,16 @@ "utilities", | ||
"prettier": "^2.7.1", | ||
"solid-js": "^1.5.1", | ||
"solid-register": "^0.2.5", | ||
"solid-js": "^1.5.0", | ||
"tslib": "^2.4.0", | ||
"tsup": "^6.2.2", | ||
"uvu": "^0.5.6", | ||
"watchlist": "^0.3.1" | ||
"tsup": "^6.2.3", | ||
"vitest": "^0.24.1" | ||
}, | ||
"browser": {}, | ||
"peerDependencies": { | ||
"solid-js": "^1.4.1" | ||
"solid-js": "^1.5.0" | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"test": "uvu -r solid-register", | ||
"test:watch": "watchlist src test -- npm test" | ||
"build": "jiti ../../scripts/build.ts", | ||
"test": "vitest -c ../../configs/vitest.config.ts", | ||
"test:ssr": "pnpm run test --mode ssr" | ||
} | ||
} |
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
6
24867
633