1 | 'use strict';
|
2 | var fails = require('../internals/fails');
|
3 | var isCallable = require('../internals/is-callable');
|
4 |
|
5 | var replacement = /#|\.prototype\./;
|
6 |
|
7 | var isForced = function (feature, detection) {
|
8 | var value = data[normalize(feature)];
|
9 | return value === POLYFILL ? true
|
10 | : value === NATIVE ? false
|
11 | : isCallable(detection) ? fails(detection)
|
12 | : !!detection;
|
13 | };
|
14 |
|
15 | var normalize = isForced.normalize = function (string) {
|
16 | return String(string).replace(replacement, '.').toLowerCase();
|
17 | };
|
18 |
|
19 | var data = isForced.data = {};
|
20 | var NATIVE = isForced.NATIVE = 'N';
|
21 | var POLYFILL = isForced.POLYFILL = 'P';
|
22 |
|
23 | module.exports = isForced;
|