@barchart/common-js
Version:
Library of common JavaScript utilities
37 lines (32 loc) • 647 B
JavaScript
import * as is from './../../lang/is.js';
import Specification from './../Specification.js';
/**
* A {@link Specification} that passes when the first item in an
* array is less than the second item in the array.
*
* @public
* @extends {Specification}
*/
export default class LessThan extends Specification {
constructor() {
super();
}
/**
* @protected
* @override
* @param {*} data
* @returns {boolean}
*/
_evaluate(data) {
return is.array(data) && data.length === 2 && data[0] < data[1];
}
/**
* Returns a string representation.
*
* @public
* @returns {string}
*/
toString() {
return '[LessThan]';
}
}