UNPKG

is-true

Version:

Returns `true` if the value of an object's property is strictly true, or it's inverse is false.

76 lines (48 loc) 2.47 kB
# is-true [![NPM version](https://badge.fury.io/js/is-true.svg)](http://badge.fury.io/js/is-true) > Returns `true` if the value of an object's property is strictly true, or it's inverse is false. ## Install Install with [npm](https://www.npmjs.com/) ```sh $ npm i is-true --save ``` ## Usage Returns true if a property is strictly `true` or its inverse is strictly `false`. The inverse of `a` is `noa`, the inverse of `b` is `nob`, and so on. ```js var isTrue = require('is-true'); isTrue({a: true}, 'a'); //=> true isTrue({noa: false}, 'a'); //=> true ``` If a property and it's inverse both exist, both must evaluate to the same result, or `false` is returned. **Examples** ```js isTrue({noa: false, a: true}, 'a'); //=> true isTrue({noa: false, a: false}, 'a'); //=> false isTrue({noa: true, a: true}, 'a'); //=> false ``` ## Related projects * [is-false](https://www.npmjs.com/package/is-false): Returns false if the value of a property is either strictly false, or it's inverse… [more](https://www.npmjs.com/package/is-false) | [homepage](https://github.com/jonschlinkert/is-false) * [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object) * [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive) * [is-true](https://www.npmjs.com/package/is-true): Returns `true` if the value of an object's property is strictly true, or it's inverse… [more](https://www.npmjs.com/package/is-true) | [homepage](https://github.com/jonschlinkert/is-true) * [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) ## Running tests Install dev dependencies: ```sh $ npm i -d && npm test ``` ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-true/issues/new). ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright © 2015 Jon Schlinkert Released under the MIT license. *** _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 01, 2015._