Skip to content

Commit e4e5566

Browse files
committed
first commit
0 parents  commit e4e5566

10 files changed

+294
-0
lines changed

.gitattributes

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Enforce Unix newlines
2+
*.* text eol=lf
3+
*.css text eol=lf
4+
*.html text eol=lf
5+
*.js text eol=lf
6+
*.json text eol=lf
7+
*.less text eol=lf
8+
*.md text eol=lf
9+
*.yml text eol=lf
10+
11+
*.jpg binary
12+
*.gif binary
13+
*.png binary
14+
*.jpeg binary

.gitignore

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Numerous always-ignore extensions
2+
*.csv
3+
*.dat
4+
*.diff
5+
*.err
6+
*.gz
7+
*.log
8+
*.orig
9+
*.out
10+
*.pid
11+
*.rej
12+
*.seed
13+
*.swo
14+
*.swp
15+
*.vi
16+
*.yo-rc.json
17+
*.zip
18+
*~
19+
.ruby-version
20+
lib-cov
21+
22+
# OS or Editor folders
23+
*.esproj
24+
*.sublime-project
25+
*.sublime-workspace
26+
._*
27+
.cache
28+
.DS_Store
29+
.idea
30+
.project
31+
.settings
32+
.tmproj
33+
nbproject
34+
Thumbs.db
35+
36+
# Komodo
37+
*.komodoproject
38+
.komodotools
39+
40+
# grunt-html-validation
41+
validation-status.json
42+
validation-report.json
43+
44+
# Vendor packages
45+
node_modules
46+
bower_components
47+
vendor
48+
49+
# General folders and files to ignore
50+
_gh_pages
51+
tmp
52+
temp
53+
TODO.md

.jshintrc

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"esnext": true,
3+
"boss": true,
4+
"curly": true,
5+
"eqeqeq": true,
6+
"eqnull": true,
7+
"immed": true,
8+
"latedef": true,
9+
"newcap": true,
10+
"noarg": true,
11+
"node": true,
12+
"sub": true,
13+
"undef": true,
14+
"unused": true,
15+
"globals": {
16+
"define": true,
17+
"before": true,
18+
"after": true,
19+
"describe": true,
20+
"it": true
21+
}
22+
}

.verbrc.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# {%= name %} {%= badge('fury') %}
2+
3+
> {%= description %}
4+
5+
## Install
6+
{%= include("install") %}
7+
8+
## Usage
9+
10+
```js
11+
var year = require('year');
12+
console.log(year('yy'));
13+
//=> {%= date("YY") %}
14+
console.log(year('yyyy'));
15+
//=> {%= date("YYYY") %}
16+
```
17+
18+
## Author
19+
{%= contrib("authors") %}
20+
21+
## License
22+
{%= copyright() %}
23+
{%= license() %}
24+
25+
***
26+
27+
{%= include("footer") %}

LICENSE-MIT

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2014 Jon Schlinkert, contributors.
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# year [![NPM version](https://badge.fury.io/js/year.png)](http://badge.fury.io/js/year)
2+
3+
> Simple utility to get the current year with 2 or 4 digits.
4+
5+
## Install
6+
Install with [npm](npmjs.org):
7+
8+
```bash
9+
npm i year --save-dev
10+
```
11+
12+
13+
## Usage
14+
15+
```js
16+
var year = require('year');
17+
console.log(year('yy'));
18+
//=> 14
19+
console.log(year('yyyy'));
20+
//=> 2014
21+
```
22+
23+
## Author
24+
25+
**Jon Schlinkert**
26+
27+
+ [github/jonschlinkert](https://github.com/jonschlinkert)
28+
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
29+
30+
**Brian Woodward**
31+
32+
+ [github/doowb](https://github.com/doowb)
33+
+ [twitter/doowb](http://twitter.com/jonschlinkert)
34+
35+
## License
36+
Copyright (c) 2014 Jon Schlinkert, contributors.
37+
Released under the MIT license
38+
39+
***
40+
41+
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 21, 2014._

index.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* year <https://github.com/jonschlinkert/year>
3+
*
4+
* Copyright (c) 2014 Jon Schlinkert, contributors.
5+
* Licensed under the MIT license.
6+
*/
7+
8+
const replace = require('frep');
9+
10+
module.exports = function(str) {
11+
var year = new Date().getFullYear();
12+
var replacements = [
13+
{
14+
pattern: /[Yy]{4}/,
15+
replacement: year
16+
},
17+
{
18+
pattern: /[Yy]{2}/,
19+
replacement: year.toString().substr(2, 2)
20+
}
21+
]
22+
return replace.strWithArr(str, replacements);
23+
};

package.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "year",
3+
"description": "Simple utility to get the current year with 2 or 4 digits.",
4+
"version": "0.1.0",
5+
"homepage": "https://github.com/jonschlinkert/year",
6+
"author": {
7+
"name": "Jon Schlinkert",
8+
"url": "https://github.com/jonschlinkert"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git://github.com/jonschlinkert/year.git"
13+
},
14+
"bugs": {
15+
"url": "https://github.com/jonschlinkert/year/issues"
16+
},
17+
"licenses": [
18+
{
19+
"type": "MIT",
20+
"url": "https://github.com/jonschlinkert/year/blob/master/LICENSE-MIT"
21+
}
22+
],
23+
"keywords": [
24+
"docs",
25+
"documentation",
26+
"generate",
27+
"generator",
28+
"markdown",
29+
"templates",
30+
"verb"
31+
],
32+
"main": "index.js",
33+
"engines": {
34+
"node": ">=0.8"
35+
},
36+
"scripts": {
37+
"test": "mocha -R spec"
38+
},
39+
"devDependencies": {
40+
"verb": "~0.2.0",
41+
"chai": "~1.9.1",
42+
"mocha": "~1.18.2"
43+
},
44+
"dependencies": {
45+
"frep": "~0.2.0"
46+
}
47+
}

test/mocha.opts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--reporter spec

test/test.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* year <https://github.com/jonschlinkert/year>
3+
*
4+
* Copyright (c) 2014 Jon Schlinkert, contributors.
5+
* Licensed under the MIT license.
6+
*/
7+
8+
const expect = require('chai').expect;
9+
const year = require('../');
10+
11+
12+
describe('year()', function () {
13+
describe('when YY passed', function () {
14+
it('should return the 2-digit current year', function (done) {
15+
var actual = year('YY');
16+
expect(actual).to.equal('14');
17+
done();
18+
});
19+
});
20+
21+
describe('when yy passed', function () {
22+
it('should return the 2-digit current year', function (done) {
23+
var actual = year('yy');
24+
expect(actual).to.equal('14');
25+
done();
26+
});
27+
});
28+
29+
describe('when YYYY passed', function () {
30+
it('should return the 2-digit current year', function (done) {
31+
var actual = year('YYYY');
32+
expect(actual).to.equal('2014');
33+
done();
34+
});
35+
});
36+
37+
describe('when yyyy passed', function () {
38+
it('should return the 2-digit current year', function (done) {
39+
var actual = year('yyyy');
40+
expect(actual).to.equal('2014');
41+
done();
42+
});
43+
});
44+
});

0 commit comments

Comments
 (0)