main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
634 bytes
|
Rev | Line | |
---|
[d24f17c] | 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.