Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
text-mask-addons
Advanced tools
The text-mask-addons npm package provides a set of useful add-ons for the text-mask library, which is used to create input masks for form fields. These add-ons include pre-defined masks for common input types such as phone numbers, email addresses, and dates.
createNumberMask
The createNumberMask function allows you to create a mask for numeric inputs. This is useful for formatting currency, percentages, or any other numerical input.
const createNumberMask = require('text-mask-addons/dist/createNumberMask');
const numberMask = createNumberMask({
prefix: '$',
suffix: '',
includeThousandsSeparator: true,
thousandsSeparatorSymbol: ',',
allowDecimal: true,
decimalSymbol: '.',
decimalLimit: 2,
integerLimit: 7,
allowNegative: false,
allowLeadingZeroes: false
});
emailMask
The emailMask is a pre-defined mask for email addresses. It ensures that the input follows the general structure of an email address.
const emailMask = require('text-mask-addons/dist/emailMask');
const maskedInput = emailMask;
createAutoCorrectedDatePipe
The createAutoCorrectedDatePipe function creates a pipe that auto-corrects date input as the user types. This is useful for ensuring that dates are entered in a valid format.
const createAutoCorrectedDatePipe = require('text-mask-addons/dist/createAutoCorrectedDatePipe');
const autoCorrectedDatePipe = createAutoCorrectedDatePipe('mm/dd/yyyy');
react-text-mask is a library for creating input masks in React applications. It provides similar functionality to text-mask-addons but is specifically designed for use with React components.
Cleave.js is a JavaScript library for formatting input fields. It offers a wide range of formatting options, including credit card numbers, phone numbers, dates, and more. Cleave.js provides more flexibility and customization options compared to text-mask-addons.
inputmask is a library for creating input masks in JavaScript. It supports a wide range of input types and provides extensive customization options. Inputmask is more feature-rich and versatile compared to text-mask-addons.
Text Mask addons are accessories for Text Mask. Currently, the only available addon is
createMmddyyyyValidator.js
npm i text-mask-addons --save-dev
createMmddyyyyValidator
createMmddyyyyValidator
returns a function that ensures the user is typing a valid mm/dd/yyyy
date.
import createMmddyyyyValidator from 'text-mask-addons/dist/createMmddyyyyValidator'
var mmddyyyyValidator = createMmddyyyyValidator({
minimumDate: '01/01/1900',
maximumDate: '12/31/2016'
})
// ...then pass `mmddyyyyValidator` to Text Mask component
FAQs
Addons for Text Mask https://github.com/text-mask/text-mask
We found that text-mask-addons demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.