Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. ### esutils [![Build Status](https://secure.travis-ci.org/estools/esutils.svg)](http://travis-ci.org/estools/esutils)
  2. esutils ([esutils](http://github.com/estools/esutils)) is
  3. utility box for ECMAScript language tools.
  4. ### API
  5. ### ast
  6. #### ast.isExpression(node)
  7. Returns true if `node` is an Expression as defined in ECMA262 edition 5.1 section
  8. [11](https://es5.github.io/#x11).
  9. #### ast.isStatement(node)
  10. Returns true if `node` is a Statement as defined in ECMA262 edition 5.1 section
  11. [12](https://es5.github.io/#x12).
  12. #### ast.isIterationStatement(node)
  13. Returns true if `node` is an IterationStatement as defined in ECMA262 edition
  14. 5.1 section [12.6](https://es5.github.io/#x12.6).
  15. #### ast.isSourceElement(node)
  16. Returns true if `node` is a SourceElement as defined in ECMA262 edition 5.1
  17. section [14](https://es5.github.io/#x14).
  18. #### ast.trailingStatement(node)
  19. Returns `Statement?` if `node` has trailing `Statement`.
  20. ```js
  21. if (cond)
  22. consequent;
  23. ```
  24. When taking this `IfStatement`, returns `consequent;` statement.
  25. #### ast.isProblematicIfStatement(node)
  26. Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code.
  27. ```js
  28. {
  29. type: 'IfStatement',
  30. consequent: {
  31. type: 'WithStatement',
  32. body: {
  33. type: 'IfStatement',
  34. consequent: {type: 'EmptyStatement'}
  35. }
  36. },
  37. alternate: {type: 'EmptyStatement'}
  38. }
  39. ```
  40. The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`.
  41. ### code
  42. #### code.isDecimalDigit(code)
  43. Return true if provided code is decimal digit.
  44. #### code.isHexDigit(code)
  45. Return true if provided code is hexadecimal digit.
  46. #### code.isOctalDigit(code)
  47. Return true if provided code is octal digit.
  48. #### code.isWhiteSpace(code)
  49. Return true if provided code is white space. White space characters are formally defined in ECMA262.
  50. #### code.isLineTerminator(code)
  51. Return true if provided code is line terminator. Line terminator characters are formally defined in ECMA262.
  52. #### code.isIdentifierStart(code)
  53. Return true if provided code can be the first character of ECMA262 Identifier. They are formally defined in ECMA262.
  54. #### code.isIdentifierPart(code)
  55. Return true if provided code can be the trailing character of ECMA262 Identifier. They are formally defined in ECMA262.
  56. ### keyword
  57. #### keyword.isKeywordES5(id, strict)
  58. Returns `true` if provided identifier string is a Keyword or Future Reserved Word
  59. in ECMA262 edition 5.1. They are formally defined in ECMA262 sections
  60. [7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2),
  61. respectively. If the `strict` flag is truthy, this function additionally checks whether
  62. `id` is a Keyword or Future Reserved Word under strict mode.
  63. #### keyword.isKeywordES6(id, strict)
  64. Returns `true` if provided identifier string is a Keyword or Future Reserved Word
  65. in ECMA262 edition 6. They are formally defined in ECMA262 sections
  66. [11.6.2.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keywords) and
  67. [11.6.2.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-future-reserved-words),
  68. respectively. If the `strict` flag is truthy, this function additionally checks whether
  69. `id` is a Keyword or Future Reserved Word under strict mode.
  70. #### keyword.isReservedWordES5(id, strict)
  71. Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 5.1.
  72. They are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1).
  73. If the `strict` flag is truthy, this function additionally checks whether `id`
  74. is a Reserved Word under strict mode.
  75. #### keyword.isReservedWordES6(id, strict)
  76. Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 6.
  77. They are formally defined in ECMA262 section [11.6.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words).
  78. If the `strict` flag is truthy, this function additionally checks whether `id`
  79. is a Reserved Word under strict mode.
  80. #### keyword.isRestrictedWord(id)
  81. Returns `true` if provided identifier string is one of `eval` or `arguments`.
  82. They are restricted in strict mode code throughout ECMA262 edition 5.1 and
  83. in ECMA262 edition 6 section [12.1.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors).
  84. #### keyword.isIdentifierName(id)
  85. Return true if provided identifier string is an IdentifierName as specified in
  86. ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6).
  87. #### keyword.isIdentifierES5(id, strict)
  88. Return true if provided identifier string is an Identifier as specified in
  89. ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). If the `strict`
  90. flag is truthy, this function additionally checks whether `id` is an Identifier
  91. under strict mode.
  92. #### keyword.isIdentifierES6(id, strict)
  93. Return true if provided identifier string is an Identifier as specified in
  94. ECMA262 edition 6 section [12.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers).
  95. If the `strict` flag is truthy, this function additionally checks whether `id`
  96. is an Identifier under strict mode.
  97. ### License
  98. Copyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation)
  99. (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
  100. Redistribution and use in source and binary forms, with or without
  101. modification, are permitted provided that the following conditions are met:
  102. * Redistributions of source code must retain the above copyright
  103. notice, this list of conditions and the following disclaimer.
  104. * Redistributions in binary form must reproduce the above copyright
  105. notice, this list of conditions and the following disclaimer in the
  106. documentation and/or other materials provided with the distribution.
  107. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  108. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  109. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  110. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  111. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  112. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  113. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  114. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  115. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  116. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.