How to use the js-yaml/lib/js-yaml.safeLoad function in js-yaml

To help you get started, we’ve selected a few js-yaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pizn / eevee / src / containers / Post.jsx View on Github external
handleSaveMeta(data) {
    if (data === this.state.head) {
      console.log('[log]: 没有修改');
      return false;
    }
    this.setState({
      meta: yaml.safeLoad(data),
      head: data,
    });
    const cnt = data + '\n---\n' + this.state.body;
    this.handleSave(cnt);
  }
github pizn / eevee / src / containers / Post.jsx View on Github external
metaMarked(src) {
    const mySplitInput = this.splitInput(src);
    return mySplitInput ? {
      meta: yaml.safeLoad(mySplitInput[0]),
      head: mySplitInput[0],
      body: mySplitInput[1]
    } : {
      meta: null,
      head: null,
      body: src
    };
  }