dogpackdesign / apn-formats-js

A database for county-specific formats of assessor's parcel numbers (APNs).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

apn-formats


Note: These formats were valid in 2016. We can not guarantee that they are all valid today.

This package is meant to validate or lookup Assessor’s Parcel Number (APN) formats for any given state/county in the United States. This package is based off this python package

Build Status

Getting Started

npm install apn-formats

Usage


var apn-formats = require('apn-formats');

lookup()

/*
  lookup() returns a list of all valid APN formats for a given county. 
  If only a state is given, an object of all counties and their APNs are returned.
  If no arguments are provided, an object of all APN formats is returned.

Case and spaces are ignored in state and county names. State names can be full names or abbreviations ('Washington' or 'WA'). District of Columbia is represented with 'DC'.

X: Integer [0-9] A: Capital letter [A-Z] S: Space All other characters are literal */


var formats = apn-formats.lookup('Washington', 'King');

console.log(formats);
// output
[ 
  'XXXXXX-XXXX', 
  'XXXXXXXX', 
  'XXXXXX-XXXXSXX' 
]

var formats = apn-formats.lookup('hi');

console.log(formats);
// output
{ 
  maui: [ 'X-X-X-XXX-XXX', 'X-X-X-XXX-XXX-XXXX' ],
  kalawao: [],
  hawaii: [ 'X-X-X-XXX-XXX', 'X-X-X-XXX-XXX-XXXX' ],
  kauai: [ 'X-X-X-XXX-XXX', 'X-X-X-XXX-XXX-XXXX' ],
  honolulu: 
   [ 'X-X-X-XXX-XXX',
     'X-X-X-XXX-XXX-XXXX',
     'X-X-X-XXX-XXXSXX',
     'X-X-X-XXX-XXXSAA' ] 
 }

validate()


/*
  validate() checks whether a given APN is valid for a given county.
  Returns either true or false.
  All letter characters MUST be capitalized.
*/

var validation = apn-formats.validate('123456-7890', 'wa', 'king'); console.log(validation); //output true

var validation = apn-formats.validate('1234-5678, 'wa', 'king'); console.log(validation); //output false

License

Licensed under The MIT License (MIT)

For the full copyright and license information, please view the LICENSE.txt file.

About

A database for county-specific formats of assessor's parcel numbers (APNs).

License:MIT License


Languages

Language:JavaScript 100.0%