address-parse
address-parse copied to clipboard
如何导入TS
如何导入Type Script?
同求tyepscript类型定义文件
// @ts-ignore
import {ParseAddress} from 'address-parse'
const PARSER = new ParseAddress() as Parser
interface Parser {
parse(content: string): readonly Address[]
}
export interface Address {
readonly province: string
readonly city: string
readonly area: string
readonly details: string
readonly name: string
readonly code: string,
readonly mobile: string,
readonly zip_code: string,
readonly phone: string
}
export function parse(content: string): Address {
return PARSER.parse(content)[0]
}