Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeyism/node-kontains
A small tool that determines whether an object or an array contains an element
https://github.com/joeyism/node-kontains
Last synced: 5 days ago
JSON representation
A small tool that determines whether an object or an array contains an element
- Host: GitHub
- URL: https://github.com/joeyism/node-kontains
- Owner: joeyism
- Created: 2015-08-12T23:15:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-12T23:53:09.000Z (over 9 years ago)
- Last Synced: 2024-10-28T00:06:06.354Z (16 days ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/kontains
- Size: 2.31 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kontains
[![Build Status](https://travis-ci.org/joeyism/node-kontains.svg?branch=master)](https://travis-ci.org/joeyism/node-kontains)
[![Coverage Status](https://coveralls.io/repos/joeyism/node-kontains/badge.svg?branch=master&service=github)](https://coveralls.io/github/joeyism/node-kontains?branch=master)A small tool to let you know if an object or an array contains an element
## Installation
To install in node, simply run> npm install --save kontains
To use in browser, simply add
## Usage
For your object or array, just add `.contains()` at the end to determine if they contain such element. It is important to note that the searching is also case sensitive.### Object
{"elm1": "one", "elm2": "two"}.contains("elm1") // true
{"elm1": "one", "elm2": "two"}.contains("elm2") // true
{"elm1": "one", "elm2": "two"}.contains("one") // false
{"elm1": "one", "elm2": "two"}.contains("ELM2") // false### Array
[1, 2, 3].contains(1) // true
[1, 2, 3].contains(one) // false## Version
**1.0.0**
* First publish