{"id":19826869,"url":"https://github.com/estools/esutils","last_synced_at":"2025-12-12T03:30:57.863Z","repository":{"id":55840090,"uuid":"14677293","full_name":"estools/esutils","owner":"estools","description":"utility box for ECMAScript language tools","archived":false,"fork":false,"pushed_at":"2022-04-07T03:34:54.000Z","size":73,"stargazers_count":121,"open_issues_count":10,"forks_count":31,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-10T10:05:50.254Z","etag":null,"topics":["ast","ecmascript","estree","javascript"],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.BSD","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-25T05:43:39.000Z","updated_at":"2025-03-30T00:40:56.000Z","dependencies_parsed_at":"2022-08-15T07:40:50.172Z","dependency_job_id":null,"html_url":"https://github.com/estools/esutils","commit_stats":null,"previous_names":["constellation/esutils"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estools","download_url":"https://codeload.github.com/estools/esutils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","ecmascript","estree","javascript"],"created_at":"2024-11-12T11:11:52.645Z","updated_at":"2025-12-12T03:30:52.819Z","avatar_url":"https://github.com/estools.png","language":"CoffeeScript","readme":"# esutils [![Build Status](https://secure.travis-ci.org/estools/esutils.svg)](http://travis-ci.org/estools/esutils)\nesutils ([esutils](http://github.com/estools/esutils)) is\nutility box for ECMAScript language tools.\n\n## API\n\n## `ast` \n\n### `ast.isExpression(node)` \n\nReturns `true` if `node` is an `Expression` as defined in ECMA262 edition 5.1 section\n[11](https://es5.github.io/#x11).\n\n### `ast.isStatement(node)` \n\nReturns `true` if `node` is a `Statement` as defined in ECMA262 edition 5.1 section\n[12](https://es5.github.io/#x12).\n\n### `ast.isIterationStatement(node)` \n\nReturns `true` if `node` is an `IterationStatement` as defined in ECMA262 edition\n5.1 section [12.6](https://es5.github.io/#x12.6).\n\n### `ast.isSourceElement(node)` \n\nReturns `true` if `node` is a `SourceElement` as defined in ECMA262 edition 5.1\nsection [14](https://es5.github.io/#x14).\n\n### `ast.trailingStatement(node)` \n\nReturns `Statement?` if `node` has trailing `Statement`.\n```js\nif (cond)\n    consequent;\n```\nWhen taking this `IfStatement`, returns `consequent;` statement.\n\n### `ast.isProblematicIfStatement(node)` \n\nReturns `true` if `node` is a problematic `IfStatement`. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one-to-one JavaScript code.\n```js\n{\n    type: 'IfStatement',\n    consequent: {\n        type: 'WithStatement',\n        body: {\n            type: 'IfStatement',\n            consequent: {type: 'EmptyStatement'}\n        }\n    },\n    alternate: {type: 'EmptyStatement'}\n}\n```\nThe above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`.\n\n\n## `code` \n\n### `code.isDecimalDigit(code)` \n\nReturn `true` if provided code is decimal digit.\n\n### `code.isHexDigit(code)` \n\nReturn `true` if provided code is hexadecimal digit.\n\n### `code.isOctalDigit(code)` \n\nReturn `true` if provided code is octal digit.\n\n### `code.isWhiteSpace(code)` \n\nReturn `true` if provided code is white space. \nWhite space characters are formally defined in ECMA262.\n\n### `code.isLineTerminator(code)` \n\nReturn `true` if provided code is line terminator. \nLine terminator characters are formally defined in ECMA262.\n\n### `code.isIdentifierStart(code)` \n\nReturn `true` if provided code can be the first character of ECMA262 `Identifier`. \nThey are formally defined in ECMA262.\n\n### `code.isIdentifierPart(code)` \n\nReturn `true` if provided code can be the trailing character of ECMA262 `Identifier`. \nThey are formally defined in ECMA262.\n\n## `keyword` \n\n### `keyword.isKeywordES5(id, strict)` \n\nReturns `true` if provided identifier string is a Keyword or Future Reserved Word\nin ECMA262 edition 5.1. \nThey are formally defined in ECMA262 sections\n[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),\nrespectively. \nIf the `strict` flag is truthy, this function additionally checks whether\n`id` is a `Keyword` or `FutureReservedWord` under strict mode.\n\n### `keyword.isKeywordES6(id, strict)` \n\nReturns `true` if provided identifier string is a `Keyword` or `FutureReservedWord`\nin ECMA262 edition 6. \nThey are formally defined in ECMA262 sections\n[11.6.2.1](http://ecma-international.org/ecma-262/6.0/#sec-keywords) and\n[11.6.2.2](http://ecma-international.org/ecma-262/6.0/#sec-future-reserved-words),\nrespectively. \nIf the `strict` flag is truthy, this function additionally checks whether\n`id` is a `Keyword` or `FutureReservedWord` under strict mode.\n\n### `keyword.isReservedWordES5(id, strict)` \n\nReturns `true` if provided identifier string is a `ReservedWord` in ECMA262 edition 5.1.\nThey are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1).\nIf the `strict` flag is truthy, this function additionally checks whether `id`\nis a `ReservedWord` under strict mode.\n\n### `keyword.isReservedWordES6(id, strict)` \n\nReturns `true` if provided identifier string is a `ReservedWord` in ECMA262 edition 6.\nThey are formally defined in ECMA262 section [11.6.2](http://ecma-international.org/ecma-262/6.0/#sec-reserved-words).\nIf the `strict` flag is truthy, this function additionally checks whether `id`\nis a `ReservedWord` under strict mode.\n\n### `keyword.isRestrictedWord(id)` \n\nReturns `true` if provided identifier string is one of `eval` or `arguments`.\nThey are restricted in strict mode code throughout ECMA262 edition 5.1 and\nin ECMA262 edition 6 section [12.1.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers-static-semantics-early-errors).\n\n### `keyword.isIdentifierNameES5(id)` \n\nReturn `true` if provided identifier string is an `IdentifierName` as specified in\nECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6).\n\n### `keyword.isIdentifierNameES6(id)` \n\nReturn `true` if provided identifier string is an `IdentifierName` as specified in\nECMA262 edition 6 section [11.6](http://ecma-international.org/ecma-262/6.0/#sec-names-and-keywords).\n\n### `keyword.isIdentifierES5(id, strict)` \n\nReturn `true` if provided identifier string is an `Identifier` as specified in\nECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). \nIf the `strict` flag is truthy, this function additionally checks whether `id` \nis an `Identifier` under strict mode.\n\n### `keyword.isIdentifierES6(id, strict)` \n\nReturn `true` if provided identifier string is an `Identifier` as specified in\nECMA262 edition 6 section [12.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers).\nIf the `strict` flag is truthy, this function additionally checks whether `id`\nis an `Identifier` under strict mode.\n\n## License\n\nCopyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation)\n (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n  * Redistributions of source code must retain the above copyright\n    notice, this list of conditions and the following disclaimer.\n\n  * Redistributions in binary form must reproduce the above copyright\n    notice, this list of conditions and the following disclaimer in the\n    documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL \u003cCOPYRIGHT HOLDER\u003e BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festools%2Fesutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festools%2Fesutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festools%2Fesutils/lists"}