New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-unit-converter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-unit-converter - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

CHANGELOG.md

2

dist/angular-unit-converter.min.js

@@ -1,2 +0,2 @@

/*! angular-unit-converter 0.0.5 */
/*! angular-unit-converter 0.0.6 */
var auc=angular.module("angular-unit-converter",[]);auc.directive("angularUnitConverter",function(){return{require:"ngModel",scope:{convertFrom:"@",convertTo:"@"},link:function(a,b,c,d){Decimal.config({precision:10,errors:!1});var e={mm:.001,cm:.01,m:1,km:1e3,"in":.0254,ft:.3048,yd:.9144,mi:1609.344,mg:.001,g:1,kg:1e3,oz:28.3495231,lb:453.59237};a.do_convertFrom=function(b){if(!a.convertFrom||""===a.convertFrom)return b;var c=new Decimal(e[a.convertFrom]),d=new Decimal(e[a.convertTo]);return new Decimal(b).dividedBy(c.dividedBy(d)).toNumber()},a.do_convertTo=function(b){if(!a.convertTo||""===a.convertTo)return b;var c=new Decimal(e[a.convertFrom]),d=new Decimal(e[a.convertTo]);return new Decimal(b).times(c.dividedBy(d)).toNumber()};var f=function(b){var c=b.match(/^\-?\d+((\.|\,)\d+)?$/g);return null!==c?a.do_convertFrom(parseFloat(b)):void 0},g=function(b){return a.do_convertTo(parseFloat(b))};d.$parsers.push(f),d.$formatters.push(g),a.$watch("[convertFrom, convertTo]",function(a){d.$modelValue=""})}}});
{
"name": "angular-unit-converter",
"version": "0.0.5",
"version": "0.0.6",
"description": "AngularJS directive that converts to/from metric units using $parser and $formatters",
"main": [
"angular-multi-select.js",
"angular-multi-select.css"
],
"main": "angular-unit-converter.js",
"repository": {

@@ -14,8 +11,8 @@ "type": "git",

"dependencies": {
"angular": "1.3.15",
"decimal.js": "4.0.2"
"angular": ">=1.3.15",
"decimal.js": ">=4.0.2"
},
"devDependencies": {
"jquery": "2.1.4",
"angular-mocks": "1.3.15",
"angular-mocks": ">=1.3.15",
"jasmine-jquery": ">=2.0.0",

@@ -22,0 +19,0 @@ "grunt-contrib-uglify": ">=0.5.0",

# AngularJS Unit Converter [![Build Status](https://travis-ci.org/alexandernst/angular-unit-converter.svg?branch=master)](https://travis-ci.org/alexandernst/angular-unit-converter)
AngularJS directive that converts to/from metric units using $parser and $formatters
## How does it works
The idea behind this directive is to take a model's value and convert it from one unit to another,
say from `cm` to `mm`, without changing the value itself, only the view value. Of course, the reverse
way is supported too, aka parsing the view value and setting the model value.
This is very helpful when you want to represent a value in a different unit and let the user interact
with it.
## Demo
[Plnkr demo](http://plnkr.co/edit/7NDpRAbGHi4FfvN4SQ5B?p=preview)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc