UNPKG

atriusmaps-node-sdk

Version:

This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information

54 lines (50 loc) 1.04 kB
'use strict'; var lang = require('./lang.js'); const regex_a = lang.regex("[\xE0\xE1\xE2\xE3\xE4\xE5]"); const regex_e = lang.regex("[\xE8\xE9\xEA\xEB]"); const regex_i = lang.regex("[\xEC\xED\xEE\xEF]"); const regex_o = lang.regex("[\xF2\xF3\xF4\xF5\xF6\u0151]"); const regex_u = lang.regex("[\xF9\xFA\xFB\xFC\u0171]"); const regex_y = lang.regex("[\xFD\u0177\xFF]"); const regex_n = lang.regex("\xF1"); const regex_c = lang.regex("[\xE7c]"); const regex_s = lang.regex("\xDF"); const regex_and = lang.regex(" & "); const pairs = [ regex_a, "a", regex_e, "e", regex_i, "i", regex_o, "o", regex_u, "u", regex_y, "y", regex_n, "n", regex_c, "k", regex_s, "s", regex_and, " and " // regex_whitespace, " " // regex_strip, "" ]; function encode(str) { str = "" + str; return lang.pipeline.call( this, /* string: */ lang.normalize(str).toLowerCase(), /* normalize: */ !str.normalize && pairs, /* split: */ lang.regex_whitespace, false ); } exports.encode = encode;