This library will support you to measure the quantities involved in physics. Among these quantities are length, time, mass, temperature, pressure, and electric current.
Github:
https://github.com/victorpotasso/physics-measurement
Email:
Dependences:
grunt-coffee-import
- https://www.npmjs.com/package/grunt-coffee-import
- https://github.com/victorpotasso/grunt-coffee-import
jQuery
Creating a quantity
var q = new Quantity(666, "km");
Convertion a quantity unit to another
q.to("m");
Select unit
Unit.instance().select("kg");
Select All units
Unit.instance().selectAll();
Select All units of a specific base quantity
Unit.instance().selectAllByBaseQuantity("length");
Property
_quantity : Number Unit's quantity
_unit : String Unit
class that represents this Quantity
Functions
quantity() : Number - returns @_quantity
unit() : Number - returns @_unit
to(p_unit) : String - return the conversion of the unit of this quantity
.
Unit
is a Singleton class.
Property
_quantity : Number Unit's quantity
_unit : String Unit
class that represents this Quantity
Functions
select(p_unitSymbol) : Unit Object - returns an Unit
object by symbol.
selectAll() : Array - returns a list of all Unit
objects.
selectAllByBaseQuantity(p_baseQuantity) : Array - returns a list of Unit
object of a specif Base Quantity
.
isValid() : Boolean - check if this Unit is valid.
Prefixes for SI Units. It's a Singleton Class
Functions
select(p_unitPrefix) : SIUnitPrefix Object - returns an SIUnitPrefix
object by prefix.
selectAll() : Array - returns a list of all SIUnitPrefix
objects.
Variables
MASS: "mass"
TIME: "time"
LENGTH: "length"
Functions
select(p_unitSymbol) : Unit Object - returns an BaseQuantity
object by unit's symbol.
selectAll() : Array - returns a list of all BaseQuantity
objects.