How to use the @financial-times/polyfill-useragent-normaliser.getBaselines function in @financial-times/polyfill-useragent-normaliser

To help you get started, we’ve selected a few @financial-times/polyfill-useragent-normaliser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Financial-Times / polyfill-library / tasks / node / buildsources.js View on Github external
.then(data => {
				this.config = TOML.parse(data);

				// Each internal polyfill needs to target all supported browsers at all versions.
				if (this.path.relative.startsWith('_')) {
					const supportedBrowsers = Object.keys(UA.getBaselines()).sort((a, b) => a.localeCompare(b));
					if (!supportedBrowsers.every(browser => this.config.browsers[browser] === "*")){
						const browserSupport = {};
						supportedBrowsers.forEach(browser => browserSupport[browser] = "*");
						throw new Error("Internal polyfill called " + this.name + " is not targeting all supported browsers correctly. It should be: \n" + TOML.stringify(browserSupport));
					}
				}

				this.config.detectSource = '';
				this.config.baseDir = this.path.relative;

				if ('licence' in this.config) {
					throw new Error(`Incorrect spelling of license property in ${this.name}`);
				}

				this.config.hasTests = fs.existsSync(path.join(this.path.absolute, 'tests.js'));
				this.config.isTestable = !('test' in this.config && 'ci' in this.config.test && this.config.test.ci === false);

@financial-times/polyfill-useragent-normaliser

The user-agent normalisation logic behind polyfill-library and polyfill.io

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages