yarn add markdown-metadata-parser
or
npm install markdown-metadata-parser --save
var parser = require('markdown-metadata-parser');
var md = `
---
title: The title
name: The name
order: 100
---
# This is a markdown title
`
var metadata = parser.parseMarkdownMetadata(mardown);