Skip to content
This repository has been archived by the owner on Sep 13, 2019. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Feb 24, 2015
0 parents commit d546448
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[test/fixtures/*]
insert_final_newline = false
trim_trailing_whitespace = false
10 changes: 10 additions & 0 deletions .gitattributes
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
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.DS_Store
*.DS_store
*.sublime-*
_gh_pages
bower_components
node_modules
npm-debug.log
actual
test/actual
temp
tmp
TODO.md
vendor
19 changes: 19 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"asi": false,
"boss": true,
"camelcase": 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
}
42 changes: 42 additions & 0 deletions .verb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# {%= name %} {%= badge("fury") %}

> {%= description %}
{%= include("install-npm", {save: true}) %}

## Usage

```js
var isEven = require('{%= name %}');

isEven(0);
//=> true
isEven('1');
//=> false
isEven(2);
//=> true
isEven('3');
//=> false
```

## Run tests

Install dev dependencies:

```bash
npm i -d && npm test
```

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %})

## Author
{%= include("author") %}

## License
{%= copyright() %}
{%= license() %}

***

{%= include("footer") %}
21 changes: 21 additions & 0 deletions LICENSE
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.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# is-even [![NPM version](https://badge.fury.io/js/is-even.svg)](http://badge.fury.io/js/is-even)

> Return true if the given number is even.
## Install with [npm](npmjs.org)

```bash
npm i is-even --save
```

## Usage

```js
var isEven = require('is-even');

isEven(0);
//=> true
isEven('1');
//=> false
isEven(2);
//=> true
isEven('3');
//=> false
```

## Run tests

Install dev dependencies:

```bash
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-even/issues)

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License
Copyright (c) 2015 Jon Schlinkert
Released under the license

***

_This file was generated by [verb](https://github.com/assemble/verb) on February 24, 2015._
18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*!
* is-even <https://github.com/jonschlinkert/is-even>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/

'use strict';

var isNumber = require('is-number');
var isOdd = require('is-odd');

module.exports = function isEven(i) {
if (!isNumber(i)) {
throw new TypeError('is-even expects a number.');
}
return !isOdd(i);
};
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "is-even",
"description": "Return true if the given number is even.",
"version": "0.1.1",
"homepage": "https://github.com/jonschlinkert/is-even",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"repository": "jonschlinkert/is-even",
"bugs": {
"url": "https://github.com/jonschlinkert/is-even/issues"
},
"license": "MIT",
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
"is-number": "^1.1.0",
"is-odd": "^0.1.0"
},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"keywords": [
"array",
"count",
"even",
"filter",
"integer",
"math",
"numeric",
"odd",
"string"
]
}
34 changes: 34 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*!
* is-even <https://github.com/jonschlinkert/is-even>
*
* Copyright (c) 2015 Jon Schlinkert.
* Licensed under the MIT license.
*/

'use strict';

var isEven = require('./');
require('should');

describe('isEven', function () {
it('should return true if the number is odd:', function () {
isEven(0).should.be.true;
isEven(1).should.be.false;
isEven(2).should.be.true;
isEven(3).should.be.false;
});

it('should work with strings:', function () {
isEven('0').should.be.true;
isEven('1').should.be.false;
isEven('2').should.be.true;
isEven('3').should.be.false;
});

it('should throw an error on bad args:', function () {
(function () {
isEven();
}).should.throw('is-even expects a number.');
});
});

0 comments on commit d546448

Please sign in to comment.