
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.
is-blank-js
Advanced tools
A lightweight utility that adds an .isBlank() method to native JavaScript types, inspired by Ruby on Rails' Object#blank?.
A JavaScript utility to check for blank values, inspired by Ruby on Rails' blank? method.
This library extends the prototypes of String, Array, Object, and Boolean to include an isBlank() method.
npm install is-blank-js
First, require the package to extend the prototypes:
require('is-blank-js');
Then, you can use the isBlank() method on your objects:
A string is blank if it's empty or contains only whitespace.
"".isBlank() // => true
" ".isBlank() // => true
"hello".isBlank() // => false
An array is blank if it's empty.
[].isBlank() // => true
[1, 2].isBlank() // => false
An object is blank if it's a plain object with no keys.
({}).isBlank() // => true
({ a: 1 }).isBlank() // => false
A boolean is blank if it's false.
false.isBlank() // => true
true.isBlank() // => false
A number is never blank.
(0).isBlank() // => false
(1).isBlank() // => false
blank?This library aims to replicate the behavior of Rails' blank? method for common JavaScript types.
| Value in JavaScript | isBlank() |
|---|---|
"" | true |
" " | true |
[] | true |
{} | true |
false | true |
true | false |
0 | false |
null | (error) |
undefined | (error) |
Note: This library does not handle null or undefined because they don't have prototypes to extend. Calling isBlank() on null or undefined will result in a TypeError.
To run the tests:
node test.js
FAQs
A lightweight utility that adds an .isBlank() method to native JavaScript types, inspired by Ruby on Rails' Object#blank?.
We found that is-blank-js 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.