Clear Up
SharpKit Reference

Number Class

Namespace: Ext

Base Types



Name Description


Name Description
constrain(JsNumber, JsNumber, JsNumber) Checks whether or not the passed number is within a desired range. If the number is already within the range it is returned, otherwise the min or max value is returned depending on which side of the range is exceeded. Note that this method returns the constrained value but does not change the current number. @param {Number} number The number to check @param {Number} min The minimum number in the range @param {Number} max The maximum number in the range @return {Number} The constrained value if outside the range, otherwise the current value
from(object, JsNumber) Validate that a value is numeric and convert it to a number if necessary. Returns the specified default value if it is not. Ext.Number.from('1.23', 1); // returns 1.23 Ext.Number.from('abc', 1); // returns 1 @param {Object} value @param {Number} defaultValue The value to return if the original value is non-numeric @return {Number} value, if numeric, defaultValue otherwise
snap(JsNumber, JsNumber, JsNumber, JsNumber) Snaps the passed number between stopping points based upon a passed increment value. @param {Number} value The unsnapped value. @param {Number} increment The increment by which the value must move. @param {Number} minValue The minimum value to which the returned value must be constrained. Overrides the increment.. @param {Number} maxValue The maximum value to which the returned value must be constrained. Overrides the increment.. @return {Number} The value of the nearest snap target.
toFixed(JsNumber, JsNumber) Formats a number using fixed-point notation @param {Number} value The number to format @param {Number} precision The number of digits to show after the decimal point
© Copyright 2005-2011 SharpKit. All rights reserved.