/melanite

User Agent string to device matching library

Primary LanguageJavaScriptApache License 2.0Apache-2.0

melanite


User-Agent to TAL device identification.

For example usage see example.js

API

melanite.match :: [matcher] -> userAgent -> device

Matcher:

[{
	brand: 'brand', // the brand of the device
	model: 'model', // the model name of the device
	invariant: [String], // substrings that will always be present
	disallowed: [String], // substrings that can never be present
	fuzzy: String // an example user agent that will be fuzzily matched, assuming that the invariants and disalloweds are met
	type: String // the type of device, e.g. 'tv'.
}, {
	...
}]

Device:

{
	brand: String, // the brand of the device
	model: String, // the model name of the device
	type: String, // the type of device
}