Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a>
  2. `yaml` is a JavaScript parser and stringifier for [YAML](http://yaml.org/), a human friendly data serialization standard. It supports both parsing and stringifying data using all versions of YAML, along with all common data schemas. As a particularly distinguishing feature, `yaml` fully supports reading and writing comments and blank lines in YAML documents.
  3. The library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/). It has no external dependencies and runs on Node.js 6 and later, and in browsers from IE 11 upwards.
  4. For the purposes of versioning, any changes that break any of the endpoints or APIs documented here will be considered semver-major breaking changes. Undocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed).
  5. For more information, see the project's documentation site: [**eemeli.org/yaml/v1**](https://eemeli.org/yaml/v1/)
  6. To install:
  7. ```sh
  8. npm install yaml
  9. ```
  10. **Note:** This is `yaml@1`. You may also be interested in the next version, currently available as [`yaml@next`](https://www.npmjs.com/package/yaml/v/next).
  11. ## API Overview
  12. The API provided by `yaml` has three layers, depending on how deep you need to go: [Parse & Stringify](https://eemeli.org/yaml/v1/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the [CST Parser](https://eemeli.org/yaml/#cst-parser). The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent [AST](https://eemeli.org/yaml/#content-nodes), and the third is the closest to YAML source, making it fast, raw, and crude.
  13. ```js
  14. import YAML from 'yaml'
  15. // or
  16. const YAML = require('yaml')
  17. ```
  18. ### Parse & Stringify
  19. - [`YAML.parse(str, options): value`](https://eemeli.org/yaml/v1/#yaml-parse)
  20. - [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/v1/#yaml-stringify)
  21. ### YAML Documents
  22. - [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/v1/#creating-nodes)
  23. - [`YAML.defaultOptions`](https://eemeli.org/yaml/v1/#options)
  24. - [`YAML.Document`](https://eemeli.org/yaml/v1/#yaml-documents)
  25. - [`constructor(options)`](https://eemeli.org/yaml/v1/#creating-documents)
  26. - [`defaults`](https://eemeli.org/yaml/v1/#options)
  27. - [`#anchors`](https://eemeli.org/yaml/v1/#working-with-anchors)
  28. - [`#contents`](https://eemeli.org/yaml/v1/#content-nodes)
  29. - [`#errors`](https://eemeli.org/yaml/v1/#errors)
  30. - [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/v1/#parsing-documents)
  31. - [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/v1/#parsing-documents)
  32. ```js
  33. import { Pair, YAMLMap, YAMLSeq } from 'yaml/types'
  34. ```
  35. - [`new Pair(key, value)`](https://eemeli.org/yaml/v1/#creating-nodes)
  36. - [`new YAMLMap()`](https://eemeli.org/yaml/v1/#creating-nodes)
  37. - [`new YAMLSeq()`](https://eemeli.org/yaml/v1/#creating-nodes)
  38. ### CST Parser
  39. ```js
  40. import parseCST from 'yaml/parse-cst'
  41. ```
  42. - [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst)
  43. - [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst)
  44. ## YAML.parse
  45. ```yaml
  46. # file.yml
  47. YAML:
  48. - A human-readable data serialization language
  49. - https://en.wikipedia.org/wiki/YAML
  50. yaml:
  51. - A complete JavaScript implementation
  52. - https://www.npmjs.com/package/yaml
  53. ```
  54. ```js
  55. import fs from 'fs'
  56. import YAML from 'yaml'
  57. YAML.parse('3.14159')
  58. // 3.14159
  59. YAML.parse('[ true, false, maybe, null ]\n')
  60. // [ true, false, 'maybe', null ]
  61. const file = fs.readFileSync('./file.yml', 'utf8')
  62. YAML.parse(file)
  63. // { YAML:
  64. // [ 'A human-readable data serialization language',
  65. // 'https://en.wikipedia.org/wiki/YAML' ],
  66. // yaml:
  67. // [ 'A complete JavaScript implementation',
  68. // 'https://www.npmjs.com/package/yaml' ] }
  69. ```
  70. ## YAML.stringify
  71. ```js
  72. import YAML from 'yaml'
  73. YAML.stringify(3.14159)
  74. // '3.14159\n'
  75. YAML.stringify([true, false, 'maybe', null])
  76. // `- true
  77. // - false
  78. // - maybe
  79. // - null
  80. // `
  81. YAML.stringify({ number: 3, plain: 'string', block: 'two\nlines\n' })
  82. // `number: 3
  83. // plain: string
  84. // block: >
  85. // two
  86. //
  87. // lines
  88. // `
  89. ```
  90. ---
  91. Browser testing provided by:
  92. <a href="https://www.browserstack.com/open-source">
  93. <img width=200 src="https://eemeli.org/yaml/images/browserstack.svg" />
  94. </a>