<NME> API.md
<BEF> # 6.0.0 API Reference

- [camaro](#camaro)
  - [`transform(xml, template)`](#transformxml-template)
  - [`toJson(xml)`](#tojsonxml)
  - [`prettyPrint(xml)`](#prettyprintxml)

## camaro

### `transform(xml, template)`

Transform xml string to JSON using the given template powered by XPath where:
const { transform } = require('camaro')
const fs = require('fs')

const xml = fs.readFileSync('examples/ean.xml', 'utf-8')
const template = {
    cache_key: '/HotelListResponse/cacheKey',
    hotels: ['//HotelSummary', {
        hotel_id: 'hotelId',
        name: 'name',
        rooms: ['RoomRateDetailsList/RoomRateDetails', {
            rates: ['RateInfos/RateInfo', {
                currency: 'ChargeableRateInfo/@currencyCode',
                non_refundable: 'boolean(nonRefundable = "true")',
                price: 'number(ChargeableRateInfo/@total)'
            }],
            room_name: 'roomDescription',
            room_type_id: 'roomTypeCode'
        }]
    }],
    session_id: '/HotelListResponse/customerSessionId'
}

;(async function () {
    const result = await transform(xml, template)
    console.log(result)
})()
```

### `toJson(xml)`

**Not yet implemented**

### `toJson(xml)`

Transform xml string to JSON where:
- `xml` - the input xml string

const xml = fs.readFileSync('examples/ean.xml', 'utf-8')

;(async function () {
    const result = await toJson(xml)
    console.log(result)
})()
```

### `prettyPrint(xml)`

Pretty print xml string where:
- `xml` - the input xml string
- `options` - an optional object with the following optional keys:
    - `indentSize` - a number of space to use for indenting

```js
const { prettyPrint } = require('camaro')
const fs = require('fs')

const xml = fs.readFileSync('examples/ean.xml', 'utf-8')

;(async function () {
    const result = await prettyPrint(xml, { indentSize: 4 })
    console.log(result)
})()
```

<MSG> docs: update api

<DFF> @@ -7,6 +7,10 @@
 
 ## camaro
 
+### `ready()`
+
+Initialize module. Needed to be called once before calling other methods.
+
 ### `transform(xml, template)`
 
 Transform xml string to JSON using the given template powered by XPath where:
@@ -44,6 +48,8 @@ const template = {
 
 ### `toJson(xml)`
 
+**Not yet implemented**
+
 Transform xml string to JSON where:
 - `xml` - the input xml string
 

{'addition_count': 6, 'commit_subject': 'docs: update api', 'deletion_count': 0, 'file_extension': '.md', 'lang': 'md', 'license': 'mit', 'repo_name': 'tuananh/camaro'}