UNPKG

365 BJavaScriptView Raw
1'use strict'
2module.exports = createMDScope
3
4const runAsync = require('run-async')
5
6function createMDScope (plugins, markdown) {
7 return Promise.all(
8 plugins
9 .map(plugin => runAsync(plugin))
10 .map(plugin => plugin(markdown))
11 )
12 .then(scopes => scopes.reduce(
13 (scope, pluginScope) => Object.assign(scope, pluginScope), {})
14 )
15}