Giter VIP home page Giter VIP logo

taal.js's Introduction

Taal.js

ํƒˆ(Taal) means a mask in Korean. Taal.js is a basic and simple input masking helper. This does not have any framework dependency.

Usage

  • You can import by just simply add Taal.js file into your project.
  • Taal( userInput, maskPattern ) will return an object with three keys.

Example

/*
* You have to use 0s in your mask pattern in order to replace 0 into your input.
* User input must be in string
*/

Taal( '6503213323', '(000)000-0000') // this will return { hasError: false, errorMessage: '', result: '(650)321-3323'}
Taal( '65032133233', '(000)000-0000') // this will return { hasError: true, errorMessage: 'your input length is not compatible with given mask', result: ''}
Taal( '12211990', '00/00/0000') // this will return { hasError: false, errorMessage: '', result: '12/21/1990'}
UPDATE LOG
11/10/2017
  • Entry point change for require or import statement
  • Export default function added (Bug fix)
11/9/2017
  • Karma issue fixed.
  • Minor edge case has handled
11/4/2017
  • Project initiated and test spec has created.
  • Basic functionality has been created
  • Has issue with Karma testing

taal.js's People

Contributors

saebyuckbaan avatar

Stargazers

 avatar Patrick Yi avatar

Watchers

James Cloos avatar  avatar

Forkers

patrick-yi-82

taal.js's Issues

hasError is unnecassary

{
hasError: hasError,
errorMessage: errorMessage,
result: result
};

errorMessage can be set to null as default, which means no error (or undefined).

I've seen many APIs that uses the following structure
If success { data: results }
If error { errors: [error] }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.