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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. [![NPM version][npm-image]][npm-url]
  2. [![build status][travis-image]][travis-url]
  3. [![Test coverage][coveralls-image]][coveralls-url]
  4. [![Downloads][downloads-image]][downloads-url]
  5. [![Join the chat at https://gitter.im/eslint/doctrine](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
  6. # Doctrine
  7. Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file).
  8. ## Installation
  9. You can install Doctrine using [npm](https://npmjs.com):
  10. ```
  11. $ npm install doctrine --save-dev
  12. ```
  13. Doctrine can also be used in web browsers using [Browserify](http://browserify.org).
  14. ## Usage
  15. Require doctrine inside of your JavaScript:
  16. ```js
  17. var doctrine = require("doctrine");
  18. ```
  19. ### parse()
  20. The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are:
  21. * `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`.
  22. * `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`.
  23. * `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`.
  24. * `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`.
  25. * `lineNumbers` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`.
  26. * `range` - set to `true` to add `range` to each node, specifying the start and end index of the node in the original comment. Default: `false`.
  27. Here's a simple example:
  28. ```js
  29. var ast = doctrine.parse(
  30. [
  31. "/**",
  32. " * This function comment is parsed by doctrine",
  33. " * @param {{ok:String}} userName",
  34. "*/"
  35. ].join('\n'), { unwrap: true });
  36. ```
  37. This example returns the following AST:
  38. {
  39. "description": "This function comment is parsed by doctrine",
  40. "tags": [
  41. {
  42. "title": "param",
  43. "description": null,
  44. "type": {
  45. "type": "RecordType",
  46. "fields": [
  47. {
  48. "type": "FieldType",
  49. "key": "ok",
  50. "value": {
  51. "type": "NameExpression",
  52. "name": "String"
  53. }
  54. }
  55. ]
  56. },
  57. "name": "userName"
  58. }
  59. ]
  60. }
  61. See the [demo page](http://eslint.org/doctrine/demo/) more detail.
  62. ## Team
  63. These folks keep the project moving and are resources for help:
  64. * Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
  65. * Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer
  66. ## Contributing
  67. Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues).
  68. ## Frequently Asked Questions
  69. ### Can I pass a whole JavaScript file to Doctrine?
  70. No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work.
  71. ### License
  72. #### doctrine
  73. Copyright JS Foundation and other contributors, https://js.foundation
  74. Licensed under the Apache License, Version 2.0 (the "License");
  75. you may not use this file except in compliance with the License.
  76. You may obtain a copy of the License at
  77. http://www.apache.org/licenses/LICENSE-2.0
  78. Unless required by applicable law or agreed to in writing, software
  79. distributed under the License is distributed on an "AS IS" BASIS,
  80. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  81. See the License for the specific language governing permissions and
  82. limitations under the License.
  83. #### esprima
  84. some of functions is derived from esprima
  85. Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about)
  86. (twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors.
  87. Redistribution and use in source and binary forms, with or without
  88. modification, are permitted provided that the following conditions are met:
  89. * Redistributions of source code must retain the above copyright
  90. notice, this list of conditions and the following disclaimer.
  91. * Redistributions in binary form must reproduce the above copyright
  92. notice, this list of conditions and the following disclaimer in the
  93. documentation and/or other materials provided with the distribution.
  94. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  95. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  96. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  97. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  98. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  99. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  100. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  101. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  102. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  103. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  104. #### closure-compiler
  105. some of extensions is derived from closure-compiler
  106. Apache License
  107. Version 2.0, January 2004
  108. http://www.apache.org/licenses/
  109. ### Where to ask for help?
  110. Join our [Chatroom](https://gitter.im/eslint/doctrine)
  111. [npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square
  112. [npm-url]: https://www.npmjs.com/package/doctrine
  113. [travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square
  114. [travis-url]: https://travis-ci.org/eslint/doctrine
  115. [coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square
  116. [coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master
  117. [downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square
  118. [downloads-url]: https://www.npmjs.com/package/doctrine