source: trip-planner-front/node_modules/unicode-match-property-value-ecmascript/index.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 504 bytes
Line 
1'use strict';
2
3const propertyToValueAliases = require('./data/mappings.js');
4
5const matchPropertyValue = function(property, value) {
6 const aliasToValue = propertyToValueAliases.get(property);
7 if (!aliasToValue) {
8 throw new Error(`Unknown property \`${ property }\`.`);
9 }
10 const canonicalValue = aliasToValue.get(value);
11 if (canonicalValue) {
12 return canonicalValue;
13 }
14 throw new Error(
15 `Unknown value \`${ value }\` for property \`${ property }\`.`
16 );
17};
18
19module.exports = matchPropertyValue;
Note: See TracBrowser for help on using the repository browser.