-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c97befe
Showing
11 changed files
with
359 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false | ||
|
||
[{,test/}{actual,fixtures}/**] | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false | ||
|
||
[templates/**] | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Enforce Unix newlines | ||
* text eol=lf | ||
|
||
# binaries | ||
*.ai binary | ||
*.psd binary | ||
*.jpg binary | ||
*.gif binary | ||
*.png binary | ||
*.jpeg binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.DS_Store | ||
*.sublime-* | ||
_gh_pages | ||
bower_components | ||
node_modules | ||
npm-debug.log | ||
actual | ||
test/actual | ||
temp | ||
tmp | ||
TODO.md | ||
vendor | ||
.idea | ||
benchmark | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"asi": false, | ||
"boss": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"esnext": true, | ||
"immed": true, | ||
"latedef": false, | ||
"laxcomma": false, | ||
"mocha": true, | ||
"newcap": true, | ||
"noarg": true, | ||
"node": true, | ||
"sub": true, | ||
"undef": true, | ||
"unused": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- "0.10" | ||
- "0.12" | ||
- "0.13" | ||
- "iojs" | ||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- node_js: "0.13" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# {%= name %} {%= badge("fury") %} | ||
|
||
> {%= description %} | ||
## Install | ||
{%= include("install-npm", {save: true}) %} | ||
|
||
## 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('{%= name %}'); | ||
|
||
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 | ||
{%= related(['is-plain-object', 'isobject', 'is-primitive']) %} | ||
|
||
## Running tests | ||
{%= include("tests") %} | ||
|
||
## Contributing | ||
{%= include("contributing") %} | ||
|
||
## Author | ||
{%= include("author") %} | ||
|
||
## License | ||
{%= copyright() %} | ||
{%= license() %} | ||
|
||
*** | ||
|
||
{%= include("footer") %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015, Jon Schlinkert. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# is-true [](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-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. | ||
* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. | ||
* [is-primitive](https://github.com/jonschlinkert/is-primitive): Returns `true` if the value is a primitive. | ||
|
||
## 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 May 21, 2015._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*! | ||
* is-true <https://github.com/jonschlinkert/is-true> | ||
* | ||
* Copyright (c) 2015, Jon Schlinkert. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var isObject = require('is-plain-object'); | ||
|
||
module.exports = function is(o, key) { | ||
if (!isObject(o)) { | ||
throw new TypeError('is-true expects the first argument to be an object.'); | ||
} | ||
if (typeof key !== 'string') { | ||
throw new TypeError('is-true expects the second argument to be a string.'); | ||
} | ||
|
||
var inverse = 'no' + key; | ||
if (o.hasOwnProperty(key) && o.hasOwnProperty(inverse)) { | ||
return o[key] === true && o[inverse] === false; | ||
} | ||
|
||
return o[key] === true || o[inverse] === false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "is-true", | ||
"description": "Returns `true` if the value of an object's property is strictly true, or it's inverse is false.", | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/jonschlinkert/is-true", | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jonschlinkert/is-true.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/jonschlinkert/is-true/issues" | ||
}, | ||
"license": "MIT", | ||
"files": [ | ||
"index.js" | ||
], | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"is-plain-object": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
}, | ||
"keywords": [ | ||
"boolean", | ||
"check", | ||
"is", | ||
"object", | ||
"property", | ||
"value" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/*! | ||
* is-true <https://github.com/jonschlinkert/is-true> | ||
* | ||
* Copyright (c) 2015 Jon Schlinkert. | ||
* Licensed under the MIT license. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* deps:mocha */ | ||
var assert = require('assert'); | ||
var isTrue = require('./'); | ||
|
||
describe('isTrue', function () { | ||
it('should return false if the value is not strictly true:', function () { | ||
assert.equal(isTrue({a: false}, 'a'), false); | ||
assert.equal(isTrue({a: 'false'}, 'a'), false); | ||
assert.equal(isTrue({a: 'true'}, 'a'), false); | ||
assert.equal(isTrue({a: 5}, 'a'), false); | ||
assert.equal(isTrue({a: []}, 'a'), false); | ||
}); | ||
|
||
it('should return true if the value is strictly true:', function () { | ||
assert.equal(isTrue({a: true}, 'a'), true); | ||
}); | ||
|
||
it('should return false if the inverse is not strictly false:', function () { | ||
assert.equal(isTrue({noa: true}, 'a'), false); | ||
assert.equal(isTrue({noa: 'false'}, 'a'), false); | ||
assert.equal(isTrue({noa: 'true'}, 'a'), false); | ||
assert.equal(isTrue({noa: 5}, 'a'), false); | ||
assert.equal(isTrue({noa: []}, 'a'), false); | ||
}); | ||
|
||
it('should return true if the inverse is strictly false:', function () { | ||
assert.equal(isTrue({noa: false}, 'a'), true); | ||
}); | ||
|
||
it('should return true if the value is true and the inverse is false:', function () { | ||
assert.equal(isTrue({noa: false, a: true}, 'a'), true); | ||
assert.equal(isTrue({noa: false, a: false}, 'a'), false); | ||
assert.equal(isTrue({noa: true, a: true}, 'a'), false); | ||
}); | ||
|
||
it('should throw an error when the first argument is not an object:', function () { | ||
assert.throws(function () { | ||
isTrue(null); | ||
}, 'is-true expects the first argument to be an object.'); | ||
|
||
assert.throws(function () { | ||
isTrue(''); | ||
}, 'is-true expects the first argument to be an object.'); | ||
}); | ||
|
||
it('should throw an error when the second argument is not a string:', function () { | ||
assert.throws(function () { | ||
isTrue({}); | ||
}, 'is-true expects the second argument to be a string.'); | ||
|
||
assert.throws(function () { | ||
isTrue({}, {}); | ||
}, 'is-true expects the second argument to be a string.'); | ||
|
||
assert.throws(function () { | ||
isTrue({}, null); | ||
}, 'is-true expects the second argument to be a string.'); | ||
}); | ||
}); |