yarnspinner2js
Version:
Converts a Yarn Spinner script string to a js object
33 lines (21 loc) • 774 B
Markdown
# Yarn Spinner to Javascript Converter
Converts a Yarn Spinner script string to a js object
### _Installation:_
```sh
npm i yarnspinner2js
```
### _Usage:_
```js
import { parseYarnSpinner } from "yarnspinner2js"
const result = parseYarnSpinner(yarnSpinnerString)
```
### _Settings:_
You can pass the parsing settings with the second parameter like this:
```js
const result = parseYarnSpinner(yarnSpinnerString, {
ignoreHeaderParameters: ["position"], // default: []
normalizeText: false, // default: true
})
```
`ignoreHeaderParameters` — all header parameters whose names are present in the array will be ignored
`normalizeText` — if true, all whitespace characters at the beginning and end of strings will be deleted, as well as duplicate spaces inside