rheactor-value-objects
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -42,3 +42,3 @@ { | ||
}, | ||
"version": "1.0.0" | ||
"version": "1.1.0" | ||
} |
@@ -6,3 +6,5 @@ # rheactor-value-objects | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
[![semantic-release](https://img.shields.io/badge/semver-semantic%20release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b38002c67b8a499aa1e441e8395fb576)](https://www.codacy.com/app/coderbyheart/value-objects?utm_source=github.com&utm_medium=referral&utm_content=RHeactor/value-objects&utm_campaign=Badge_Grade) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/b38002c67b8a499aa1e441e8395fb576)](https://www.codacy.com/app/coderbyheart/value-objects?utm_source=github.com&utm_medium=referral&utm_content=RHeactor/value-objects&utm_campaign=Badge_Coverage) | ||
@@ -9,0 +11,0 @@ [![NPM](https://nodei.co/npm/rheactor-value-objects.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/rheactor-value-objects/) |
'use strict' | ||
const _map = require('lodash/map') | ||
const _forIn = require('lodash/forIn') | ||
const TimeOfDayValue = require('..//time-of-day') | ||
@@ -48,2 +49,36 @@ const Errors = require('../errors') | ||
}) | ||
describe('.hour()', () => { | ||
it('should return the hour as a number', (done) => { | ||
_forIn({ | ||
'01:00': 1, | ||
'02:00': 2, | ||
'13:00': 13, | ||
'1:00': 1, | ||
'2:00': 2, | ||
'00:00': 0, | ||
'0:00': 0 | ||
}, (hour, time) => { | ||
let u = new TimeOfDayValue(time) | ||
expect(u.hour()).to.equal(hour) | ||
}) | ||
done() | ||
} | ||
) | ||
}) | ||
describe('.minute()', () => { | ||
it('should return the minute as a number', (done) => { | ||
_forIn({ | ||
'01:00': 0, | ||
'02:01': 1, | ||
'13:59': 59 | ||
}, (hour, time) => { | ||
let u = new TimeOfDayValue(time) | ||
expect(u.minute()).to.equal(hour) | ||
}) | ||
done() | ||
} | ||
) | ||
}) | ||
}) |
@@ -28,2 +28,18 @@ 'use strict' | ||
/** | ||
* Returns the hour of the time as a number | ||
* @returns {Number} | ||
*/ | ||
TimeOfDayValue.prototype.hour = function () { | ||
return +this.timeOfDay.split(':')[0] | ||
} | ||
/** | ||
* Returns the minute of the time as a number | ||
* @returns {Number} | ||
*/ | ||
TimeOfDayValue.prototype.minute = function () { | ||
return +this.timeOfDay.split(':')[1] | ||
} | ||
module.exports = TimeOfDayValue |
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
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
16565
468
13