mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
/** Used for native method references. */
|
|
var objectProto = Object.prototype;
|
|
|
|
/** Used to detect DOM support. */
|
|
var document = (document = global.window) && document.document;
|
|
|
|
/** Native method references. */
|
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
|
|
/**
|
|
* An object environment feature flags.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @type Object
|
|
*/
|
|
var support = {};
|
|
|
|
(function(x) {
|
|
var Ctor = function() { this.x = x; },
|
|
object = { '0': x, 'length': x },
|
|
props = [];
|
|
|
|
Ctor.prototype = { 'valueOf': x, 'y': x };
|
|
for (var key in new Ctor) { props.push(key); }
|
|
|
|
/**
|
|
* Detect if functions can be decompiled by `Function#toString`
|
|
* (all but Firefox OS certified apps, older Opera mobile browsers, and
|
|
* the PlayStation 3; forced `false` for Windows 8 apps).
|
|
*
|
|
* @memberOf _.support
|
|
* @type boolean
|
|
*/
|
|
support.funcDecomp = /\bthis\b/.test(function() { return this; });
|
|
|
|
/**
|
|
* Detect if `Function#name` is supported (all but IE).
|
|
*
|
|
* @memberOf _.support
|
|
* @type boolean
|
|
*/
|
|
support.funcNames = typeof Function.name == 'string';
|
|
|
|
/**
|
|
* Detect if the DOM is supported.
|
|
*
|
|
* @memberOf _.support
|
|
* @type boolean
|
|
*/
|
|
try {
|
|
support.dom = document.createDocumentFragment().nodeType === 11;
|
|
} catch(e) {
|
|
support.dom = false;
|
|
}
|
|
|
|
/**
|
|
* Detect if `arguments` object indexes are non-enumerable.
|
|
*
|
|
* In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object
|
|
* indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat
|
|
* `arguments` object indexes as non-enumerable and fail `hasOwnProperty`
|
|
* checks for indexes that exceed the number of function parameters and
|
|
* whose associated argument values are `0`.
|
|
*
|
|
* @memberOf _.support
|
|
* @type boolean
|
|
*/
|
|
try {
|
|
support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1);
|
|
} catch(e) {
|
|
support.nonEnumArgs = true;
|
|
}
|
|
}(1, 0));
|
|
|
|
module.exports = support;
|