Source: polyfill.js

  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Watson Analytics
  4. //
  5. // (C) Copyright IBM Corp. 2016
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or
  8. // disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. // Native objects available since the beginning; may contain polyfills for multiple levels of ES compliance.
  10. // No need to expose these on "polyfill" since they are always available
  11. require( "./polyfill/Array" );
  12. require( "./polyfill/Date" );
  13. require( "./polyfill/Function" );
  14. require( "./polyfill/Math" );
  15. require( "./polyfill/Number" );
  16. require( "./polyfill/Object" );
  17. require( "./polyfill/String" );
  18. /**
  19. * The polyfill module contains polyfills for objects in the ECMAScript specification.
  20. * @module barejs/polyfill
  21. */
  22. Object.assign( exports,
  23. // Note: although we define this module to be barejs/polyfill, its properties are actually added to barejs, so tell jsdoc about that.
  24. /** @lends module:barejs */
  25. {
  26. /**
  27. * NMap - Version of Map that prefers the native implementation over the polyfill, even if it doesn't have
  28. * iterator support (like in Internet Explorer 11). If Iterator support is required, use
  29. * {@link module:barejs.Map Map} instead.
  30. * @member {function}
  31. */
  32. NMap: require( "./NMap" ),
  33. /**
  34. * NSet - Version of Set that prefers the native implementation over the polyfill, even if it doesn't have
  35. * iterator support (like in Internet Explorer 11). If Iterator support is required, use
  36. * {@link module:barejs.Set Set} instead.
  37. * @member {function}
  38. */
  39. NSet: require( "./NSet" ),
  40. // New built-in objects that will be polyfilled (but not globally)
  41. /**
  42. * This is either the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl Intl}
  43. * or the {@link module:barejs/polyfill.Intl fallback} provided by BareJS. Note that BareJS's fallback just provides a similar API,
  44. * it has not actual localization features. It's main purpose is to gracefully fallback to very limited formatting on
  45. * environments that don't support Intl. For proper support, load a full Intl polyfill.
  46. * @member {function}
  47. */
  48. Intl: require( "./Intl" ),
  49. /**
  50. * This is either the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Map}
  51. * or the {@link module:barejs/polyfill.Map polyfill} provided by BareJS. This implementation is ensured to have iterator support (using the polyfill), if no
  52. * iterator support is required it is better to use {@link module:barejs.NMap NMap} instead.
  53. * @member {function}
  54. */
  55. Map: require( "./Map" ),
  56. /**
  57. * This is either the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap WeakMap}
  58. * or the {@link module:barejs/polyfill.WeakMap polyfill} provided by BareJS.
  59. * @member {function}
  60. */
  61. WeakMap: require( "./WeakMap" ),
  62. /**
  63. * This is either the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set Set}
  64. * or the {@link module:barejs/polyfill.Set polyfill} provided by BareJS. This implementation is ensured to have iterator support (using the polyfill), if no
  65. * iterator support is required it is better to use {@link module:barejs.NSet NSet} instead.
  66. * @member {function}
  67. */
  68. Set: require( "./Set" ),
  69. /**
  70. * This is either the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet WeakSet}
  71. * or the {@link module:barejs/polyfill.WeakSet polyfill} provided by BareJS.
  72. * @member {function}
  73. */
  74. WeakSet: require( "./WeakSet" ),
  75. /**
  76. * This is either the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol Symbol}
  77. * or the {@link module:barejs/polyfill.Symbol polyfill} provided by BareJS.
  78. * @member {function}
  79. */
  80. Symbol: require( "./Symbol" ),
  81. /**
  82. * This is either the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promise}
  83. * or the {@link module:barejs/polyfill.Promise polyfill} provided by BareJS.
  84. * @member {function}
  85. */
  86. Promise: require( "./Promise" )
  87. } );