Skip to content

Commit

Permalink
Updated documentation, updated dependencies, removed some code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Sep 1, 2016
1 parent 7a09695 commit 1d83f32
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bower_components

node_modules
/coverage
/docs
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
This library is being developed to be a non date-based time calculator. The aim is to use time expressions along with math expressions to have human time products, and also to have various representations of a time expression.

* [Documentation](http://rodrigogs.github.io/kairos)
* [API](http://rodrigogs.github.io/kairos/docs)

## Install

Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kairos",
"version": "2.0.0",
"version": "2.0.1",
"description": "A non date-based time calculator",
"homepage": "https://github.com/kairos",
"repository": {
Expand Down Expand Up @@ -29,7 +29,7 @@
"test"
],
"devDependencies": {
"mocha": "~2.4.5",
"mocha": "~3.0.2",
"assert": "~0.1.0"
}
}
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ gulp.task('clean', done => {
});
});

gulp.task('docs', () => {
return gulp.src(['src/**/*.js', 'README.md'])
.pipe(plugins.jsdoc('docs'));
gulp.task('docs', cb => {
gulp.src(['README.md', './src/**/*.js'], {read: false})
.pipe(plugins.jsdoc3(cb));
});

gulp.task('format', () => {
Expand Down Expand Up @@ -111,7 +111,7 @@ gulp.task('test-watch', done => {
// Private helpers
// ===============

const banner = () => {
function banner() {
let stamp = [
'/**',
' * Kairos.js - <%= pkg.description %>',
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kairos",
"version": "2.0.0",
"version": "2.0.1",
"description": "A non date-based time calculator",
"license": "BSD-2-Clause",
"repository": "kairos",
Expand Down Expand Up @@ -33,24 +33,24 @@
"gulp-esformatter": "^6.0.0",
"gulp-header": "^1.7.1",
"gulp-include": "^2.1.0",
"gulp-jsdoc": "^0.1.5",
"gulp-jsdoc3": "^0.3.0",
"gulp-jshint": "^2.0.0",
"gulp-load-plugins": "^1.2.0",
"gulp-strip-debug": "^1.1.0",
"gulp-uglify": "^1.5.3",
"gulp-uglify": "^2.0.0",
"gulp-webserver": "^0.9.1",
"istanbul": "^0.4.2",
"jasmine-core": "^2.4.1",
"jshint": "^2.9.1",
"jshint-stylish": "^2.1.0",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-coverage": "^0.5.5",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.8",
"karma-mocha": "^0.2.2",
"karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-mocha": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.0",
"mocha": "^2.4.5",
"mocha": "^3.0.2",
"phantom": "^2.0.10",
"phantomjs-prebuilt": "^2.1.7",
"run-sequence": "^1.1.5"
Expand Down
61 changes: 30 additions & 31 deletions src/Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/
var MILLIS = {
SECOND: 1000,
MINUTE: 60 * 1000,
HOUR: 60 * 60 * 1000
MINUTE: 60000,
HOUR: 3600000
};

/**
* Kairos time engine.
*
* @param {String|Number|Kairos.Engine} expression Literal time expression, milliseconds or a Kairos.Engine instance
* @pattern {String} [pattern] Overrides Kairos pattern
* @param {String} [pattern] Overrides Kairos pattern
* @example new Kairos.Engine('10:30', 'hh:mm');
* @constructor
*/
Expand Down Expand Up @@ -44,7 +44,6 @@
};

/**
* @param {Kairos.Engine} instance
* @param {Number} millis
* @param {Number} time
* @returns {Number}
Expand All @@ -67,7 +66,7 @@
}
return this.milliseconds + (time * millis);
};

/**
* @type {Number}
* @default 0
Expand All @@ -77,7 +76,7 @@

/**
* Sets hours fraction in the current instance.
*
*
* @param {Number} hours Hours to set
* @example new Kairos.Engine('01:00').setHours(1);
* @returns {Kairos.Engine} Self
Expand All @@ -89,7 +88,7 @@

/**
* Gets hours fraction in the current instance.
*
*
* @example new Kairos.Engine('01:00').getHours();
* @returns {Number} Hours fraction from the instance
*/
Expand All @@ -99,7 +98,7 @@

/**
* Sets minutes fraction in the current instance.
*
*
* @param {Number} minutes Minutes to set
* @example new Kairos.Engine('01:00').setMinutes(30);
* @returns {Kairos.Engine} Self
Expand All @@ -111,7 +110,7 @@

/**
* Gets minutes fraction in the current instance.
*
*
* @example new Kairos.Engine('01:00').getMinutes();
* @returns {Number} Minutes fraction from the instance
*/
Expand All @@ -121,7 +120,7 @@

/**
* Sets seconds fraction in the current instance.
*
*
* @param {Number} seconds Seconds to set
* @example new Kairos.Engine('01:00').setSeconds(30);
* @returns {Kairos.Engine} Self
Expand All @@ -133,7 +132,7 @@

/**
* Gets seconds fraction in the current instance.
*
*
* @example new Kairos.Engine('01:00').getSeconds();
* @returns {Number} Seconds fraction from the instance
*/
Expand All @@ -143,7 +142,7 @@

/**
* Sets milliseconds fraction in the current instance.
*
*
* @param {Number} milliseconds Milliseconds to set
* @example new Kairos.Engine('01:00').setMilliseconds(200);
* @returns {Kairos.Engine} Self
Expand All @@ -155,7 +154,7 @@

/**
* Gets milliseconds fraction in the current instance.
*
*
* @example new Kairos.Engine('01:00').getMilliseconds();
* @returns {Number} Milliseconds fraction from the instance
*/
Expand All @@ -177,7 +176,7 @@

/**
* Adds minutes to the current instance.
*
*
* @param {Number} minutes Minutes to add
* @example new Kairos.Engine('01:00').addMinutes(30);
* @returns {Kairos.Engine} Self
Expand All @@ -189,7 +188,7 @@

/**
* Adds seconds in the current instance.
*
*
* @param {Number} seconds Seconds to add
* @example new Kairos.Engine('01:00').addSeconds(30);
* @returns {Kairos.Engine} Self
Expand All @@ -201,7 +200,7 @@

/**
* Adds milliseconds in the current instance.
*
*
* @param {Number} milliseconds Milliseconds to add
* @example new Kairos.Engine('01:00').addMilliseconds(500);
* @returns {Kairos.Engine} Self
Expand All @@ -213,7 +212,7 @@

/**
* Removes hours from the current instance.
*
*
* @param {Number} hours Hours to remove
* @example new Kairos.Engine('01:00').removeHours(1);
* @returns {Kairos.Engine} Self
Expand All @@ -225,7 +224,7 @@

/**
* Removes minutes from the current instance.
*
*
* @param {Number} minutes Minutes to remove
* @example new Kairos.Engine('01:00').removeMinutes(30);
* @returns {Kairos.Engine} Self
Expand All @@ -237,7 +236,7 @@

/**
* Removes seconds from the current instance.
*
*
* @param {Number} seconds Seconds to remove
* @example new Kairos.Engine('01:00').removeSeconds(30);
* @returns {Kairos.Engine} Self
Expand All @@ -249,7 +248,7 @@

/**
* Removes milliseconds from the current instance.
*
*
* @example new Kairos.Engine('01:00').removeMilliseconds(50);
* @param {Number} milliseconds Milliseconds to remove
* @returns {Kairos.Engine} Self
Expand All @@ -261,7 +260,7 @@

/**
* Returns total hours within the current instance.
*
*
* @example new Kairos.Engine('01:00').toHours();
* @returns {Number} Hours within the current instance
*/
Expand All @@ -271,7 +270,7 @@

/**
* Returns total minutes within the current instance.
*
*
* @example new Kairos.Engine('01:00').toMinutes();
* @returns {Number} Minutes within the current instance
*/
Expand All @@ -281,7 +280,7 @@

/**
* Returns total seconds within the current instance.
*
*
* @example new Kairos.Engine('01:00').toSeconds();
* @returns {Number} Seconds within the current instance
*/
Expand All @@ -291,7 +290,7 @@

/**
* Returns total milliseconds within the current instance.
*
*
* @example new Kairos.Engine('01:00').toMilliseconds();
* @returns {Number} Milliseconds within the current instance
*/
Expand All @@ -301,7 +300,7 @@

/**
* Makes the current instance's value absolute.
*
*
* @example new Kairos.Engine('01:00').toAbsolute();
* @returns {Kairos.Engine} Self
*/
Expand All @@ -312,7 +311,7 @@

/**
* Sums the given addend.
*
*
* @param {Number|String|Kairos.Engine} addend
* @param {String} [pattern] Overrides Kairos pattern
* @example new Kairos.Engine('01:00').minus('00:30');
Expand Down Expand Up @@ -340,7 +339,7 @@

/**
* Multiply by the given multiplicand.
*
*
* @param {Number} multiplicand Multiplicand value
* @example new Kairos.Engine('01:00').multiply(2);
* @returns {Kairos.Engine} Self
Expand All @@ -352,7 +351,7 @@

/**
* Divies by the given dividend.
*
*
* @param {Number} divisor Divisor value
* @example new Kairos.Engine('01:00').divide(2);
* @returns {Kairos.Engine} Self
Expand All @@ -364,7 +363,7 @@

/**
* Compares with another instance.
*
*
* @param {String|Number|Kairos.Engine} another Expression to compare with
* @param {String} [pattern] Overrides Kairos pattern
* @example new Kairos.Engine('01:00').compareTo('00:30');
Expand All @@ -386,7 +385,7 @@

/**
* Returns a string representation of the object.
*
*
* @param {String} pattern Pattern to format the time expression
* @param {Boolean} allowOverflow If true, when hour field is bigger than the pattern definition, it will be printed anyway
* @example new Kairos.Engine('22:10').toString('hh:mm');
Expand All @@ -399,4 +398,4 @@
}
return Kairos.Lexicon.format(this, pattern, allowOverflow);
};
}());
}());

0 comments on commit 1d83f32

Please sign in to comment.