
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Simple, lightweight at-runtime type checking functions, with full TypeScript support
Simple, lightweight at-runtime type checking functions, with full TypeScript support
assertType and isOfType narrow the types of things, and will refine them accordinglyimport * as types from "pheno";
function something(first: unknown, second: unknown) {
// Throws an error if `first` is not a string
types.assertType(first, types.string);
// Throws an error if `second` is not `string | number`
types.assertType(second, types.union(types.string, types.number));
// Typescript now knows that `first` is a string and `second` is `string | number`
return first + " " + String(second);
}
andanyanyArrayanyFunctionanyMapanyObjectanySetanyTypeValidatorarray (alias of arrayOfUnknown)arrayOfarrayOfAnyarrayOfUnknownArray (alias of arrayOfUnknown)assertType (assert that a value has the provided type, and throw an error message if it doesn't)asType (do a TypeScript as cast to convert the value into the provided type)bigintBigInt (alias of bigint)booleanBoolean (alias of boolean)DateErrorexactBigIntexactNumberexactStringexactSymbolfalsefalsyFunction (alias of unknownFunction)hasClassNamehasToStringTagInfinityinstanceOfintegerintersectionisOfType (return a boolean indicating if a value is of the provided type)map (alias of unknownMap)Map (alias of unknownMap)mapOfmappingObjectOfmaybeNaNNegativeInfinitynevernonNullOrUndefinednullnullishvoid (alias of nullish)number (doesn't include NaN, Infinity, or -Infinity)Number (alias of number)numberIncludingNanAndInfinitiesobject (alias of unknownObject)Object (alias of unknownObject)objectOrNullobjectWithOnlyThesePropertiesobjectWithPropertiesoroptionalpartialObjectWithPropertiesrecordRegExpset (alias of unknownSet)Set (alias of unknownSet)setOfstringString (alias of string)stringifyValue (safe and lightweight value-to-string function, for printing values in error messages)stringMatchingSymbolsymbol (alias of Symbol)symbolFortruetruthytupleundefinedunionunknownunknownFunctionunknownMapunknownObjectunknownSetunknownTypeValidatorArrayBufferSharedArrayBufferDataViewTypedArrayInt8ArrayUint8ArrayUint8ClampedArrayInt16ArrayUint16ArrayInt32ArrayUint32ArrayFloat32ArrayFloat64ArrayPlease see the TypeScript types for each of these in either your editor's autocomplete or pheno's source code for more information.
MIT
FAQs
Simple, lightweight at-runtime type checking functions, with full TypeScript support
The npm package pheno receives a total of 387 weekly downloads. As such, pheno popularity was classified as not popular.
We found that pheno demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.