Huge News!Announcing our $40M Series B led by Abstract Ventures.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.3 to 0.0.4

4

dist/angular-unit-converter.min.js

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

/*! angular-unit-converter 0.0.3 */
var auc=angular.module("angular-unit-converter",[]);auc.directive("angularUnitConverter",function(a){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){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){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=""})}}});
/*! angular-unit-converter 0.0.4 */
var auc=angular.module("angular-unit-converter",[]);auc.directive("angularUnitConverter",function(a){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.3",
"version": "0.0.4",
"description": "AngularJS directive that converts to/from metric units using $parser and $formatters",

@@ -5,0 +5,0 @@ "main": [

@@ -37,2 +37,4 @@ var auc = angular.module('angular-unit-converter', []);

scope.do_convertFrom = function(value) {
if(!scope.convertFrom || scope.convertFrom === "") return value;
var from = new Decimal(units[scope.convertFrom]);

@@ -44,2 +46,4 @@ var to = new Decimal(units[scope.convertTo]);

scope.do_convertTo = function(value) {
if(!scope.convertTo || scope.convertTo === "") return value;
var from = new Decimal(units[scope.convertFrom]);

@@ -46,0 +50,0 @@ var to = new Decimal(units[scope.convertTo]);

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