Skip to content

nodeca/js-yaml-js-types

Repository files navigation

js-yaml-js-types

CI NPM version

js-yaml extra types:

  • !!js/regexp /pattern/gim
  • !!js/undefined ''
  • !!js/function 'function () {...}'

Installation

npm install js-yaml-js-types

Usage

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 });