js-yaml-js-types
Version:
js-yaml extra types
39 lines (27 loc) • 772 B
Markdown
js-yaml-js-types
================
[](https://github.com/nodeca/js-yaml-js-types/actions)
[](https://www.npmjs.org/package/js-yaml-js-types)
> js-yaml extra types:
>
> - !!js/regexp /pattern/gim
> - !!js/undefined ''
> - !!js/function 'function () {...}'
Installation
------------
```sh
npm install js-yaml-js-types
```
Usage
-----
```js
const yaml = require('js-yaml');
const unsafe = require('js-yaml-js-types').all;
const schema = yaml.DEFAULT_SCHEMA.extend(unsafe);
const src = `
- !!js/regexp /pattern/gim
- !!js/undefined ''
- !!js/function 'function () { return true }'
`
yaml.load(src, { schema });
```