All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.index.js Maven / Gradle / Ivy

Go to download

Match a Unicode property or property alias to its canonical property name per the algorithm used for RegExp Unicode property escapes in ECMAScript.

The newest version!
'use strict';

const propertyToValueAliases = require('./data/mappings.js');

const matchPropertyValue = function(property, value) {
	const aliasToValue = propertyToValueAliases.get(property);
	if (!aliasToValue) {
		throw new Error(`Unknown property \`${ property }\`.`);
	}
	const canonicalValue = aliasToValue.get(value);
	if (canonicalValue) {
		return canonicalValue;
	}
	throw new Error(
		`Unknown value \`${ value }\` for property \`${ property }\`.`
	);
};

module.exports = matchPropertyValue;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy