New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tm-is

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tm-is

JavaScript basic 'is' functions.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
increased by533.33%
Maintainers
0
Weekly downloads
 
Created
Source

tm-is

npm codecov

JavaScript basic 'is' functions for Node.

Installation

npm i tm-is

Description

Module provides a bunch of functions which return true or false. All functions support zero or more arguments. If several arguments passed, all of them should meet function conditions. Conditions for each function described in the Functions section.

E.g.

  isObject({}); // true
  isObject({}, {}); // true
  isObject({}, 'str'); // false, since not all arguments are objects.

Functions

  • isEmpty: Returns true if passed argument is null, empty string or undefined.
  • isObject/isObj: Returns true if passed argument is an object except null.
  • isFunction/isFunc: Returns true if passed argument is a function.
  • isUndefined/isUndef: Returns true if passed argument is undefined.
  • isEqualArrays/isEqArr: Returns true if passed arguments are equal arrays.
  • isValidDate/isDate: Returns true if passed arguments are valid date string or number.

Examples

const { isObject, isFunction } = require('tm-is');

console.log(isObject({})); // true
console.log(isObject(null)); // false
console.log(isObject('string')); // false

console.log(isFunction('null')); // false
console.log(isFunction('string')); // false
console.log(isFunction(() => { })); // true

console.log(isValidDate(null)); // false
console.log(isValidDate('qwertyuiop')); // false
console.log(isValidDate('2024-12-27')); // true

Keywords

FAQs

Package last updated on 28 Dec 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc