Last change
on this file since e29cc2e 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 |
|
---|
3 | const propertyToValueAliases = require('./data/mappings.js');
|
---|
4 |
|
---|
5 | const 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 |
|
---|
19 | module.exports = matchPropertyValue;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.