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

abbrev-kindof

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abbrev-kindof

Use abbreviations for checking type of given value. Like `kindof(val, 'soa')` to check that value is string, object or array.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

abbrev-kindof npmjs.com The MIT License

Use abbreviations for checking type of given value. Like kindof(val, 'soa') to check that value is string, object or array.

code climate standard code style travis build status coverage status dependency status

Install

npm i abbrev-kindof --save

Usage

For more use-cases see the tests

const abbrevKindof = require('abbrev-kindof')

abbrevKindof

Check type of a val with abbreviations.

Params

  • val {Mixed}: value to check
  • type {String|Array}: list of single-letter (abbr) types
  • returns {Boolean}: if true, so val match one of the abbreviated types

Example

// `soa` here means - string, object or array
abbrevKindof(123, 'soa')          //=> false
abbrevKindof('foo bar', 'soa')    //=> true
abbrevKindof({a: 123}, 'soa')     //=> true
abbrevKindof(['c', 'd'], 'soa')   //=> true

Available abbreviations

Using map-types

  • a for array
  • b for boolean
  • f for function
  • n for number
  • o for object
  • r for regexp
  • s for string
  • y for symbol
  • assert-kindof: Check native type of the given value and throw TypeError if not okey. Expressive, elegant, behavior-driven API, good descriptive default error messages, simple and clean syntax. | homepage
  • is-kindof: Check type of given javascript value. Support promises, generators, streams, and native types. Thin wrapper around kind-of module. | homepage
  • kind-error: Base class for easily creating meaningful and quiet by default Error classes with sane defaults and assertion in mind. | homepage
  • kind-of: Get the native type of a value. | homepage
  • kind-of-extra: Extends kind-of type check utility with support for promises, generators, streams and errors. Like kindof(Promise.resolve(1)) === 'promise' and etc. | homepage
  • kind-of-types: List of all javascript types. Used and useful for checking, validation, sanitizing and testing. Like isStream, isPromise, isWeakset and etc. | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Keywords

FAQs

Package last updated on 11 Feb 2016

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