tethys-feature-service/node_modules/proj4/lib/match.js
2023-10-02 15:04:02 +02:00

18 lines
444 B
JavaScript

var ignoredChar = /[\s_\-\/\(\)]/g;
export default function match(obj, key) {
if (obj[key]) {
return obj[key];
}
var keys = Object.keys(obj);
var lkey = key.toLowerCase().replace(ignoredChar, '');
var i = -1;
var testkey, processedKey;
while (++i < keys.length) {
testkey = keys[i];
processedKey = testkey.toLowerCase().replace(ignoredChar, '');
if (processedKey === lkey) {
return obj[testkey];
}
}
}