Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

escss-estest

Package Overview
Dependencies
Maintainers
0
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escss-estest

100% function coverage makes your life easier.

  • 1.0.3
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
72
decreased by-79.83%
Maintainers
0
Weekly downloads
 
Created
Source

escss-estest

100% function coverage makes your life easier.

Installation

  npm install escss-estest

Usage

 // operator mode
 * esTest(1, '<', 5)
 * esTest(5, '>', 1)
 * esTest(1, '<=', 5)
 * esTest(5, '>=', 1)
 * esTest(1, '!==', 2)
 * esTest(1, '===', 1)
 * esTest(1, '===', 100) // error
 * esTest(1, '===', 100, 'foo') // error & message
 *
 * // type mode
 * esTest(1, 'number')
 * esTest(1n, 'bigint')
 * esTest('foo', 'string')
 * esTest(true, 'boolean')
 * esTest([], 'array')
 * esTest({}, 'object')
 * esTest(NaN, 'NaN')
 * esTest(null, 'null')
 * esTest(undefined, 'undefined')
 * esTest(Symbol(), 'symbol')
 * esTest(function () {}, 'function')
 * esTest(1, 'object') // error
 * esTest(1, 'object', 'foo') // error & message

Examples

  // basic
  function sum(a, b) {
    {
      esTest(a, 'number')
      esTest(b, 'number', 'should be number type')
    }

    return a + b
  }

  // async/await
  async function getData() {
    const url = "https://jsonplaceholder.typicode.com/todos/1";
    const response = await fetch(url);
    const json = await response.json();

    {
      esTest(json.completed, 'boolean')
      esTest(json.id, 'number')
      esTest(json.title, 'string')
      esTest(json.userId, 'number')
    }

    console.log(json);
  }

License

Dual Licensing( Commercial or AGPL 3.0 ), see here to know more

Keywords

FAQs

Package last updated on 17 Aug 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