Permalink
Browse files

init

  • Loading branch information...
0 parents commit 02f6be5520f5855a5e799d8c27f055817804cf8b @dawsonbotsford committed Mar 16, 2016
Showing with 313 additions and 0 deletions.
  1. +12 −0 .editorconfig
  2. +2 −0 .gitattributes
  3. +40 −0 .github/contributing.md
  4. +6 −0 .github/issue_template.md
  5. +2 −0 .github/pull_request_template.md
  6. +29 −0 .gitignore
  7. +4 −0 .travis.yml
  8. +24 −0 appveyor.yml
  9. +16 −0 index.js
  10. +21 −0 license
  11. +51 −0 package.json
  12. +87 −0 readme.md
  13. +19 −0 test.js
@@ -0,0 +1,12 @@
+root = true
+
+[*]
+indent_style = space
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[{package.json,*.yml}]
+indent_style = space
+indent_size = 2
@@ -0,0 +1,2 @@
+* text=auto
+*.js text eol=lf
@@ -0,0 +1,40 @@
+# Contributing to rainger
+
+:metal::tada:Thank you for helping with rainger! :tada::metal:
+
+<br>
+
+Development from people like you makes projects great. In order to make cool things like we all want to, there are a few basic things to follow.
+
+<br>
+**PR's should be in response to an issue**. Please open an issue before posting your PR
+
+1. If the patch/pull request is small, hack it out and see if the community likes it.
+2. On the other hand, if it is large, ask me about it first. We don't want to see time wasted on things that won't get merged or are already underway
+
+<br>
+
+### Lint and test
+* Lint with [xo](https://github.com/sindresorhus/xo)
+* Test with [ava](https://github.com/sindresorhus/ava)
+
+```js
+npm test // performs both xo linting and ava testing
+```
+
+<br>
+
+The `xo` and `ava` commands are also decoupled via their respective `npm run` variants:
+```js
+npm run xo
+
+// or
+
+npm run ava
+```
+
+<br>
+
+Reach out with questions!
+
+Cheers! :beers:
@@ -0,0 +1,6 @@
+[Tell the world about what's wrong here]
+
+## System info
+`sist node shell` (Download sist [here](https://github.com/dawsonbotsford/sist)):
+
+[sist command output here]
@@ -0,0 +1,2 @@
+Fixes issue #
+
@@ -0,0 +1,29 @@
+.DS_Store
+
+# Logs
+logs
+*.log
+
+# Runtime data
+pids
+*.pid
+*.seed
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directory
+# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
+node_modules
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - '5'
+ - '4'
@@ -0,0 +1,24 @@
+# Modified template from https://www.appveyor.com/docs/lang/nodejs-iojs
+
+# Test against this version of Node.js
+environment:
+ nodejs_version: "5"
+
+# Get the latest stable version of Node 0.STABLE.latest (runs after repo cloning)
+install:
+ # Get the latest stable version of Node.js or io.js
+ - ps: Install-Product node $env:nodejs_version
+ # install modules
+ - npm install
+
+# Post-install test scripts.
+test_script:
+ # Output useful info for debugging.
+ - node --version
+ - npm --version
+ # run tests
+ - npm test
+
+# Don't actually build.
+build: off
+
@@ -0,0 +1,16 @@
+'use strict';
+
+module.exports = function (input) {
+ const inputType = typeof input;
+
+ // validate arguments
+ if (inputType !== 'string' && inputType !== 'number') {
+ throw new TypeError(`Expected a string, got ${typeof input}`);
+ }
+
+ const currentYear = (new Date()).getFullYear().toString();
+ if (input.toString() === currentYear) {
+ return `${currentYear}`;
+ }
+ return `${input} - ${currentYear}`;
+};
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+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.
@@ -0,0 +1,51 @@
+{
+ "name": "rainger",
+ "version": "0.0.0",
+ "description": "Generate accurate date ranges for copyrights",
+ "license": "MIT",
+ "homepage": "https://github.com/dawsonbotsford/rainger#readme",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/dawsonbotsford/rainger.git"
+ },
+ "author": {
+ "name": "Dawson Botsford",
+ "email": "DawsonBotsford@gmail.com",
+ "url": "dawsonbotsford.com"
+ },
+ "bugs": {
+ "url": "https://github.com/dawsonbotsford/rainger/issues"
+ },
+ "engines": {
+ "node": ">=0.12.0"
+ },
+ "scripts": {
+ "test": "xo && ava",
+ "ava": "ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "windows",
+ "lean",
+ "minimal",
+ "documented",
+ "tested",
+ "licensed",
+ "ava",
+ "dawson"
+ ],
+ "dependencies": {},
+ "devDependencies": {
+ "ava": "*.*.*",
+ "xo": "*.*.*",
+ "eslint-config-xo-space": "^0.8.0"
+ },
+ "xo": {
+ "space": true,
+ "eslintConfig": {
+ "extends": "xo-space"
+ }
+ }
+}
@@ -0,0 +1,87 @@
+# rainger
+[![npm version](https://img.shields.io/npm/v/rainger.svg)](https://www.npmjs.com/package/rainger)
+[![npm download count](http://img.shields.io/npm/dm/rainger.svg?style=flat)](http://npmjs.org/rainger)
+[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
+
+ <table>
+ <thead>
+ <tr>
+ <th>Linux & OSX</th>
+ <th>Windows</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td align="center">
+ <a href="https://travis-ci.org/dawsonbotsford/rainger"><img src="https://api.travis-ci.org/dawsonbotsford/rainger.svg?branch=master"></a>
+ </td>
+ <td align="center">
+ <a href="https://ci.appveyor.com/project/dawsonbotsford/rainger"><img src="http://www.gravatar.com/avatar/5f66f56cae930eb9ab2cd9e62b8285e6"></a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+> Generate accurate date ranges for copyrights
+
+<br>
+
+## Install
+
+```
+npm install --save rainger
+```
+
+<br>
+
+## Usage
+
+*assuming the current year from* `Date` * function is 2016*:
+```js
+const rainger = require('rainger');
+
+rainger(2016);
+//=> '2016'
+
+rainger(1999);
+//=> '1999 - 2016'
+```
+
+<br>
+
+## About
+
+I was tired of seeing websites in 2016 that said
+> © 2015
+
+or even worse
+>© 2012 - 2014
+
+Using `rainger`, you can set your copyright year once and have it change dynamically year-to-year. If you made your code in 2016, `rainger(2016)` will return `2016` until it is 2017, at which point `rainger(2016)` will return `2016 - 2017`
+
+<br>
+
+## API
+
+### rainger(target)
+
+##### target
+
+Type: `string` || `number`
+
+Description: This is the year you want your range to begin at.
+
+#### returns
+
+Type: `string`
+
+<br>
+
+## License
+
+MIT © [Dawson Botsford](http://dawsonbotsford.com)
+
+<br>
+
+---
+If you like this, star it. If you want to follow me, follow me.
@@ -0,0 +1,19 @@
+import test from 'ava';
+import rainger from './';
+
+test('valid args', t => {
+ t.throws(() => {
+ rainger(false);
+ }, TypeError);
+});
+
+test('date in the past', t => {
+ t.is(rainger('1999'), `1999 - 2016`);
+ t.is(rainger(1999), `1999 - 2016`);
+});
+
+test('current year', t => {
+ const currentYear = (new Date()).getFullYear();
+ t.is(rainger(currentYear), `${currentYear}`);
+ t.is(rainger(Number(currentYear)), `${currentYear}`);
+});

0 comments on commit 02f6be5

Please sign in to comment.