javascript.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. function standardMath() {
  2. return {
  3. throwsExceptions: false,
  4. canReturn: ['number', 'NaN', 'Infinity'],
  5. synchronous: true,
  6. type: 'function',
  7. };
  8. }
  9. function constant(val) {
  10. return {
  11. type: 'number',
  12. value: val,
  13. };
  14. }
  15. module.exports = {
  16. eval: {
  17. throwsExceptions: false,
  18. canReturn: ['number', 'NaN', 'Infinity'],
  19. synchronous: true,
  20. type: 'function',
  21. },
  22. uneval: {
  23. throwsExceptions: false,
  24. canReturn: ['number', 'NaN', 'Infinity'],
  25. synchronous: true,
  26. type: 'function',
  27. },
  28. isFinite: {
  29. throwsExceptions: false,
  30. canReturn: ['number', 'NaN', 'Infinity'],
  31. synchronous: true,
  32. type: 'function',
  33. },
  34. isNaN: {
  35. throwsExceptions: false,
  36. canReturn: ['number', 'NaN', 'Infinity'],
  37. synchronous: true,
  38. type: 'function',
  39. },
  40. parseFloat: {
  41. throwsExceptions: false,
  42. canReturn: ['number', 'NaN', 'Infinity'],
  43. synchronous: true,
  44. type: 'function',
  45. },
  46. parseInt: {
  47. throwsExceptions: false,
  48. canReturn: ['number', 'NaN', 'Infinity'],
  49. synchronous: true,
  50. type: 'function',
  51. },
  52. decodeURI: {
  53. throwsExceptions: false,
  54. canReturn: ['number', 'NaN', 'Infinity'],
  55. synchronous: true,
  56. type: 'function',
  57. },
  58. decodeURIComponent: {
  59. throwsExceptions: false,
  60. canReturn: ['number', 'NaN', 'Infinity'],
  61. synchronous: true,
  62. type: 'function',
  63. },
  64. encodeURI: {
  65. throwsExceptions: false,
  66. canReturn: ['number', 'NaN', 'Infinity'],
  67. synchronous: true,
  68. type: 'function',
  69. },
  70. encodeURIComponent: {
  71. throwsExceptions: false,
  72. canReturn: ['number', 'NaN', 'Infinity'],
  73. synchronous: true,
  74. type: 'function',
  75. },
  76. escape: {
  77. throwsExceptions: false,
  78. canReturn: ['number', 'NaN', 'Infinity'],
  79. synchronous: true,
  80. type: 'function',
  81. },
  82. unescape: {
  83. throwsExceptions: false,
  84. canReturn: ['number', 'NaN', 'Infinity'],
  85. synchronous: true,
  86. type: 'function',
  87. },
  88. 'Math.abs': standardMath(),
  89. 'Math.acos': standardMath(),
  90. 'Math.acosh': standardMath(),
  91. 'Math.asin': standardMath(),
  92. 'Math.asinh': standardMath(),
  93. 'Math.atan': standardMath(),
  94. 'Math.atan2': standardMath(),
  95. 'Math.atanh': standardMath(),
  96. 'Math.cbrt': standardMath(),
  97. 'Math.ceil': standardMath(),
  98. 'Math.clz32': standardMath(),
  99. 'Math.cos': standardMath(),
  100. 'Math.exp': standardMath(),
  101. 'Math.expm1': standardMath(),
  102. 'Math.floor': standardMath(),
  103. 'Math.fround': standardMath(),
  104. 'Math.hypot': standardMath(),
  105. 'Math.imul': standardMath(),
  106. 'Math.log': standardMath(),
  107. 'Math.log10': standardMath(),
  108. 'Math.log1p': standardMath(),
  109. 'Math.log2': standardMath(),
  110. 'Math.max': standardMath(),
  111. 'Math.min': standardMath(),
  112. 'Math.pow': standardMath(),
  113. 'Math.random': standardMath(),
  114. 'Math.round': standardMath(),
  115. 'Math.sign': standardMath(),
  116. 'Math.sin': standardMath(),
  117. 'Math.sinh': standardMath(),
  118. 'Math.sqrt': standardMath(),
  119. 'Math.tan': standardMath(),
  120. 'Math.tanh': standardMath(),
  121. 'Math.trunc': standardMath(),
  122. 'Math.E': constant(Math.E),
  123. 'Math.LN10': constant(Math.LN10),
  124. 'Math.LN2': constant(Math.LN2),
  125. 'Math.LOG10E': constant(Math.LOG10E),
  126. 'Math.LOG2E': constant(Math.LOG2E),
  127. 'Math.PI': constant(Math.PI),
  128. 'Math.SQRT1_2': constant(Math.SQRT1_2),
  129. 'Math.SQRT2': constant(Math.SQRT2),
  130. };