-
Notifications
You must be signed in to change notification settings - Fork 1
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
Steve Mao
committed
May 20, 2015
0 parents
commit 24d32c2
Showing
12 changed files
with
164 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,12 @@ | ||
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 |
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 @@ | ||
* text=auto |
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,2 @@ | ||
/node_modules/ | ||
npm-debug.log |
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,5 @@ | ||
{ | ||
"preset": "google", | ||
"maximumLineLength": null, | ||
"excludeFiles": ["node_modules/**"] | ||
} |
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 @@ | ||
{ | ||
"boss": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"immed": true, | ||
"latedef": true, | ||
"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,7 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- 'iojs' | ||
- '0.12' | ||
- '0.10' | ||
after_script: NODE_ENV=test istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./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,3 @@ | ||
{ | ||
"generator-steves-node": {} | ||
} |
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,43 @@ | ||
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
|
||
> Get a simple timestamp | ||
Fast as it doesn't have bloated methods. | ||
|
||
|
||
## Install | ||
|
||
```sh | ||
$ npm install --save simple-timestamp | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
```js | ||
var simpleTimestamp = require('simple-timestamp'); | ||
|
||
simpleTimestamp(); | ||
// => 2015.05.20.14.34.08 | ||
``` | ||
|
||
```sh | ||
$ npm install --global simple-timestamp | ||
$ simple-timestamp | ||
2015.05.20.14.36.09 | ||
``` | ||
|
||
|
||
## License | ||
|
||
MIT © [Steve Mao](https://github.com/stevemao) | ||
|
||
|
||
[npm-image]: https://badge.fury.io/js/simple-timestamp.svg | ||
[npm-url]: https://npmjs.org/package/simple-timestamp | ||
[travis-image]: https://travis-ci.org/stevemao/simple-timestamp.svg?branch=master | ||
[travis-url]: https://travis-ci.org/stevemao/simple-timestamp | ||
[daviddm-image]: https://david-dm.org/stevemao/simple-timestamp.svg?theme=shields.io | ||
[daviddm-url]: https://david-dm.org/stevemao/simple-timestamp | ||
[coveralls-image]: https://coveralls.io/repos/stevemao/simple-timestamp/badge.svg | ||
[coveralls-url]: https://coveralls.io/r/stevemao/simple-timestamp |
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,13 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
var meow = require('meow'); | ||
var simpleTimestamp = require('./'); | ||
|
||
meow({ | ||
help: [ | ||
'Usage', | ||
' simple-timestamp' | ||
].join('\n') | ||
}); | ||
|
||
console.log(simpleTimestamp()); |
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 @@ | ||
var leftPad = require('left-pad'); | ||
|
||
function pad(num) { | ||
return leftPad(num, 2, 0); | ||
} | ||
|
||
module.exports = function() { | ||
var now = new Date(); | ||
return now.getFullYear() + '.' + pad(now.getMonth() + 1) + '.' + pad(now.getDate()) + '.' + pad(now.getHours()) + '.' + pad(now.getMinutes()) + '.' + pad(now.getSeconds()); | ||
}; |
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,41 @@ | ||
{ | ||
"name": "simple-timestamp", | ||
"version": "0.0.0", | ||
"description": "Get a simple timestamp", | ||
"homepage": "https://github.com/stevemao/simple-timestamp", | ||
"author": { | ||
"name": "Steve Mao", | ||
"email": "maochenyan@gmail.com", | ||
"url": "https://github.com/stevemao" | ||
}, | ||
"repository": "stevemao/simple-timestamp", | ||
"license": "MIT", | ||
"files": [ | ||
"index.js", | ||
"cli.js" | ||
], | ||
"keywords": [ | ||
"simple-timestamp", | ||
"simple", | ||
"time", | ||
"timestamp", | ||
"log" | ||
], | ||
"dependencies": { | ||
"left-pad": "0.0.4", | ||
"meow": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.11.2", | ||
"istanbul": "^0.3.14", | ||
"jscs": "^1.13.1", | ||
"jshint": "^2.7.0", | ||
"mocha": "*" | ||
}, | ||
"scripts": { | ||
"coverage": "istanbul cover _mocha -- -R spec && rm -rf ./coverage", | ||
"lint": "jshint *.js test --exclude node_modules && jscs *.js test", | ||
"test": "npm run-script lint && mocha" | ||
}, | ||
"bin": "cli.js" | ||
} |
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,12 @@ | ||
'use strict'; | ||
var assert = require('assert'); | ||
var simpleTimestamp = require('../'); | ||
|
||
it('should contain current date', function() { | ||
var now = new Date(); | ||
var data = simpleTimestamp().split('.'); | ||
|
||
assert.equal(data[0], now.getFullYear()); | ||
assert(data[1].indexOf((now.getMonth() + 1)) >= 0); | ||
assert(data[2].indexOf(now.getDate()) >= 0); | ||
}); |