source: trip-planner-front/node_modules/esutils/README.md@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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