Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
A collection of composable JavaScript runtime type predicates with TypeScript type guard declarations
Isntnt is a collection of composable JavaScript runtime type predicates with TypeScript type guard declarations. Supports generics including union and intersection types.
const isAboveZero = above(0) // (value: unknown) => value is number
const isBetween0And21 = and(above(0), below(21)) // (value: unknown) => value is number
const isAnyArray = array(isAny) // (value: unknown) => value is Array<any>
const isAnyAtFoo = at('foo', isAny) // (value: unknown) => value is { foo: any }
const isBelow21 = below(21) // (value: unknown) => value is { foo: any }
const isFooOrBar = either('foo', 'bar') // (value: unknown) => value is 'foo' | 'bar'
const hasFoo = has('foo') // (value: unknown) => value is { 'foo': unknown }
const isInstanceofString = instance(String) // (value: unknown) => value is String
const is42 = literal(42) // (value: unknown) => value is 42
const isMax255 = max(255) // (value: unknown) => value is number
const isMin18 = min(18) // (value: unknown) => value is number
const isNoneableString = noneable(isString) // (value: unknown) => value is string | null | undefined
const isNullableString = nullable(isString) // (value: unknown) => value is string | null
const isEnum = object(isNumber) // (value: unknown) => value is ObjectOf<number>
const isOptionalString = optional(isString) // (value: unknown) => value is string | undefined
const isStringOrNumber = or(isString, isNumber) // (value: unknown) => value is string | number
const isEnum = record(isString, isNumber) // (value: unknown) => value is Record<string, number>
Note: record
is limited to string
and symbol
type keys.
const isPosition = shape({ x: isNumber, y: isNumber }) // (value: unknown) => value is { x: number, y: number }
const isSlug = test(/^[\w-]+$/) // (value: unknown) => value is string
const isEntry = tuple(isNumber, isNumber) // (value: unknown) => value is [number, number]
isAny(value) // value is any
isArray(value) // value is Array<unknown>
isArrayLike(value) // value is Record<number, unknown>
isBigInt(value) // value is bigint
isBoolean(value) // value is boolean
isDate(value) // value is Date
isDictionary(value) // value is ObjectOf<string>
isFalse(value) // value is false
isFunction(value) // value is Function
isInt(value) // value is number
isInt8(value) // value is number
isInt16(value) // value is number
isInt32(value) // value is number
isLength(value) // value is number
isMap(value) // value is Map<any, unknown>
isNegative(value) // value is number
isNever(value) // value is never
isNone(value) // value is null | undefined
isNull(value) // value is null
isNumber(value) // value is number
isObject(value) // value is object
isObjectLike(value) // value is ObjectLike
isPositive(value) // value is number
isPrimitive(value) // value is Primitive
isRegExp(value) // value is RegExp
isSerializable(value) // value is Serializable
isSerializableArray(value) // value is Array<Serializable>
isSerializableNumber(value) // value is number
isSerializableObject(value) // value is Record<string, Serializable>
isSerializablePrimitive(value) // value is SerializablePrimitive
isSet(value) // value is Set<unknown>
isSome(value) // value is Some
isString(value) // value is string
isSymbol(value) // value is symbol
isTrue(value) // value is true
isUint(value) // value is number
isUint8(value) // value is number
isUint16(value) // value is number
isUint32(value) // value is number
isUndefined(value) // value is undefined
isWeakMap(value) // value is WeakMap<any, unknown>
isWithLength(value) // value is { length: number }
Intersect<A | B> // A & B
None // null | undefined
Predicate<T> // (value: unknown, ...rest: Array<unknown>) => value is T
Primitive // null | undefined | boolean | number | string | symbol | bigint
Serializable // SerializableArray | SerializableObject | SerializablePrimitive
SerializableArray // Array<Serializable>
SerializableObject // { [key: string]: Serializable }
SerializableObject // null | boolean | number | string
Some // Function | boolean | bigint | number | string | symbol | object
Static<Predicate<T>> // T
FAQs
A collection of composable JavaScript runtime type predicates with TypeScript type guard declarations
The npm package isntnt receives a total of 546 weekly downloads. As such, isntnt popularity was classified as not popular.
We found that isntnt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.