Package Exports
- parser-cache
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parser-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
parser-cache 
Cache and load parsers, similiar to consolidate.js engines.
Install
Install with npm
npm i parser-cache --saveUsage
var parsers = require('parser-cache');API
Parsers
options{Object}: Default options to use.
var Parsers = require('parser-cache');
var parsers = new Parsers();.register
Register the given parser callback fn as ext. If ext is not given, the parser fn will be pushed into the default parser stack.
ext{String}fn{Function|Object}: oroptionsreturns{Object}parsers: to enable chaining.
// Default stack
parsers.register(require('parser-front-matter'));
// Associated with `.hbs` file extension
parsers.register('hbs', require('parser-front-matter'));.parse
Run a stack of async parsers for the given file. If file is an object with an ext property, then ext is used to get the parser stack. If ext doesn't have a stack, the default noop parser will be used.
file{Object|String}: Either a string or an object.stack{Array}: Optionally pass an array of functions to use as parsers.options{Object}returns{Object}: Normalizefileobject.
var str = fs.readFileSync('some-file.md', 'utf8');
template.parse({ext: '.md', content: str}, function (err, file) {
console.log(file);
});Or, explicitly pass an array of parser functions as a section argument.
template.parse(file, [a, b, c], function (err, file) {
console.log(file);
});.parseSync
Run a stack of async parsers for the given file. If file is an object with an ext property, then ext is used to get the parser stack. If ext doesn't have a stack, the default noop parser will be used.
file{Object|String}: Either a string or an object.stack{Array}: Optionally pass an array of functions to use as parsers.options{Object}returns{Object}: Normalizefileobject.
var str = fs.readFileSync('some-file.md', 'utf8');
template.parseSync({ext: '.md', content: str});Or, explicitly pass an array of parser functions as a section argument.
template.parseSync(file, [a, b, c]);.get
Return the parser stored by ext. If no ext is passed, the entire parsers is returned.
ext{String}: The parser to get.returns{Object}: The specified parser.
parser.set('md', function() {});
parser.get('md')
// => [function].reset
Remove the parser stack for the given ext, or if no value is specified the entire parsers object is reset.
ext{String}: The stack to remove.
Example:
parsers.reset()Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on August 30, 2014.