forked from cujojs/poly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
es5-strict.js
43 lines (36 loc) · 987 Bytes
/
es5-strict.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/** @license MIT License (c) copyright 2013 original authors */
/**
* stricter ES5 polyfills / shims for AMD loaders
*
* @author Brian Cavalier
* @author John Hann
*/
(function (define) {
define(function (require) {
var object = require('./object');
var string = require('./string');
var date = require('./date');
require('./array');
require('./function');
require('./json');
require('./xhr');
var failTestRx;
failTestRx = /^define|^prevent|descriptor$/i;
function regexpShouldThrow (feature) {
return failTestRx.test(feature);
}
// set unshimmable Object methods to be somewhat strict:
object.failIfShimmed(regexpShouldThrow);
// set strict whitespace
string.setWhitespaceChars('\\s');
return {
failIfShimmed: object.failIfShimmed,
setWhitespaceChars: string.setWhitespaceChars,
setIsoCompatTest: date.setIsoCompatTest
};
});
}(
typeof define == 'function' && define.amd
? define
: function (factory) { module.exports = factory(require); }
));