# ifonly

> ifonly is function that checks if your object have only and only specific properties you passed.

Latest version **2.2.0** (published 2016-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install ifonly
pnpm add ifonly
yarn add ifonly
bun add ifonly
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2016-10-18 |
| First published | 2015-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Aleksandar Gosevski |
| Maintainers | goschevski |
| Keywords | if, only |

## Links

- npm: https://www.npmjs.com/package/ifonly
- Repository: https://github.com/goschevski/ifonly
- Issues: https://github.com/goschevski/ifonly/issues
- npm.io page: https://npm.io/package/ifonly

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2016-10-18
- 2.1.0 — 2016-10-06
- 2.0.1 — 2016-10-06
- 2.0.0 — 2016-10-05
- 1.1.0 — 2016-09-16
- 1.0.0 — 2015-01-14

## README

# ifonly

[![Build Status](https://travis-ci.org/goschevski/ifonly.svg?branch=master)](https://travis-ci.org/goschevski/ifonly)

ifonly is function that checks if your object have only and only specific properties you passed.

It works in both node and client-side applications.

### Example

```javascript
var obj;

obj = { a: 'a'};
console.log(only(obj, ['a'])); // true because only 'a' property is present

obj = { a: 'a', b: 'b', c: 'c' };
console.log(only(obj, ['a', 'b'])); // false because 'c' property is present

obj = { a: 'a' };
console.log(ifonly(obj, ['a', 'b'])); // false because 'b' does not exist

obj = { a: 'a', b: 'b', c: 'c' };
console.log(only(obj, ['a', 'b'], ['c'])); // true because 'c' property is ignored

obj = { a: '', b: 'b', c: '' };
console.log(only(obj, ['b'])); // true because 'a' and 'c' properties are empty

obj = { a: [], b: 'b', c: {} };
console.log(only(obj, ['b'])); // true because 'a' and 'c' properties are empty
```

---
_Source: https://npm.io/package/ifonly · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
