Socket
Socket
Sign inDemoInstall

vue-currency-input

Package Overview
Dependencies
10
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.20.0 to 1.20.1

24

dist/vue-currency-input.esm.js
/**
* Vue Currency Input 1.20.0
* Vue Currency Input 1.20.1
* (c) 2018-2020 Matthias Stiller

@@ -15,5 +15,2 @@ * @license MIT

};
var toInternalNumberModel = function (number, valueAsInteger, fractionDigits) {
return valueAsInteger && number != null ? number / Math.pow(10, fractionDigits) : number
};

@@ -298,3 +295,3 @@ var escapeRegExp = function (str) { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); };

var currencyFormat = new NumberFormat(options);
inputElement.$ci = Object.assign({}, inputElement.$ci || {},
inputElement.$ci = Object.assign({}, inputElement.$ci || { numberValue: null },
{options: options,

@@ -409,5 +406,6 @@ numberMask: options.autoDecimalMode ? new AutoDecimalModeNumberMask(currencyFormat) : new DefaultNumberMask(currencyFormat),

var numberValue = ref.numberValue;
var value = toInternalNumberModel(e.detail.value, options.valueAsInteger, currencyFormat.maximumFractionDigits);
if (value !== numberValue) {
applyFixedFractionFormat(el, value);
var toInternalNumberModel = function (n) { return options.valueAsInteger && n != null ? n / Math.pow(10, currencyFormat.maximumFractionDigits) : n; };
var newValue = toInternalNumberModel(e.detail.value);
if (numberValue !== newValue) {
applyFixedFractionFormat(el, newValue);
}

@@ -451,11 +449,7 @@ });

bind: function bind (el, ref, ref$1) {
var options = ref.value;
var value = ref.value;
var context = ref$1.context;
var inputElement = init(el, options, context);
var value = inputElement.value;
var currencyFormat = inputElement.$ci.currencyFormat;
if (value) {
applyFixedFractionFormat(inputElement, toInternalNumberModel(currencyFormat.parse(value), options.valueAsInteger, currencyFormat.maximumFractionDigits));
}
var inputElement = init(el, value, context);
addEventListener(inputElement);
setValue(inputElement, inputElement.$ci.currencyFormat.parse(inputElement.value));
},

@@ -462,0 +456,0 @@ componentUpdated: function componentUpdated (el, ref, ref$1) {

/**
* Vue Currency Input 1.20.0
* Vue Currency Input 1.20.1
* (c) 2018-2020 Matthias Stiller

@@ -21,5 +21,2 @@ * @license MIT

};
var toInternalNumberModel = function (number, valueAsInteger, fractionDigits) {
return valueAsInteger && number != null ? number / Math.pow(10, fractionDigits) : number
};

@@ -304,3 +301,3 @@ var escapeRegExp = function (str) { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); };

var currencyFormat = new NumberFormat(options);
inputElement.$ci = Object.assign({}, inputElement.$ci || {},
inputElement.$ci = Object.assign({}, inputElement.$ci || { numberValue: null },
{options: options,

@@ -415,5 +412,6 @@ numberMask: options.autoDecimalMode ? new AutoDecimalModeNumberMask(currencyFormat) : new DefaultNumberMask(currencyFormat),

var numberValue = ref.numberValue;
var value = toInternalNumberModel(e.detail.value, options.valueAsInteger, currencyFormat.maximumFractionDigits);
if (value !== numberValue) {
applyFixedFractionFormat(el, value);
var toInternalNumberModel = function (n) { return options.valueAsInteger && n != null ? n / Math.pow(10, currencyFormat.maximumFractionDigits) : n; };
var newValue = toInternalNumberModel(e.detail.value);
if (numberValue !== newValue) {
applyFixedFractionFormat(el, newValue);
}

@@ -457,11 +455,7 @@ });

bind: function bind (el, ref, ref$1) {
var options = ref.value;
var value = ref.value;
var context = ref$1.context;
var inputElement = init(el, options, context);
var value = inputElement.value;
var currencyFormat = inputElement.$ci.currencyFormat;
if (value) {
applyFixedFractionFormat(inputElement, toInternalNumberModel(currencyFormat.parse(value), options.valueAsInteger, currencyFormat.maximumFractionDigits));
}
var inputElement = init(el, value, context);
addEventListener(inputElement);
setValue(inputElement, inputElement.$ci.currencyFormat.parse(inputElement.value));
},

@@ -468,0 +462,0 @@ componentUpdated: function componentUpdated (el, ref, ref$1) {

{
"name": "vue-currency-input",
"description": "Easy input of currency formatted numbers for Vue.js.",
"version": "1.20.0",
"version": "1.20.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "unpkg": "dist/vue-currency-input.umd.js",

@@ -1,6 +0,6 @@

import { DEFAULT_OPTIONS } from './api'
import { DEFAULT_OPTIONS, setValue } from './api'
import { getCaretPositionAfterFormat, getDistractionFreeCaretPosition, setCaretPosition } from './utils/caretPosition'
import dispatchEvent from './utils/dispatchEvent'
import equal from './utils/equal'
import { toExternalNumberModel, toInternalNumberModel } from './utils/numberUtils'
import { toExternalNumberModel } from './utils/numberUtils'
import NumberFormat, { DECIMAL_SYMBOLS } from './numberFormat'

@@ -45,3 +45,3 @@ import { AutoDecimalModeNumberMask, DefaultNumberMask } from './numberMask'

inputElement.$ci = {
...inputElement.$ci || {},
...inputElement.$ci || { numberValue: null },
options,

@@ -143,5 +143,6 @@ numberMask: options.autoDecimalMode ? new AutoDecimalModeNumberMask(currencyFormat) : new DefaultNumberMask(currencyFormat),

const { currencyFormat, options, numberValue } = el.$ci
const value = toInternalNumberModel(e.detail.value, options.valueAsInteger, currencyFormat.maximumFractionDigits)
if (value !== numberValue) {
applyFixedFractionFormat(el, value)
const toInternalNumberModel = n => options.valueAsInteger && n != null ? n / Math.pow(10, currencyFormat.maximumFractionDigits) : n
const newValue = toInternalNumberModel(e.detail.value)
if (numberValue !== newValue) {
applyFixedFractionFormat(el, newValue)
}

@@ -183,9 +184,6 @@ })

export default {
bind (el, { value: options }, { context }) {
const inputElement = init(el, options, context)
const { value, $ci: { currencyFormat } } = inputElement
if (value) {
applyFixedFractionFormat(inputElement, toInternalNumberModel(currencyFormat.parse(value), options.valueAsInteger, currencyFormat.maximumFractionDigits))
}
bind (el, { value }, { context }) {
const inputElement = init(el, value, context)
addEventListener(inputElement)
setValue(inputElement, inputElement.$ci.currencyFormat.parse(inputElement.value))
},

@@ -192,0 +190,0 @@ componentUpdated (el, { value, oldValue }, { context }) {

export const toExternalNumberModel = (number, valueAsInteger, fractionDigits) => {
return valueAsInteger && number != null ? Number(number.toFixed(fractionDigits).split('.').join('')) : number
}
export const toInternalNumberModel = (number, valueAsInteger, fractionDigits) => {
return valueAsInteger && number != null ? number / Math.pow(10, fractionDigits) : number
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc