index.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. "use strict";
  2. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  3. module.exports = function (t, a) {
  4. var o, c, cg, cs, ce, ceg, ces, cew, cw, e, eg, es, ew, v, vg, vs, w, df, dfg, dfs;
  5. o = Object.create(Object.prototype, {
  6. c: t("c", (c = {})),
  7. cgs: t.gs("c", (cg = function () {}), (cs = function () {})),
  8. ce: t("ce", (ce = {})),
  9. cegs: t.gs("ce", (ceg = function () {}), (ces = function () {})),
  10. cew: t("cew", (cew = {})),
  11. cw: t("cw", (cw = {})),
  12. e: t("e", (e = {})),
  13. egs: t.gs("e", (eg = function () {}), (es = function () {})),
  14. ew: t("ew", (ew = {})),
  15. v: t("", (v = {})),
  16. vgs: t.gs("", (vg = function () {}), (vs = function () {})),
  17. w: t("w", (w = {})),
  18. df: t((df = {})),
  19. dfgs: t.gs((dfg = function () {}), (dfs = function () {}))
  20. });
  21. return {
  22. c: function (a) {
  23. var d = getOwnPropertyDescriptor(o, "c");
  24. a(d.value, c, "Value");
  25. a(d.get, undefined, "Get");
  26. a(d.set, undefined, "Set");
  27. a(d.configurable, true, "Configurable");
  28. a(d.enumerable, false, "Enumerable");
  29. a(d.writable, false, "Writable");
  30. d = getOwnPropertyDescriptor(o, "cgs");
  31. a(d.value, undefined, "GS Value");
  32. a(d.get, cg, "GS Get");
  33. a(d.set, cs, "GS Set");
  34. a(d.configurable, true, "GS Configurable");
  35. a(d.enumerable, false, "GS Enumerable");
  36. a(d.writable, undefined, "GS Writable");
  37. },
  38. ce: function (a) {
  39. var d = getOwnPropertyDescriptor(o, "ce");
  40. a(d.value, ce, "Value");
  41. a(d.get, undefined, "Get");
  42. a(d.set, undefined, "Set");
  43. a(d.configurable, true, "Configurable");
  44. a(d.enumerable, true, "Enumerable");
  45. a(d.writable, false, "Writable");
  46. d = getOwnPropertyDescriptor(o, "cegs");
  47. a(d.value, undefined, "GS Value");
  48. a(d.get, ceg, "GS Get");
  49. a(d.set, ces, "GS Set");
  50. a(d.configurable, true, "GS Configurable");
  51. a(d.enumerable, true, "GS Enumerable");
  52. a(d.writable, undefined, "GS Writable");
  53. },
  54. cew: function (a) {
  55. var d = getOwnPropertyDescriptor(o, "cew");
  56. a(d.value, cew, "Value");
  57. a(d.get, undefined, "Get");
  58. a(d.set, undefined, "Set");
  59. a(d.configurable, true, "Configurable");
  60. a(d.enumerable, true, "Enumerable");
  61. a(d.writable, true, "Writable");
  62. },
  63. cw: function (a) {
  64. var d = getOwnPropertyDescriptor(o, "cw");
  65. a(d.value, cw, "Value");
  66. a(d.get, undefined, "Get");
  67. a(d.set, undefined, "Set");
  68. a(d.configurable, true, "Configurable");
  69. a(d.enumerable, false, "Enumerable");
  70. a(d.writable, true, "Writable");
  71. },
  72. e: function (a) {
  73. var d = getOwnPropertyDescriptor(o, "e");
  74. a(d.value, e, "Value");
  75. a(d.get, undefined, "Get");
  76. a(d.set, undefined, "Set");
  77. a(d.configurable, false, "Configurable");
  78. a(d.enumerable, true, "Enumerable");
  79. a(d.writable, false, "Writable");
  80. d = getOwnPropertyDescriptor(o, "egs");
  81. a(d.value, undefined, "GS Value");
  82. a(d.get, eg, "GS Get");
  83. a(d.set, es, "GS Set");
  84. a(d.configurable, false, "GS Configurable");
  85. a(d.enumerable, true, "GS Enumerable");
  86. a(d.writable, undefined, "GS Writable");
  87. },
  88. ew: function (a) {
  89. var d = getOwnPropertyDescriptor(o, "ew");
  90. a(d.value, ew, "Value");
  91. a(d.get, undefined, "Get");
  92. a(d.set, undefined, "Set");
  93. a(d.configurable, false, "Configurable");
  94. a(d.enumerable, true, "Enumerable");
  95. a(d.writable, true, "Writable");
  96. },
  97. v: function (a) {
  98. var d = getOwnPropertyDescriptor(o, "v");
  99. a(d.value, v, "Value");
  100. a(d.get, undefined, "Get");
  101. a(d.set, undefined, "Set");
  102. a(d.configurable, false, "Configurable");
  103. a(d.enumerable, false, "Enumerable");
  104. a(d.writable, false, "Writable");
  105. d = getOwnPropertyDescriptor(o, "vgs");
  106. a(d.value, undefined, "GS Value");
  107. a(d.get, vg, "GS Get");
  108. a(d.set, vs, "GS Set");
  109. a(d.configurable, false, "GS Configurable");
  110. a(d.enumerable, false, "GS Enumerable");
  111. a(d.writable, undefined, "GS Writable");
  112. },
  113. w: function (a) {
  114. var d = getOwnPropertyDescriptor(o, "w");
  115. a(d.value, w, "Value");
  116. a(d.get, undefined, "Get");
  117. a(d.set, undefined, "Set");
  118. a(d.configurable, false, "Configurable");
  119. a(d.enumerable, false, "Enumerable");
  120. a(d.writable, true, "Writable");
  121. },
  122. d: function (a) {
  123. var d = getOwnPropertyDescriptor(o, "df");
  124. a(d.value, df, "Value");
  125. a(d.get, undefined, "Get");
  126. a(d.set, undefined, "Set");
  127. a(d.configurable, true, "Configurable");
  128. a(d.enumerable, false, "Enumerable");
  129. a(d.writable, true, "Writable");
  130. d = getOwnPropertyDescriptor(o, "dfgs");
  131. a(d.value, undefined, "GS Value");
  132. a(d.get, dfg, "GS Get");
  133. a(d.set, dfs, "GS Set");
  134. a(d.configurable, true, "GS Configurable");
  135. a(d.enumerable, false, "GS Enumerable");
  136. a(d.writable, undefined, "GS Writable");
  137. },
  138. Options: {
  139. v: function (a) {
  140. var x = {}, d = t(x, { foo: true });
  141. a.deep(
  142. d,
  143. { configurable: true, enumerable: false, writable: true, value: x, foo: true },
  144. "No descriptor"
  145. );
  146. d = t("c", "foo", { marko: "elo" });
  147. a.deep(
  148. d,
  149. {
  150. configurable: true,
  151. enumerable: false,
  152. writable: false,
  153. value: "foo",
  154. marko: "elo"
  155. },
  156. "Descriptor"
  157. );
  158. },
  159. gs: function (a) {
  160. var gFn = function () {}, sFn = function () {}, d;
  161. d = t.gs(gFn, sFn, { foo: true });
  162. a.deep(
  163. d, { configurable: true, enumerable: false, get: gFn, set: sFn, foo: true },
  164. "No descriptor"
  165. );
  166. d = t.gs(null, sFn, { foo: true });
  167. a.deep(
  168. d,
  169. { configurable: true, enumerable: false, get: undefined, set: sFn, foo: true },
  170. "No descriptor: Just set"
  171. );
  172. d = t.gs(gFn, { foo: true });
  173. a.deep(
  174. d,
  175. { configurable: true, enumerable: false, get: gFn, set: undefined, foo: true },
  176. "No descriptor: Just get"
  177. );
  178. d = t.gs("e", gFn, sFn, { bar: true });
  179. a.deep(
  180. d, { configurable: false, enumerable: true, get: gFn, set: sFn, bar: true },
  181. "Descriptor"
  182. );
  183. d = t.gs("e", null, sFn, { bar: true });
  184. a.deep(
  185. d,
  186. { configurable: false, enumerable: true, get: undefined, set: sFn, bar: true },
  187. "Descriptor: Just set"
  188. );
  189. d = t.gs("e", gFn, { bar: true });
  190. a.deep(
  191. d,
  192. { configurable: false, enumerable: true, get: gFn, set: undefined, bar: true },
  193. "Descriptor: Just get"
  194. );
  195. }
  196. }
  197. };
  198. };