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

morrison

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morrison

Morrison protects your inputs by only allowing certain characters in.

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by20%
Maintainers
2
Weekly downloads
 
Created
Source

morrison

Morrison protects your state by rejecting undesirable characters.

Usage

var morrison = require('morrison');

window.onload = function() {
    var settings = {
        validators: {
            '[data-validate=number]': /^\d*$|^\d*\.$|^\d*\.\d+$/,
            '[data-validate=integer]': /^\d*$/,
            '[data-validate=foo]': /^f$|^fo$|^foo$/
        }
    };

    morrison(settings);
};

Validator keys are element selectors and the value is a regex to restrict input.

Works for both keypress and paste.

<input data-validate=number/>   <!-- Only allow numbers -->
<input data-validate=integer/>  <!-- Only allow integers -->
<input data-validate=foo/>      <!-- Only allow foo -->

Example

npm run example

FAQs

Package last updated on 13 Apr 2018

Did you know?

Socket

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.

Install

Related posts

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