@@ -5312,7 +5312,7 @@ module.exports = (() => {
53125312 'use strict' ;
53135313
53145314 return {
5315- version : '6.1.1 '
5315+ version : '6.2.0 '
53165316 } ;
53175317} ) ( ) ;
53185318
@@ -5766,6 +5766,32 @@ module.exports = (() => {
57665766 const minimumTickValue = minimumTick . multiply ( pointValue ) ;
57675767 return minimumTickValue . toFloat ( ) ;
57685768 }
5769+
5770+ /**
5771+ * Rounds a value to the nearest valid tick.
5772+ *
5773+ * @param {Number|Decimal } value
5774+ * @param {Number } tickIncrement
5775+ * @param {Boolean= } roundToZero
5776+ * @returns {Number }
5777+ */
5778+ roundToNearestTick ( value , tickIncrement , roundToZero ) {
5779+ assert . argumentIsValid ( value , 'value' , x => is . number ( x ) || x instanceof Decimal , 'must be a number primitive or a Decimal instance' ) ;
5780+ assert . argumentIsOptional ( roundToZero , 'roundToZero' , Boolean ) ;
5781+ const minimumTick = this . getMinimumTick ( tickIncrement ) ;
5782+ let valueToUse ;
5783+ if ( value instanceof Decimal ) {
5784+ valueToUse = value ;
5785+ } else {
5786+ valueToUse = new Decimal ( value ) ;
5787+ }
5788+ let ticks = valueToUse . divide ( minimumTick ) ;
5789+ let remainder = valueToUse . mod ( minimumTick ) ;
5790+ if ( ! remainder . getIsZero ( ) ) {
5791+ ticks = ticks . round ( 0 , is . boolean ( roundToZero ) && roundToZero ? Decimal . ROUNDING_MODE . DOWN : Decimal . ROUNDING_MODE . NORMAL ) ;
5792+ }
5793+ return ticks . multiply ( minimumTick ) . toFloat ( ) ;
5794+ }
57695795 toString ( ) {
57705796 return `[UnitCode (code=${ this . code } )]` ;
57715797 }
@@ -8531,7 +8557,7 @@ module.exports = (() => {
85318557 * provided.
85328558 *
85338559 * @public
8534- * @param {Decimal| Number|String } exponent
8560+ * @param {Number } exponent
85358561 * @returns {Decimal }
85368562 */
85378563 raise ( exponent ) {
@@ -8555,6 +8581,18 @@ module.exports = (() => {
85558581 return new Decimal ( this . _big . round ( places , modeToUse . value ) ) ;
85568582 }
85578583
8584+ /**
8585+ * Returns a new {@link Decimal} instance with a value that returns
8586+ * the remainder of dividing by the value supplied.
8587+ *
8588+ * @public
8589+ * @param {Decimal|Number|String } other
8590+ * @returns {Decimal }
8591+ */
8592+ mod ( other ) {
8593+ return new Decimal ( this . _big . mod ( getBig ( other ) ) ) ;
8594+ }
8595+
85588596 /**
85598597 * Returns a new {@link Decimal} instance having the absolute value of
85608598 * the current instance's value.
@@ -8656,6 +8694,25 @@ module.exports = (() => {
86568694 return this . _big . lte ( getBig ( other ) ) ;
86578695 }
86588696
8697+ /**
8698+ * Returns true if the current instance between two other values. The
8699+ * test is inclusive, by default.
8700+ *
8701+ * @public
8702+ * @param {Decimal|Number|String } minimum - The minimum value.
8703+ * @param {Decimal|Number|String } minimum - The maximum value.
8704+ * @param {Boolean= } exclusive - If true, the value cannot equal the minimum or maximum value and still be considered "between" the other values.
8705+ * @returns {Boolean }
8706+ */
8707+ getIsBetween ( minimum , maximum , exclusive ) {
8708+ assert . argumentIsOptional ( exclusive , 'exclusive' , Boolean ) ;
8709+ if ( is . boolean ( exclusive ) && exclusive ) {
8710+ return this . getIsGreaterThan ( minimum ) && this . getIsLessThan ( maximum ) ;
8711+ } else {
8712+ return this . getIsGreaterThanOrEqual ( minimum ) && this . getIsLessThanOrEqual ( maximum ) ;
8713+ }
8714+ }
8715+
86598716 /**
86608717 * Returns true if the current instance is equal to the value.
86618718 *
@@ -8764,10 +8821,11 @@ module.exports = (() => {
87648821 }
87658822
87668823 /**
8767- * Parses the value emitted by {@link Decimal#toJSON}.
8824+ * An alias for the constructor. Creates a new instance. Suitable for
8825+ * use with the value emitted by {@link Decimal#toJSON}.
87688826 *
87698827 * @public
8770- * @param {String } value
8828+ * @param {Decimal|Number| String } value
87718829 * @returns {Decimal }
87728830 */
87738831 static parse ( value ) {
@@ -8926,7 +8984,7 @@ module.exports = (() => {
89268984 }
89278985
89288986 /**
8929- * An enumeration of strategies for rouding a {@link Decimal} instance.
8987+ * An enumeration of strategies for rounding a {@link Decimal} instance.
89308988 *
89318989 * @public
89328990 * @inner
@@ -9313,7 +9371,8 @@ module.exports = (() => {
93139371 } ,
93149372 /**
93159373 * Splits array into groups and returns an object (where the properties are items from the
9316- * original array). Unlike the groupBy, only one item can have a given key value.
9374+ * original array). Unlike the {@link array#groupBy} function, only one item can have a
9375+ * given key value.
93179376 *
93189377 * @static
93199378 * @param {Array } a
@@ -9815,7 +9874,7 @@ module.exports = (() => {
98159874 *
98169875 * @static
98179876 * @public
9818- * @param {* } candidate {*}
9877+ * @param {* } candidate
98199878 * @returns {boolean }
98209879 */
98219880 number ( candidate ) {
0 commit comments