Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@maskito/kit

Package Overview
Dependencies
Maintainers
4
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maskito/kit - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

lib/utils/find-common-beginning-substr.d.ts

40

index.esm.js

@@ -267,2 +267,16 @@ import { MASKITO_DEFAULT_OPTIONS, maskitoTransform } from '@maskito/core';

function findCommonBeginningSubstr(a, b) {
let res = '';
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) {
return res;
}
res += a[i];
}
return res;
}
/**

@@ -345,2 +359,3 @@ * Returns current active element, including shadow dom

function maskitoPostfixPostprocessorGenerator(postfix) {
const postfixRE = new RegExp(`${escapeRegExp(postfix)}$`);
return postfix ? ({

@@ -350,5 +365,4 @@ value,

}, initialElementState) => {
if (value.endsWith(postfix) || // already valid
!value && !initialElementState.value.endsWith(postfix) // cases when developer wants input to be empty
) {
if (!value && !initialElementState.value.endsWith(postfix)) {
// cases when developer wants input to be empty (programmatically)
return {

@@ -367,2 +381,5 @@ value,

const initialValueBeforePostfix = initialElementState.value.replace(postfixRE, '');
const postfixWasModified = initialElementState.selection[1] >= initialValueBeforePostfix.length;
const alreadyExistedValueBeforePostfix = findCommonBeginningSubstr(initialValueBeforePostfix, value);
return {

@@ -372,3 +389,4 @@ selection,

const i = newValue.length - 1 - index;
return newValue[i] !== char ? newValue.slice(0, i + 1) + char + newValue.slice(i + 1) : newValue;
const isInitiallyMirroredChar = alreadyExistedValueBeforePostfix[i] === char && postfixWasModified;
return newValue[i] !== char || isInitiallyMirroredChar ? newValue.slice(0, i + 1) + char + newValue.slice(i + 1) : newValue;
}, value)

@@ -1115,3 +1133,4 @@ };

precision,
decimalZeroPadding
decimalZeroPadding,
postfix
}) {

@@ -1122,2 +1141,3 @@ if (precision <= 0 || !decimalZeroPadding) {

const trailingPostfixRegExp = new RegExp(`${escapeRegExp(postfix)}$`);
return ({

@@ -1127,5 +1147,3 @@ value,

}) => {
const [integerPart, decimalPart = ''] = value.split(decimalSeparator);
if (!value.includes(decimalSeparator) && !integerPart) {
if (isNaN(maskitoParseNumber(value))) {
return {

@@ -1137,4 +1155,5 @@ value,

const [integerPart, decimalPart = ''] = value.replace(trailingPostfixRegExp, '').split(decimalSeparator);
return {
value: integerPart + decimalSeparator + decimalPart.padEnd(precision, '0'),
value: integerPart + decimalSeparator + decimalPart.padEnd(precision, '0') + postfix,
selection

@@ -1500,3 +1519,4 @@ };

decimalZeroPadding,
precision
precision,
postfix
})],

@@ -1503,0 +1523,0 @@ plugins: [createNotEmptyIntegerPlugin(decimalSeparator), createMinMaxPlugin({

@@ -7,7 +7,8 @@ import { MaskitoPostprocessor } from '@maskito/core';

*/
export declare function createDecimalZeroPaddingPostprocessor({ decimalSeparator, precision, decimalZeroPadding, }: {
export declare function createDecimalZeroPaddingPostprocessor({ decimalSeparator, precision, decimalZeroPadding, postfix, }: {
decimalSeparator: string;
decimalZeroPadding: boolean;
precision: number;
postfix: string;
}): MaskitoPostprocessor;
//# sourceMappingURL=decimal-zero-padding-postprocessor.d.ts.map

@@ -12,2 +12,3 @@ export * from './clamp';

export * from './escape-reg-exp';
export * from './find-common-beginning-substr';
export * from './get-focused';

@@ -14,0 +15,0 @@ export * from './get-object-from-entries';

{
"name": "@maskito/kit",
"version": "1.2.0",
"version": "1.2.1",
"description": "The optional framework-agnostic Maskito's package with ready-to-use masks",

@@ -33,3 +33,3 @@ "keywords": [

"peerDependencies": {
"@maskito/core": "^1.2.0"
"@maskito/core": "^1.2.1"
},

@@ -36,0 +36,0 @@ "main": "./index.umd.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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