# raml2obj

> RAML to object

Latest version **6.8.1** (published 2021-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install raml2obj
pnpm add raml2obj
yarn add raml2obj
bun add raml2obj
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.8.1 |
| Published | 2021-06-28 |
| First published | 2014-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Unpacked size | 23.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Kevin Renskers |
| Maintainers | trevorr, mixedcase, nickwb |
| Keywords | RAML |

## Links

- npm: https://www.npmjs.com/package/raml2obj
- Repository: https://github.com/raml2html/raml2obj
- Issues: https://github.com/raml2html/raml2obj/issues
- npm.io page: https://npm.io/package/raml2obj

## Dependencies (2)

- [raml-1-parser](https://npm.io/package/raml-1-parser.md) ^1.1.67
- [datatype-expansion](https://npm.io/package/datatype-expansion.md) ^0.4.1

## Recent versions

- 6.8.1 (latest) — 2021-06-28
- 4.0.0-beta16 (beta) — 2016-11-30
- 6.8.0 — 2021-02-18
- 6.7.0 — 2020-07-16
- 6.6.0 — 2019-10-30
- 6.5.0 — 2019-06-13
- 6.4.0 — 2019-05-29
- 6.3.0 — 2019-05-29
- 6.2.0 — 2019-04-02
- 6.1.0 — 2018-09-07
- 6.0.0 — 2018-02-19
- 5.9.0 — 2018-01-09
- 5.8.0 — 2017-12-06
- 5.7.0 — 2017-11-06
- 5.6.0 — 2017-09-27
- … 42 more at https://npm.io/package/raml2obj/versions

## README

# RAML to object

[![NPM version](http://img.shields.io/npm/v/raml2obj.svg)](https://www.npmjs.org/package/raml2obj)
[![Prettier](https://img.shields.io/badge/code%20style-prettier-blue.svg?style=flat)](https://github.com/prettier/prettier)

A thin wrapper around [raml-js-parser-2](https://github.com/raml-org/raml-js-parser-2), adding extra properties to the resulting
object for use in [raml2html](https://www.npmjs.org/package/raml2html) and [raml2md](https://www.npmjs.org/package/raml2md).

Versions 4.0.0 and up only support RAML 1.x files. If you still have RAML 0.8 source files, please stick with raml2obj 3.

## Install
```
npm i raml2obj --save
```

## Usage
```js
var raml2obj = require('raml2obj');

// source can either be a filename, url, or parsed RAML object.
// Returns a promise.
raml2obj.parse(source).then(function(ramlObj) {
  // Do something with the resulting ramlObj :)
});
```

## Options
The `parse()` function can be called with options to customize the result. 
Defaults are compatible with `raml2html`.

```js
raml2obj.parse(source, {
  validate: true, 
  extensionsAndOverlays : [], 
  collectionFormat: 'arrays',
}).then(function(ramlObj) {
  // Do something with the resulting ramlObj :)
});
```
 * `validate`: triggers the `rejectOnErrors` flag of the underlying parser. defaults to `false`
 * `extensionsAndOverlays`:  Defaults to `[]`. See parser documentation.
 * `collectionFormat`: choose what data structure the double-nested `[{name1: {..}}, {name2: {..}}]` patterns of the `raml-1-parser` are transformed to in the output object:
  
| `collectionFormat` value | output |
| --- | --- |
|`objects` (*default*)|`{name1: { orderHint: 0, ..}, name2: { orderHint: 1, ..}}`  (eases e.g. property access). *Applies to top-level collections only, nested are arrays except type properties.*|
|`arrays`|`[ {key: "name1", ..}, {key: "name2", ..}]`  (eases e.g. representation in a database). *Applies recursively everywhere.* |


## Questions & Support
Do you have a question? Have you found a bug or would you like to request a feature? Please check out [`CONTRIBUTING.md`](CONTRIBUTING.md).


## License
raml2obj is available under the MIT license. See the LICENSE file for more info.

---
_Source: https://npm.io/package/raml2obj · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
