main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
634 bytes
|
Line | |
---|
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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.