Skip to content

ulfalfa/value-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

us-value-mapper

ValueMapper is a class that maps a value to a string based on a mapping table. It supports ranges (1..3) and all kinds of values. I'm using it for translating values coming from my home automation to localized strings. (e.g. a temperature in the range -3 to 3 is "freezy", from 3 to 24 is "warm" and so on...) value-mapper

Installing

Install ValueMap-class via npm

npm install us-value-mapper

and the use it

const ValueMap = require('us-value-mapper');

const mapping = ['-3.3..3=>freezy','3..24=>warm','24..99=>hot'];

var map = new ValueMap(mapping);
console.log ('0°C seemst to be '+map.map(0));

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published