timestring
Advanced tools
Comparing version 1.1.1 to 2.0.0
#Changelog | ||
## 2.0.0 | ||
- Keep it simple: revert back to ES5, remove gulp, browserify and build steps | ||
- Remove bower / browser specific integrations - This module can still be used client side using modern development tools like webpack, browserify etc. | ||
- use `node-style-guide` coding style | ||
##1.1.1 | ||
@@ -4,0 +10,0 @@ |
@@ -6,2 +6,3 @@ { | ||
"author": "Michael David Barrett <mike182uk@gmail.com>", | ||
"license": "MIT", | ||
"repository": { | ||
@@ -11,26 +12,18 @@ "type": "git", | ||
}, | ||
"main": "dist/lib/timestring.js", | ||
"version": "1.1.1", | ||
"scripts": { | ||
"sa": "jshint index.js && jscs index.js", | ||
"test": "mocha test.js" | ||
}, | ||
"main": "index.js", | ||
"version": "2.0.0", | ||
"devDependencies": { | ||
"browserify": "^10.0.0", | ||
"chai": "^2.3.0", | ||
"chai": "^3.4.1", | ||
"codeclimate-test-reporter": "^0.1.0", | ||
"coveralls": "^2.11.2", | ||
"del": "^1.1.1", | ||
"gulp": "^3.8.11", | ||
"gulp-babel": "^5.1.0", | ||
"gulp-concat": "^2.5.2", | ||
"gulp-jscs": "^1.6.0", | ||
"gulp-jshint": "^1.10.0", | ||
"gulp-load-plugins": "^0.10.0", | ||
"gulp-mocha": "^2.0.1", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^1.5.2", | ||
"gulp-uglify": "^1.2.0", | ||
"istanbul": "^0.3.13", | ||
"jshint-stylish": "^1.0.1", | ||
"istanbul": "^0.4.1", | ||
"jscs": "^2.8.0", | ||
"jshint": "^2.9.1", | ||
"mocha": "^2.2.4", | ||
"mocha-lcov-reporter": "0.0.2", | ||
"run-sequence": "^1.1.0", | ||
"vinyl-source-stream": "^1.1.0" | ||
"mocha-lcov-reporter": "1.0.0" | ||
} | ||
} |
@@ -1,4 +0,6 @@ | ||
#Timestring | ||
# Timestring | ||
[![Version](https://img.shields.io/npm/v/timestring.svg?style=flat-square)](https://www.npmjs.com/package/timestring) | ||
[![Build Status](https://img.shields.io/travis/mike182uk/timestring.svg?style=flat-square)](http://travis-ci.org/mike182uk/timestring) | ||
[![Code Climate](https://img.shields.io/codeclimate/github/mike182uk/timestring.svg?style=flat-square)](https://codeclimate.com/github/mike182uk/timestring) | ||
[![Coveralls](https://img.shields.io/coveralls/mike182uk/timestring/master.svg?style=flat-square)](https://coveralls.io/r/mike182uk/timestring) | ||
@@ -10,4 +12,12 @@ [![npm](https://img.shields.io/npm/dm/timestring.svg?style=flat-square)](https://www.npmjs.com/package/timestring) | ||
##Overview | ||
## Installation | ||
```bash | ||
npm install --save timestring | ||
``` | ||
## Usage | ||
### Overview | ||
```js | ||
@@ -51,3 +61,3 @@ var str = '1h 15m'; | ||
##Keywords | ||
### Keywords | ||
@@ -73,3 +83,3 @@ Timestring will parse the following keywords into time values: | ||
##Return Time Value | ||
### Return Time Value | ||
@@ -100,3 +110,3 @@ By default the return time value will be in seconds. This can be changed by passing one of the following strings as an argument to `String.parseTime` or `Timestring.parse`: | ||
##Optional Configuration | ||
### Optional Configuration | ||
@@ -110,5 +120,5 @@ A few assumptions are made by default: | ||
These settings can be changed by passing a settings object as an argument to `String.parseTime` or to the `Timestring` objects constructor. | ||
These options can be changed by passing a options object as an argument to `String.parseTime` or to the `Timestring` objects constructor. | ||
The following settings are configurable: | ||
The following options are configurable: | ||
@@ -123,11 +133,11 @@ 1. `hoursPerDay` | ||
var settings = { | ||
var opts = { | ||
hoursPerDay: 1 | ||
} | ||
var time = str.parseTime('h', settings); | ||
var time = str.parseTime('h', opts); | ||
// or | ||
var time = (new Timestring(settings)).parse(str, 'h'); | ||
var time = (new Timestring(opts)).parse(str, 'h'); | ||
@@ -138,3 +148,3 @@ | ||
In the example above `hoursPerDay` is being set to `1`. When the time string is being parsed, the return value is being specified as hours. Normally `1d` would parse to `24` hours (as by deafult there are 24 hours in a day) but because `hoursPerDay` has been set to `1`, `1d` will now only parse to `1` hour. | ||
In the example above `hoursPerDay` is being set to `1`. When the time string is being parsed, the return value is being specified as hours. Normally `1d` would parse to `24` hours (as by default there are 24 hours in a day) but because `hoursPerDay` has been set to `1`, `1d` will now only parse to `1` hour. | ||
@@ -146,3 +156,3 @@ This would be useful for specific application needs. | ||
```js | ||
var settings = { | ||
var opts = { | ||
hoursPerDay: 7.5, | ||
@@ -157,9 +167,9 @@ daysPerWeek: 5 | ||
// parse times | ||
var hoursToday = today.parseTime('h', settings), | ||
daysThisWeek = thisWeek.parseTime('d', settings); | ||
var hoursToday = today.parseTime('h', opts), | ||
daysThisWeek = thisWeek.parseTime('d', opts); | ||
// or | ||
var hoursToday = (new Timestring(settings)).parse(today, 'h'), | ||
daysThisWeek = (new Timestring(settings)).parse(thisWeek, 'd'); | ||
var hoursToday = (new Timestring(opts)).parse(today, 'h'), | ||
daysThisWeek = (new Timestring(opts)).parse(thisWeek, 'd'); | ||
@@ -170,31 +180,1 @@ | ||
``` | ||
##Installation | ||
###Browser | ||
All you need to do to get timestring working in the browser is download / clone this repo and make sure you include the `dist/timestring.min.js` script on your page: | ||
```html | ||
<script src="<path-to-src>/dist/timestring.min.js"></script> | ||
``` | ||
Alternatively you can you use bower to manage this dependency for you: | ||
```bash | ||
bower install timestring --save | ||
``` | ||
###Node | ||
To install for a node application, navigate to the projects root folder and in your terminal type the following: | ||
```bash | ||
npm install timestring --save | ||
``` | ||
In your node application you need to require the timestring module: | ||
```js | ||
var Timestring = require('timestring'); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
8
0
0
10222
5
92
171