A parser to find where a secondary name or abbreviation is in a string.
Full documentation is available at the zerodep.app page.
All @zerodep packages support both ESM and CJS.
import { addressSecondary } from '@zerodep/address-secondary';
// or
const { addressSecondary } = require('@zerodep/address-secondary');
addressSecondary('basement 1234 Main Street East Los Angeles CA, US');
// [
// {
// secondary: 'BSMT',
// source: 'basement',
// ndx: 0,
// length: 8,
// hasUnit: false,
// },
// ]
addressSecondary('office 1234 Main Street East ph 4 Los Angeles CA, US');
// [
// {
// secondary: 'OFC',
// source: 'office',
// ndx: 0,
// length: 6,
// hasUnit: true,
// },
// {
// secondary: 'PH',
// source: 'ph',
// ndx: 29,
// length: 2,
// hasUnit: true,
// },
// ]