1.1.0 • Published 3 years ago

is-exists v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

is-exists

is-exists

CI tag github actions coverage dependency status dev dependency status License Downloads

Check whether a global functions, global variables, modules, files, properties, user environments exists or not.

Installation

npm install is-exists

Example Usage

let {
  function_exists,
  variable_exists,
  file_exists,
  module_exists,
  property_exists,
  env_var_exists,
} = require("is-exists");

if (function_exists("isArray")) {
  //do the true statement code
}

if (variable_exists("isArray")) {
  //do the true statement code
}

(async () => {
  if (await file_exists("./src/index.js")) {
    //do the true statement code
  }
})();

if (module_exists("mocha")) {
  //do the true statement code
}

$obj = {
  hello: "hi",
};

if (property_exists("hello", $obj)) {
  //do the true statement code
}

if (env_var_exists("PROMPT")) {
  //do the true statement code
}

Contributing

You can follow the contributing guide listed here

API

function_exists

Parameters

  • 0: function name: string

Check whether global function is exist or not.

variable_exists

Parameters

  • 0: variable name: string

Check whether global variable is exist or not.

file_exists

Parameters

  • 0: filepath: string

Check whether file is exist or not. file_exists will start from root project directory location.

module_exists

Parameters

  • 0: module name: string

Check whether module is exist or not.

property_exists

Parameters

  • 0: property name: string
  • 1: defined object: object

Check whether property is exist or not.

env_var_exists

Parameters

  • 0: property name: string

Check whether user environment is exist or not.

License

is-exists was licensed under MIT License

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago