Skip to content
Permalink
Browse files

init

  • Loading branch information
stevemao committed May 20, 2015
0 parents commit 24d32c2c86aa9e535b3f8711d32009d51daefa8c
Showing with 164 additions and 0 deletions.
  1. +12 −0 .editorconfig
  2. +1 −0 .gitattributes
  3. +2 −0 .gitignore
  4. +5 −0 .jscsrc
  5. +15 −0 .jshintrc
  6. +7 −0 .travis.yml
  7. +3 −0 .yo-rc.json
  8. +43 −0 README.md
  9. +13 −0 cli.js
  10. +10 −0 index.js
  11. +41 −0 package.json
  12. +12 −0 test/test.js
@@ -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
@@ -0,0 +1 @@
* text=auto
@@ -0,0 +1,2 @@
/node_modules/
npm-debug.log
@@ -0,0 +1,5 @@
{
"preset": "google",
"maximumLineLength": null,
"excludeFiles": ["node_modules/**"]
}
@@ -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
}
@@ -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
@@ -0,0 +1,3 @@
{
"generator-steves-node": {}
}
@@ -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
13 cli.js
@@ -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());
@@ -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());
};
@@ -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"
}
@@ -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);
});

0 comments on commit 24d32c2

Please sign in to comment.
You can’t perform that action at this time.