/node-vehicle-restriction

calc vehicle restriction rule

Primary LanguageJavaScriptMIT LicenseMIT

node-vehicle-restriction

NPM version

calc vehicle restriction rule


Installation

$ npm install vehicle-restriction

Feature

  • noremalize plate string
  • test if the vehicle' plate is restricted
  • show which plate number is restricted
  • support more city

Example

const vr = require('vehicle-restriction');

console.log(vr.hz.isRestricted('浙A·F8965', 5));
// ==> true

Usage

Currently, it's only support hangzhou

Namespace

All methods is associated with city by a namespace, and the namespace is the city's name in Pinyin, or shorted letters. eg: if the module was required as vr, Hangzhou will be vr.hz or vr.hangzhou.

APIs

.isRestricted(plate, day)

Params:

  • plate: String of the vehicle's plate, supported format: 浙A·F8965, 浙A-F8965, 浙A F8965 or 浙AF8965.
  • day<Number | String>: Day number in a week, 0 for Sunday, 1 for Monday, etc.

Return: : true: is restricted; false: is not restricted.

License

MIT © Leigh Zhu