New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

istrue

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

istrue

A useful function to check if a javascript object evaluates to `true`

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

isTrue

A useful function to check if a javascript object evaluates to true

Getting started

Bower:

bower install isTrue

npm:

npm install istrue --save

Or clone from github:

git clone https://github.com/codeocelot/istrue.git.

node:

require("./path/to/repo/main.js");

html embedded js:

<script src="./path/to/main.js' type="text/javascript">

run tests (mocha,assert):

mocha test.js

How to use

"does this eval to true".isTrue() === true

"".isTrue() === false

Numbers, Arrays & Objects too! (don't forget the paratheses, otherwise js thinks it's a decimal!)

(0).isTrue() === false

(1).isTrue() === true

({}).isTrue() === true // js likes parans around obj/array declarations

([]).isTrue() === true

Future

I can't think of a future for extentending this simple function. Share your thoughts if you have ideas!

Keywords

node

FAQs

Package last updated on 23 Jun 2015

Did you know?

Socket

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.

Install

Related posts