Skip to content

Commit

Permalink
[UPDATE] fmt. support String objects. add dotfiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Feb 20, 2015
1 parent 2b3e798 commit a7bc406
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 56 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
* text=auto
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -50,7 +50,7 @@ Desktop.ini

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

# Matlab #
##########
Expand Down
14 changes: 14 additions & 0 deletions .jshintignore
@@ -0,0 +1,14 @@

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

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

# Git #
#######
.git*
71 changes: 71 additions & 0 deletions .jshintrc
@@ -0,0 +1,71 @@
{
"bitwise": false,
"camelcase": false,
"curly": true,
"eqeqeq": true,
"es3": false,
"forin": true,
"freeze": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": false,
"nonbsp": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"maxparams": 10,
"maxdepth": 5,
"maxstatements": 100,
"maxcomplexity": false,
"maxlen": 1000,
"asi": false,
"boss": false,
"debug": false,
"eqnull": false,
"esnext": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": false,
"laxcomma": false,
"loopfunc": false,
"maxerr": 1000,
"moz": false,
"multistr": false,
"notypeof": false,
"proto": false,
"scripturl": false,
"shadow": false,
"sub": true,
"supernew": false,
"validthis": false,
"noyield": false,
"browser": true,
"browserify": true,
"couch": false,
"devel": true,
"dojo": false,
"jasmine": false,
"jquery": false,
"mocha": true,
"mootools": false,
"node": true,
"nonstandard": false,
"prototypejs": false,
"qunit": false,
"rhino": false,
"shelljs": false,
"worker": false,
"wsh": false,
"yui": false,
"globals": {}
}
7 changes: 5 additions & 2 deletions .npmignore
Expand Up @@ -13,11 +13,12 @@ examples/
reports/
support/
test/
benchmark/

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

# Logs #
########
Expand Down Expand Up @@ -46,4 +47,6 @@ Desktop.ini
# Utilities #
#############
.jshintrc
.travis.yml
.jshintignore
.travis.yml
.editorconfig
34 changes: 28 additions & 6 deletions Makefile
Expand Up @@ -8,29 +8,31 @@ NODE_ENV ?= test

# NOTES #

NOTES ?= 'TODO|FIXME'
NOTES ?= 'TODO|FIXME|WARNING|HACK|NOTE'


# 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


# JSHINT #

JSHINT ?= ./node_modules/.bin/jshint
JSHINT_REPORTER ?= ./node_modules/jshint-stylish/stylish.js



# FILES #

Expand Down Expand Up @@ -81,7 +83,8 @@ test-istanbul-mocha: node_modules
NODE_ENV=$(NODE_ENV) \
NODE_PATH=$(NODE_PATH_TEST) \
$(ISTANBUL) cover \
--dir $(ISTANBUL_OUT) --report $(ISTANBUL_REPORT) \
--dir $(ISTANBUL_OUT) \
--report $(ISTANBUL_REPORT) \
$(_MOCHA) -- \
--reporter $(MOCHA_REPORTER) \
$(TESTS)
Expand All @@ -99,19 +102,38 @@ view-istanbul-report:



# LINT #

.PHONY: lint lint-jshint

lint: lint-jshint

lint-jshint: node_modules
$(JSHINT) \
--reporter $(JSHINT_REPORTER) \
./



# NODE #

# Installing node_modules:
.PHONY: install

install:
npm install

# Clean node:
.PHONY: clean-node

clean-node:
rm -rf node_modules



# CLEAN #

.PHONY: clean

clean:
rm -rf build
34 changes: 23 additions & 11 deletions README.md
Expand Up @@ -16,23 +16,35 @@ For use in the browser, use [browserify](https://github.com/substack/node-browse

## Usage

To use the module,

``` javascript
var isLowercase = require( 'validate.io-lowercase' );
```

console.log( isLowercase( 'hello' ) );
// Returns true
#### isLowercase( value )

console.log( isLowercase( 'Hello' ) );
// Returns false
Validates if a `value` is a lowercase `string`.

``` javascript
var value = 'beep';

var bool = isLowercase( value );
// returns true
```

Note: this method validates that a `value` is a `string`.
__Note__: this method validates that a `value` is a `string`. For all other types, the method returns `false`.



## Examples

``` javascript
console.log( isLowercase( 'hello' ) );
// returns true

console.log( isLowercase( 'Hello' ) );
// returns false
```

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

``` bash
Expand All @@ -44,7 +56,7 @@ $ node ./examples/index.js

### 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:
Unit tests use the [Mocha](http://mochajs.org) 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
Expand All @@ -64,16 +76,16 @@ $ 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
$ make view-cov
```


---
## License

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


---
## Copyright

Copyright © 2014. Athan Reines.
Expand All @@ -95,4 +107,4 @@ Copyright © 2014. Athan Reines.
[dev-dependencies-url]: https://david-dm.org/dev/validate-io/lowercase

[github-issues-image]: http://img.shields.io/github/issues/validate-io/lowercase.svg
[github-issues-url]: https://github.com/validate-io/lowercase/issues
[github-issues-url]: https://github.com/validate-io/lowercase/issues
6 changes: 4 additions & 2 deletions examples/index.js
@@ -1,7 +1,9 @@
'use strict';

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

console.log( isLowercase( 'hello' ) );
// Returns true
// returns true

console.log( isLowercase( 'Hello' ) );
// Returns false
// returns false
44 changes: 24 additions & 20 deletions lib/index.js
Expand Up @@ -8,11 +8,11 @@
*
*
* NOTES:
* [1]
* [1]
*
*
* TODO:
* [1]
* [1]
*
*
* LICENSE:
Expand All @@ -26,26 +26,30 @@
*
*/

(function() {
'use strict';
'use strict';

/**
* FUNCTION: isLowercase( value )
* Validates if a value is a lowercase string.
*
* @param {String} value - value to be validated
* @returns {Boolean} boolean indicating whether value is a lowercase string
*/
function isLowercase( value ) {
if ( typeof value !== 'string' ) {
return false;
}
return ( value === value.toLowerCase() );
} // end FUNCTION isLowercase()
// MODULES //

var isString = require( 'validate.io-string' );

// EXPORTS //

module.exports = isLowercase;
// ISLOWERCASE //

})();
/**
* FUNCTION: isLowercase( value )
* Validates if a value is a lowercase string.
*
* @param {String} value - value to be validated
* @returns {Boolean} boolean indicating whether value is a lowercase string
*/
function isLowercase( value ) {
if ( isString( value ) ) {
return ( value.valueOf() === value.toLowerCase() );
}
return false;
} // end FUNCTION isLowercase()


// EXPORTS //

module.exports = isLowercase;
8 changes: 6 additions & 2 deletions package.json
Expand Up @@ -34,12 +34,16 @@
"bugs": {
"url": "https://github.com/validate-io/lowercase/issues"
},
"dependencies": {},
"dependencies": {
"validate.io-string": "^1.0.1"
},
"devDependencies": {
"chai": "1.x.x",
"mocha": "1.x.x",
"coveralls": "^2.11.1",
"istanbul": "^0.3.0"
"istanbul": "^0.3.0",
"jshint": "^2.5.10",
"jshint-stylish": "^1.0.0"
},
"licenses": [
{
Expand Down

0 comments on commit a7bc406

Please sign in to comment.