Skip to content

Commit

Permalink
[INIT]
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Aug 30, 2014
0 parents commit df1c07e
Show file tree
Hide file tree
Showing 11 changed files with 519 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

# Directories #
###############
reports/
build/

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
Desktop.ini

# Temporary files #
###################
*~

# Node.js #
###########
node_modules/

# Matlab #
##########

# Windows default autosave extension
*.asv

# Compiled MEX binaries (all platforms)
*.mex*
49 changes: 49 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

# Files #
#########
Makefile
README.md
TODO.md

# Directories #
###############
build/
docs/
examples/
reports/
support/
test/

# Node.js #
###########
.npmignore
node_modules/

# Logs #
########
*.log

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
Desktop.ini

# Temporary files #
###################
*~

# Git #
#######
.git*

# Utilities #
#############
.jshintrc
.travis.yml
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- '0.10'
after_script:
- npm run coveralls

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) 2014 Athan Reines.

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.
117 changes: 117 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

#############
# VARIABLES #

# Set the node.js environment to test:
NODE_ENV ?= test


# NOTES #

NOTES ?= 'TODO|FIXME'


# MOCHA #

# Specify the test framework bin locations:
MOCHA ?= ./node_modules/.bin/mocha
_MOCHA ?= ./node_modules/.bin/_mocha

# Specify the mocha reporter:
MOCHA_REPORTER ?= spec


# ISTANBUL #

# Istanbul configuration:
ISTANBUL ?= ./node_modules/.bin/istanbul
ISTANBUL_OUT ?= ./reports/coverage
ISTANBUL_REPORT ?= lcov
ISTANBUL_LCOV_INFO_PATH ?= $(ISTANBUL_OUT)/lcov.info
ISTANBUL_HTML_REPORT_PATH ?= $(ISTANBUL_OUT)/lcov-report/index.html



# FILES #

# Source files:
SOURCES ?= app/*.js

# Test files:
TESTS ?= test/*.js




###########
# TARGETS #


# NOTES #

.PHONY: notes

notes:
grep -Ern $(NOTES) $(SOURCES) $(TESTS)



# UNIT TESTS #

.PHONY: test test-mocha

test: test-mocha

test-mocha: node_modules
NODE_ENV=$(NODE_ENV) \
NODE_PATH=$(NODE_PATH_TEST) \
$(MOCHA) \
--reporter $(MOCHA_REPORTER) \
$(TESTS)



# CODE COVERAGE #

.PHONY: test-cov test-istanbul-mocha

test-cov: test-istanbul-mocha

test-istanbul-mocha: node_modules
NODE_ENV=$(NODE_ENV) \
NODE_PATH=$(NODE_PATH_TEST) \
$(ISTANBUL) cover \
--dir $(ISTANBUL_OUT) --report $(ISTANBUL_REPORT) \
$(_MOCHA) -- \
--reporter $(MOCHA_REPORTER) \
$(TESTS)



# COVERAGE REPORT #

.PHONY: view-cov view-istanbul-report

view-cov: view-istanbul-report

view-istanbul-report:
open $(ISTANBUL_HTML_REPORT_PATH)



# NODE #

# Installing node_modules:
install:
npm install

# Clean node:
clean-node:
rm -rf node_modules



# CLEAN #

clean:
rm -rf build
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
Object
======
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]

> Validates if a value is a plain JavaScript object.


## Installation

``` bash
$ npm install validate.io-object
```

## Usage

To use the module,

``` javascript
var isObject = require( 'validate.io-object' );

console.log( isObject( {} ) );
// Returns true

console.log( isObject( [] ) );
// Returns false
```


## Examples

To run the example code from the top-level application directory,

``` bash
$ node ./examples/index.js
```


## Tests

### Unit

Unit tests use the [Mocha](http://visionmedia.github.io/mocha) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:

``` bash
$ make test
```

All new feature development should have corresponding unit tests to validate correct functionality.


### Test Coverage

This repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

``` bash
$ make test-cov
```

Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,

``` bash
$ open reports/coverage/lcov-report/index.html
```


## License

[MIT license](http://opensource.org/licenses/MIT).


---
## Copyright

Copyright © 2014. Athan Reines.



[npm-image]: http://img.shields.io/npm/v/validate.io-object.svg
[npm-url]: https://npmjs.org/package/validate.io-object

[travis-image]: http://img.shields.io/travis/validate-io/object/master.svg
[travis-url]: https://travis-ci.org/validate-io/object

[coveralls-image]: https://img.shields.io/coveralls/validate-io/object/master.svg
[coveralls-url]: https://coveralls.io/r/validate-io/object?branch=master

[dependencies-image]: http://img.shields.io/david/validate-io/object.svg
[dependencies-url]: https://david-dm.org/validate-io/object

[dev-dependencies-image]: http://img.shields.io/david/dev/validate-io/object.svg
[dev-dependencies-url]: https://david-dm.org/dev/validate-io/object

[github-issues-image]: http://img.shields.io/github/issues/validate-io/object.svg
[github-issues-url]: https://github.com/validate-io/object/issues
3 changes: 3 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TODO
====

19 changes: 19 additions & 0 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

var isObject = require( './../lib' );

// Positive validation:
console.log( isObject( {} ) );

/**
* Returns:
* true
*/

// Negative validation:
console.log( isObject( [] ) );

/**
* Returns:
* false
*/

Loading

0 comments on commit df1c07e

Please sign in to comment.