diff --git a/.gitignore b/.gitignore index 3c5db2f..721b7cc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ bower_components node_modules /coverage +/docs diff --git a/README.md b/README.md index 07ee711..44ac549 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bower.json b/bower.json index fff6d9e..78a6552 100644 --- a/bower.json +++ b/bower.json @@ -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": { @@ -29,7 +29,7 @@ "test" ], "devDependencies": { - "mocha": "~2.4.5", + "mocha": "~3.0.2", "assert": "~0.1.0" } } diff --git a/gulpfile.js b/gulpfile.js index b4d831a..c4c795e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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', () => { @@ -111,7 +111,7 @@ gulp.task('test-watch', done => { // Private helpers // =============== -const banner = () => { +function banner() { let stamp = [ '/**', ' * Kairos.js - <%= pkg.description %>', diff --git a/package.json b/package.json index 041d62c..5ef4b09 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" diff --git a/src/Engine.js b/src/Engine.js index 222877d..d8f85f5 100644 --- a/src/Engine.js +++ b/src/Engine.js @@ -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 */ @@ -44,7 +44,6 @@ }; /** - * @param {Kairos.Engine} instance * @param {Number} millis * @param {Number} time * @returns {Number} @@ -67,7 +66,7 @@ } return this.milliseconds + (time * millis); }; - + /** * @type {Number} * @default 0 @@ -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 @@ -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 */ @@ -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 @@ -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 */ @@ -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 @@ -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 */ @@ -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 @@ -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 */ @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -301,7 +300,7 @@ /** * Makes the current instance's value absolute. - * + * * @example new Kairos.Engine('01:00').toAbsolute(); * @returns {Kairos.Engine} Self */ @@ -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'); @@ -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 @@ -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 @@ -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'); @@ -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'); @@ -399,4 +398,4 @@ } return Kairos.Lexicon.format(this, pattern, allowOverflow); }; -}()); \ No newline at end of file +}());