diff --git a/.npmignore b/.npmignore index 9503da7..4d26eec 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,2 @@ build -Gruntfile.js \ No newline at end of file +Gruntfile.js diff --git a/README.md b/README.md index e82d8c9..268ccfa 100644 --- a/README.md +++ b/README.md @@ -16,42 +16,40 @@ or clone: ## Getting Started -Conversion function returns an object that contain the parsed and NORMALIZED value/unit AND some function described bellow : - -```javascript -tinu.distance(12); // → {value: 12, unit: "cm", ...} -tinu.distance(12, "mm"); // → {value: 12, unit: "mm", ...} -tinu.distance(12, "in"); // → {value: 12, unit: "in", ...} -tinu.distance(12, "inch"); // → {value: 12, unit: "in", ...} -tinu.distance("12m"); // → {value: 12, unit: "m", ...} -tinu.distance("12 m"); // → {value: 12, unit: "m", ...} -tinu.distance("12.00m"); // → {value: 12, unit: "m", ...} - -unitConvert.area(80, "m2"); // → {value: 80, unit: "m2", ...} +Conversion function returns an object that contain the parsed and NORMALIZED value/unit AND some function described bellow : + +```javascript +Tinu.distance(12); // → {value: 12, unit: "cm", ...} +Tinu.distance(12, "mm"); // → {value: 12, unit: "mm", ...} +Tinu.distance(12, "in"); // → {value: 12, unit: "in", ...} +Tinu.distance("12m"); // → {value: 12, unit: "m", ...} +Tinu.distance("12 m"); // → {value: 12, unit: "m", ...} +Tinu.distance("12.00m"); // → {value: 12, unit: "m", ...} + +Tinu.area(80, "m2"); // → {value: 80, unit: "m2", ...} ``` The .to() method converts to the same object but in the requested unit. -```javascript -tinu.distance(12).to("m"); // → {value: 0.012, "m", ...} -tinu.distance(12).to("meter"); // → {value: 0.012, "m", ...} -tinu.distance(12).to("m").to("mm"); // → {value: 120, "mm", ...} -tinu.distance(12).to(); // → converts to the default target unit: {value: 0.012, "m", ...} +```javascript +Tinu.distance(12).to("m"); // → {value: 0.012, "m", ...} +Tinu.distance(12).to("m").to("mm"); // → {value: 120, "mm", ...} +Tinu.distance(12).to(); // → converts to the default target unit: {value: 0.012, "m", ...} ``` The .toNumber(unit=null) method converts to a Number in the requested unit -```javascript -tinu.distance(12).toNumber("m"); // → 0.012 -tinu.distance(12).toNumber(); // → converts to the default target unit: 0.012 +```javascript +Tinu.distance(12).toNumber("m"); // → 0.012 +Tinu.distance(12).toNumber(); // → converts to the default target unit: 0.012 ``` The .toString(unit=null, numericScale=null) method converts to a String in the requested unit, that includes the unit -```javascript -tinu.distance(12, "cm").toString("m"); // → "0.012 m" -tinu.distance(12, "cm").toString("m", 2); // → "0.01 m" -tinu.distance(12, "cm").toString(); // → converts to the default target unit: "0.012 m" +```javascript +Tinu.distance(12, "cm").toString("m"); // → "0.012 m" +Tinu.distance(12, "cm").toString("m", 2); // → "0.01 m" +Tinu.distance(12, "cm").toString(); // → converts to the default target unit: "0.012 m" ``` Please help yourself to add type and other unit if needed ! diff --git a/build/tinu.js b/build/tinu.js index 8e414b4..053262f 100644 --- a/build/tinu.js +++ b/build/tinu.js @@ -73,13 +73,41 @@ var configuration = { }, angle: { defaultSource: "rad", - defaultTarget: "deg", + defaultTarget: "g", "rad": { factor: 1 }, "deg": { factor: 0.0174533 } + }, + mass: { + defaultSource: "kg", + defaultTarget: "g", + "kg": { + factor: 1 + }, + "t": { + factor: 1000 + }, + "g": { + factor: 0.001 + }, + "mg": { + factor: 0.000001 + }, + "dr": { + factor: 0.00388794 + }, + "N": { + factor: 0.1019716213 + }, + "oz": { + factor: 0.0283495 + }, + "lb": { + factor: 0.453592 + } } }; @@ -106,8 +134,9 @@ var config = require("./config"); var tinu = { config: config, distance: unit.factory.bind(undefined, "distance"), - area: unit.factory.bind(undefined, "distance"), - angle: unit.factory.bind(undefined, "angle") + area: unit.factory.bind(undefined, "area"), + angle: unit.factory.bind(undefined, "angle"), + mass: unit.factory.bind(undefined, "mass") }; module.exports = tinu; @@ -177,4 +206,4 @@ module.exports = Unit; },{"./config":1,"./convert":2}]},{},[3])(3) }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW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hdGlvbiA9IHtcbiAgICBkZWZhdWx0TnVtZXJpY1NjYWxlOiBudWxsLFxuICAgIGRpc3RhbmNlOiB7XG4gICAgICAgIGRlZmF1bHRTb3VyY2U6IFwiY21cIixcbiAgICAgICAgZGVmYXVsdFRhcmdldDogXCJtXCIsXG4gICAgICAgIFwibW1cIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjAwMVxuICAgICAgICB9LFxuICAgICAgICBcImNtXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC4wMVxuICAgICAgICB9LFxuICAgICAgICBcImRtXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC4xXG4gICAgICAgIH0sXG4gICAgICAgIFwibVwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJrbVwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDEwMDBcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaVwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDE2MDkuMzQ0XG4gICAgICAgIH0sXG4gICAgICAgIFwiaW5cIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjAyNTRcbiAgICAgICAgfSxcbiAgICAgICAgXCJmdFwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuMzA0ODBcbiAgICAgICAgfSxcbiAgICAgICAgXCJ5ZFwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuOTE0NFxuICAgICAgICB9XG4gICAgfSxcbiAgICBhcmVhOiB7XG4gICAgICAgIGRlZmF1bHRTb3VyY2U6IFwiY20yXCIsXG4gICAgICAgIGRlZmF1bHRUYXJnZXQ6IFwibTJcIixcbiAgICAgICAgXCJtbTJcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjAwMDAwMVxuICAgICAgICB9LFxuICAgICAgICBcImNtMlwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuMDAwMVxuICAgICAgICB9LFxuICAgICAgICBcImRtMlwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuMDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJtMlwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJrbTJcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxMDAwMDAwXG4gICAgICAgIH0sXG4gICAgICAgIFwiYWNcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiA0MDQ2Ljg2XG4gICAgICAgIH0sXG4gICAgICAgIFwiYVwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDEwMC4wXG4gICAgICAgIH0sXG4gICAgICAgIFwiaGFcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxMDAwMC4wXG4gICAgICAgIH0sXG4gICAgICAgIFwibWkyXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMjU4OTg0NlxuICAgICAgICB9LFxuICAgICAgICBcInkyXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC44MzYxXG4gICAgICAgIH0sXG4gICAgICAgIFwiZjJcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjA5MjkwM1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhbmdsZToge1xuICAgICAgICBkZWZhdWx0U291cmNlOiBcInJhZFwiLFxuICAgICAgICBkZWZhdWx0VGFyZ2V0OiBcImRlZ1wiLFxuICAgICAgICBcInJhZFwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWdcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjAxNzQ1MzNcbiAgICAgICAgfVxuICAgIH1cbn07XG5cbm1vZHVsZS5leHBvcnRzID0gY29uZmlndXJhdGlvbjtcbiIsIlwidXNlIHN0cmljdFwiO1xuXG5jb25zdCBjb25maWcgPSByZXF1aXJlKFwiLi9jb25maWdcIik7XG5cbnZhciBjb252ZXJ0ID0gZnVuY3Rpb24odmFsdWUs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VwiLFxuICAgICAgICBcIm1tXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC4wMDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJjbVwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuMDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJkbVwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuMVxuICAgICAgICB9LFxuICAgICAgICBcIm1cIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxXG4gICAgICAgIH0sXG4gICAgICAgIFwia21cIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxMDAwXG4gICAgICAgIH0sXG4gICAgICAgIFwibWlcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxNjA5LjM0NFxuICAgICAgICB9LFxuICAgICAgICBcImluXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC4wMjU0XG4gICAgICAgIH0sXG4gICAgICAgIFwiZnRcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjMwNDgwXG4gICAgICAgIH0sXG4gICAgICAgIFwieWRcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjkxNDRcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXJlYToge1xuICAgICAgICBkZWZhdWx0U291cmNlOiBcImNtMlwiLFxuICAgICAgICBkZWZhdWx0VGFyZ2V0OiBcIm0yXCIsXG4gICAgICAgIFwibW0yXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC4wMDAwMDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJjbTJcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjAwMDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJkbTJcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAwLjAxXG4gICAgICAgIH0sXG4gICAgICAgIFwibTJcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxXG4gICAgICAgIH0sXG4gICAgICAgIFwia20yXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMTAwMDAwMFxuICAgICAgICB9LFxuICAgICAgICBcImFjXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogNDA0Ni44NlxuICAgICAgICB9LFxuICAgICAgICBcImFcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxMDAuMFxuICAgICAgICB9LFxuICAgICAgICBcImhhXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMTAwMDAuMFxuICAgICAgICB9LFxuICAgICAgICBcIm1pMlwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDI1ODk4NDZcbiAgICAgICAgfSxcbiAgICAgICAgXCJ5MlwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuODM2MVxuICAgICAgICB9LFxuICAgICAgICBcImYyXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC4wOTI5MDNcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYW5nbGU6IHtcbiAgICAgICAgZGVmYXVsdFNvdXJjZTogXCJyYWRcIixcbiAgICAgICAgZGVmYXVsdFRhcmdldDogXCJnXCIsXG4gICAgICAgIFwicmFkXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMVxuICAgICAgICB9LFxuICAgICAgICBcImRlZ1wiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDAuMDE3NDUzM1xuICAgICAgICB9XG4gICAgfSxcbiAgICBtYXNzOiB7XG4gICAgICAgIGRlZmF1bHRTb3VyY2U6IFwia2dcIixcbiAgICAgICAgZGVmYXVsdFRhcmdldDogXCJnXCIsXG4gICAgICAgIFwia2dcIjoge1xuICAgICAgICAgICAgZmFjdG9yOiAxXG4gICAgICAgIH0sXG4gICAgICAgIFwidFwiOiB7XG4gICAgICAgICAgICBmYWN0b3I6IDEwMDBcbiAgICAgICAgfSxcbiAgICAgICAgXCJnXCI6IHtcbiAgICAgICAgICAgIGZhY3RvcjogMC4wMDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJtZ1wiOiB7XG4gICAgICAgICAgICB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gICAgICB0b051bWJlcjogVW5pdC50b051bWJlcixcbiAgICAgICAgICAgIHRvU3RyaW5nOiBVbml0LnRvU3RyaW5nXG4gICAgICAgIH07XG4gICAgfVxufTtcblxubW9kdWxlLmV4cG9ydHMgPSBVbml0O1xuIl19 diff --git a/build/tinu.min.js b/build/tinu.min.js index 69272dd..f848e83 100644 --- a/build/tinu.min.js +++ b/build/tinu.min.js @@ -1 +1 @@ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Tinu=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g