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

is-defined-eval

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-defined-eval

Evaluates is-defined expression and returns the value of the evaluation

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

is-defined-eval

Checks if a variable is defined.

(Eval)uates a variable identifier like this:

'typeof ' + identifier + ' !== "undefined"'

Consider it as a shortcut to the above.

Example (on nodejs in console):


const isDefined = require('is-defined-eval');

var exportsExists = isDefined('exports');
console.log(exportsExists); // => true

var windowExists = isDefined('window');
console.log(windowExists); // => false

var documentExists = isDefined('document');
console.log(documentExists); // => false

License MIT

Keywords

eval

FAQs

Package last updated on 19 Jan 2017

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