Socket
Socket
Sign inDemoInstall

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 - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

LICENSE

11

CHANGELOG.md
## 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
## 1.0.4 - 2015-05-17

@@ -32,3 +39,3 @@ - Release v1.0.4 / npm@v1.0.4

## 0.0.0 - 2015-05-02
- first commits
## 0.0.0 - 2015-08-30
- Initial commit
/*!
* abbrev-kindof <https://github.com/tunnckoCore/abbrev-kindof>
*
* Copyright (c) 2015 Charlike Mike Reagent, contributors.
* Copyright (c) 2015-2016 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.

@@ -13,2 +13,20 @@ */

/**
* > Check type of a `val` with abbreviations.
*
* **Example**
*
* ```js
* // `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
* ```
*
* @param {Mixed} `val` value to check
* @param {String|Array} `type` list of single-letter [(abbr) types](https://github.com/jonschlinkert/map-types)
* @return {Boolean} if `true`, so `val` match one of the abbreviated types
* @api public
*/
module.exports = function abbrevKindof (val, type) {

@@ -15,0 +33,0 @@ var abbrs = abbrev(type)

38

package.json
{
"name": "abbrev-kindof",
"version": "1.0.4",
"description": "`kind-of` with single letter abbreviations to javascript native types, like `kindof(val, 'soa')` will return true if `val` is string, object or array. useful for DB/Schema/Object validations",
"version": "1.0.5",
"description": "Use abbreviations for checking type of given value. Like `kindof(val, 'soa')` to check that value is string, object or array.",
"repository": "tunnckoCore/abbrev-kindof",
"author": "Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)",
"precommit.silent": true,
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "standard && node test.js"
},
"author": {
"name": "Charlike Mike Reagent",
"email": "mameto_100@mail.bg",
"url": "https://github.com/tunnckoCore"
"dependencies": {
"kind-of": "^3.0.2",
"map-types": "^0.1.0"
},
"repository": {
"type": "git",
"url": "git://github.com/tunnckoCore/abbrev-kindof.git"
"devDependencies": {
"assertit": "^0.1.0",
"pre-commit": "*"
},
"files": [
"index.js"
],
"keywords": [

@@ -35,14 +42,3 @@ "abbrev",

"validating"
],
"license": {
"type": "MIT",
"url": "https://github.com/tunnckoCore/abbrev-kindof/blob/master/LICENSE.md"
},
"dependencies": {
"kind-of": "^1.1.0",
"map-types": "^0.1.0"
},
"devDependencies": {
"assertit": "^0.1.0"
}
]
}

@@ -1,4 +0,4 @@

# abbrev-kindof [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url]
# [abbrev-kindof][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url]
> `kind-of` with single letter abbreviations to javascript native types, like `kindof(val, 'soa')` will return true if `val` is string, object or array. useful for DB/Schema/Object validations
> Use abbreviations for checking type of given value. Like `kindof(val, 'soa')` to check that value is string, object or array.

@@ -11,3 +11,2 @@ [![code climate][codeclimate-img]][codeclimate-url] [![standard code style][standard-img]][standard-url] [![travis build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![dependency status][david-img]][david-url]

npm i abbrev-kindof --save
npm test
```

@@ -20,18 +19,27 @@

```js
const abbrevKindof = require('abbrev-kindof')
```
abbrevKindof(123, 'soa');
//=> false
### [abbrevKindof](index.js#L31)
> Check type of a `val` with abbreviations.
abbrevKindof(['foo', 'bar'], 'soa');
//=> true
**Params**
abbrevKindof('foo bar', 'soa');
//=> true
* `val` **{Mixed}**: value to check
* `type` **{String|Array}**: list of single-letter [(abbr) types](https://github.com/jonschlinkert/map-types)
* `returns` **{Boolean}**: if `true`, so `val` match one of the abbreviated types
abbrevKindof({foo: 'bar'}, 'soa');
//=> true
**Example**
```js
// `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](https://github.com/jonschlinkert/map-types)
# Possible abbreviations
- `a` for `array`

@@ -47,11 +55,12 @@ - `b` for `boolean`

## Related
- [assert-kindof](https://github.com/tunnckoCore/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.
- [is-kindof](https://github.com/tunnckoCore/is-kindof): Thin wrapper around `kind-of` and in bonus functional api.
- [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value.
- [map-types](https://github.com/jonschlinkert/map-types): Map single letter abbreviations to javascript native types. Useful as a shorthand for pseudo-argument destructuring when debugging.
## Related Libs
* [assert-kindof](https://www.npmjs.com/package/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](https://github.com/tunnckoCore/assert-kindof)
* [is-kindof](https://www.npmjs.com/package/is-kindof): Check type of given javascript value. Support promises, generators, streams, and native types. Thin wrapper around `kind-of` module. | [homepage](https://github.com/tunnckocore/is-kindof)
* [kind-error](https://www.npmjs.com/package/kind-error): Base class for easily creating meaningful and quiet by default Error classes with sane defaults and assertion in mind. | [homepage](https://github.com/tunnckocore/kind-error)
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of)
* [kind-of-extra](https://www.npmjs.com/package/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](https://github.com/tunnckocore/kind-of-extra)
* [kind-of-types](https://www.npmjs.com/package/kind-of-types): List of all javascript types. Used and useful for checking, validation, sanitizing and testing. Like isStream, isPromise, isWeakset and etc. | [homepage](https://github.com/tunnckocore/kind-of-types)
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/tunnckoCore/abbrev-kindof/issues/new).

@@ -69,3 +78,3 @@ But before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines.

[license-url]: https://github.com/tunnckoCore/abbrev-kindof/blob/master/LICENSE.md
[license-url]: https://github.com/tunnckoCore/abbrev-kindof/blob/master/LICENSE
[license-img]: https://img.shields.io/badge/license-MIT-blue.svg

@@ -109,2 +118,2 @@

[new-message-url]: https://github.com/tunnckoCore/messages
[new-message-img]: https://img.shields.io/badge/send%20me-message-green.svg
[new-message-img]: https://img.shields.io/badge/ask%20me-anything-green.svg
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