0.1.4 • Published 8 years ago

format-matcher v0.1.4

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

Format matcher

Find best format for input string using prepared formats.

Build Status

Usage

Install

npm i format-matcher -S

Require and use

const makeMatcher = require('format-matcher');

const formats = ['A 9', 'A-9', '9 A'];
const find = makeMatcher(formats);

const input = 'H-1';
const format = find(input);

format === 'A-9'; // true

String pattern for input and format

Any combination of characters are allowed for input and format, but any non A-z & 0-9 & - or space would be removed.

Thus for these formats would be treated as same:

  • A-9 A. - dot would be removed
  • A 8*-L - asterisk would be removed
  • Q-1 M= - equals would be removed

Same applies for inputs

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago