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