Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

abbrev-kindof

Package Overview
Dependencies
3
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Install size
39.9 kB
Created
Weekly downloads
 

Changelog

Source

1.0.5 - 2016-02-11

  • Release v1.0.5 / npm@v1.0.5
  • update license year range and other misc stuff
  • greenkeepr enable repo
  • bump to kind-of@3
  • add docs

Readme

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

Last updated on 11 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc