Nnodejs

nodejs/util-is

Replaces deprecated `util.is*()` methods with their modern equivalents.

transformationmigration
Public
0 downloads
2 stars
How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

util.is*()

This codemod replaces the following deprecated util.is*() methods with their modern equivalents:

Examples

BeforeAfter
util.isArray(value)Array.isArray(value)
util.isBoolean(value)typeof value === 'boolean'
util.isBuffer(value)Buffer.isBuffer(value)
util.isDate(value)value instanceof Date
util.isError(value)Error.isError(value)
util.isFunction(value)typeof value === 'function'
util.isNull(value)value === null
util.isNullOrUndefined(value)`value === null
util.isNumber(value)typeof value === 'number'
util.isObject(value)value && typeof value === 'object'
util.isPrimitive(value)Object(value) !== value
util.isRegExp(value)value instanceof RegExp
util.isString(value)typeof value === 'string'
util.isSymbol(value)typeof value === 'symbol'
util.isUndefined(value)typeof value === 'undefined'

Ready to contribute?

Build your own codemod and share it with the community.