@hugoalh/advanced-determine

A module to provide a better and more accurate way to determine item type.

Usage no npm install needed!

<script type="module">
  import hugoalhAdvancedDetermine from 'https://cdn.skypack.dev/@hugoalh/advanced-determine';
</script>

README

Advanced Determine (NodeJS)

AdvancedDetermine.NodeJS GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions GitHub Stars GitHub Forks GitHub Languages CodeFactor Grade LGTM Alerts LGTM Grade License

Release Latest (GitHub Latest Release Date) Pre (GitHub Latest Pre-Release Date)
GitHub GitHub Total Downloads GitHub Latest Release Version GitHub Latest Pre-Release Version
NPM NPM Total Downloads NPM Latest Release Version NPM Latest Pre-Release Version

📝 Description

A NodeJS module to provide a better and more accurate way to determine item type.

🌟 Feature

  • Better and more accurate type determine similar to TypeScript.
  • Easier to identify empty string (""), empty array ([]), and empty object ({}).

📚 Documentation

For the official documentation, please visit GitHub Repository Wiki.

Getting Started (Excerpt)

Install

NodeJS (>= v14.15.0) + NPM (>= v6.14.8):

npm install @hugoalh/advanced-determine

Use In CommonJS

const advancedDetermine = require("@hugoalh/advanced-determine");

Use In ModuleJS

import * as advancedDetermine from "@hugoalh/advanced-determine";

API (Excerpt)

Function

  • areEqual(...items)
  • isArray(item, option?)
  • isBigInteger(item, option?)
  • isFunction(item, option?)
  • isGenerator(item, option?)
  • isJSON(item, option?)
  • isMap(item, option?)
  • isNumber(item, option?)
  • isObject(item)
  • isPlainObject(item, option?)
  • isRegularExpression(item, option?)
  • isSet(item, option?)
  • isString(item, option?)
  • isStringifyJSON(item, option?)
  • typeOf(item)

Example (Excerpt)

advancedDetermine.isArray([], { empty: false });
//=> false

advancedDetermine.isNumber(8.31, { float: true, positive: true, safe: true });
//=> true

advancedDetermine.isString("", { empty: false });
//=> false

advancedDetermine.isString("Hello World", { lowerCase: true });
//=> false