@wyas/units

This is a group of pipes and components that deal with unit conversions.

Usage no npm install needed!

<script type="module">
  import wyasUnits from 'https://cdn.skypack.dev/@wyas/units';
</script>

README

This is a group of pipes and components that deal with unit conversions for Angular.

To use these pipes, add the following code to the module you are using:

import {{ WyasUnitPipesModule }} from '@wyas/units'

In your HTML, use this format:

{{ value | pipeName:start:finish:round }}

In the above code, start is the value you are converting from, finish is the value you are converting to, and round is the amount of decimals you want to round to (this is optional, default is 2). Here's an example:

{{ value | wyas_temp:"F":"C":5 }}

Pipes

Name Pipe Available Symbols
Temperature wyas_temp
  • "F" - Fahrenheit
  • "C" - Celcius
  • "K" - Kelvin
  • "R" - Rankine
  • "D" - Delisle
  • "N" - Newton
  • "Ré" - Réaumur
  • "Rø" - Rømer
None of these can be used with Metric prefixes.
Length wyas_length
  • "in" - inches
  • "ft" - feet
  • "yd" - yards
  • "mi" - miles
  • "thou" - thou
  • "m" - meters
"m" (meters) can be used with the Metric prefixes (see below).
Time wyas_time
  • "s" - seconds
  • "min" - minutes
  • "hour" - hours
  • "day" - days
  • "week" - weeks
  • "month" - months
  • "year" - years
"s" (seconds) can be used with the Metric prefixes (see below).

Some of the symbols in the previous table allow prefixes from the Metric system (centi-, milli-, etc.). These symbols include:

  • "m" - meters
  • "s" - seconds

To use prefixes with these symbols, add the following letter(s) to the beginning of each symbol:

  • "k" - kilo

  • "c" - centi

  • "m" - milli

  • "da" - deca

  • "d" - deci

  • "h" - hecto

  • "μ" - micro

  • "n" - nano

  • "p" - pico

  • "f" - femto

  • "a" - atto

  • "z" - zepto

  • "y" - yocto

  • "M" - mega

  • "G" - giga

  • "T" - tera

  • "P" - peta

  • "Em" - exa

  • "Z" - zetta

  • "Y" - yotta