
Security News
npm Tooling Bug Incorrectly Marks One-Character Packages as Security Holders
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.
@elucidata/type
Advanced tools
An enhanced typeof function. Reliably returns object types, and element types for modern browsers.
import { type } from "@elucidata/type"
type(null)
// => "null"
type(window.undefinedProperty)
// => "undefined"
type("test")
// => "string"
type(new String())
// => "string"
type(1)
// => "number"
type(new Number())
// => "number"
type(true)
// => "boolean"
type(new Boolean())
// => "boolean"
type(/test/)
// => "regexp"
type(new RegExp())
// => "regexp"
type(new Date())
// => "date"
type(["test"])
// => "array"
type(new Array())
// => "array"
type({ test: "test" })
// => "object"
type(new Object())
// => "object"
type(document)
// => "document"
type(document.querySelectorAll("*"))
// => "nodelist"
type(document.body)
// => "bodyelement"
type(document.createElement("div"))
// => "divelement"
type(Symbol("test"))
// => "symbol"
Includes helper methods for each type that work as type guards if used in TypeScript:
import * as type from "@elucidata/type"
type.isObject(target)
type.isNotObject(target)
type.isBoolean(target)
type.isNotBoolean(target)
type.isNumber(target)
type.isNotNumber(target)
type.isString(target)
type.isNotString(target)
type.isFunction(target)
type.isNotFunction(target)
type.isArray(target)
type.isNotArray(target)
type.isDate(target)
type.isNotDate(target)
type.isRegExp(target)
type.isNotRegExp(target)
type.isUndefined(target)
type.isNotUndefined(target)
type.isNull(target)
type.isNotNull(target)
type.isNodeList(target)
type.isNotNodeList(target)
type.isSymbol(target)
type.isNotSymbol(target)
type.isElement(target)
type.isNotElement(target)
// is[Not]Element() deals with HTMLElements
type.isElement(document.body) // => true
type.isElement({}) // => false
Pick your poison:
npm install @elucidata/type
bower install @elucidata/type
export declare const getType: (target: any) => string
export declare const of: (target: any) => string
export declare const type: (target: any) => string
export declare const isBoolean: (target: any) => target is boolean
export declare const isNotBoolean: (target: any) => target is unknown
export declare const isNumber: (target: any) => target is number
export declare const isNotNumber: (target: any) => target is unknown
export declare const isString: (target: any) => target is string
export declare const isNotString: (target: any) => target is unknown
export declare const isFunction: (target: any) => target is Function
export declare const isNotFunction: (target: any) => target is unknown
export declare const isArray: (target: any) => target is any[]
export declare const isNotArray: (target: any) => target is unknown
export declare const isDate: (target: any) => target is Date
export declare const isNotDate: (target: any) => target is unknown
export declare const isRegExp: (target: any) => target is RegExp
export declare const isNotRegExp: (target: any) => target is unknown
export declare const isUndefined: (target: any) => target is undefined
export declare const isNotUndefined: (target: any) => target is unknown
export declare const isNull: (target: any) => target is null
export declare const isNotNull: (target: any) => target is unknown
export declare const isNodeList: (target: any) => target is NodeList
export declare const isNotNodeList: (target: any) => target is unknown
export declare const isObject: (target: any) => target is Object
export declare const isNotObject: (target: any) => target is unknown
export declare const isSymbol: (target: any) => target is Symbol
export declare const isNotSymbol: (target: any) => target is unknown
export declare const isEmpty: (target: any) => boolean
export declare const isNotEmpty: (target: any) => boolean
export declare const isElement: (target: any) => target is HTMLElement
export declare const isNotElement: (target: any) => target is unknown
FAQs
Enhanced typeof function
The npm package @elucidata/type receives a total of 2 weekly downloads. As such, @elucidata/type popularity was classified as not popular.
We found that @elucidata/type demonstrated a not healthy version release cadence and project activity because the last version was released 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
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.