gray-matter
Advanced tools
Comparing version 0.2.6 to 0.2.8
{ | ||
"name": "gray-matter", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "index.js" |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ # {%= shortname %} [![NPM version](https://badge.fury.io/js/{%= name %}.png)](http://badge.fury.io/js/{%= name %}) |
@@ -0,0 +0,0 @@ |
@@ -21,7 +21,11 @@ /** | ||
function matter(str, options) { | ||
var opts = _.extend({delims: ['---','---'], lang: 'yaml'}, options); | ||
var opts = _.defaults({}, options, { | ||
delims: ['---', '---'], | ||
delimsOpts: {}, | ||
lang: 'yaml', | ||
}); | ||
var metadata = {}; | ||
var content = str; | ||
var delimiters = delims(opts.delims).evaluate; | ||
var delimiters = delims(opts.delims, opts.delimsOpts).evaluate; | ||
@@ -28,0 +32,0 @@ // If true, will attempt to detect and register |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
{ | ||
"name": "gray-matter", | ||
"description": "A simple to use YAML, JSON or Coffee Front-Matter parsing and extraction library, with options to set custom delimiters.", | ||
"version": "0.2.6", | ||
"version": "0.2.8", | ||
"author": { | ||
@@ -11,3 +11,3 @@ "name": "Jon Schlinkert", | ||
"type": "git", | ||
"url": "https://github.com/assemble/matter.git" | ||
"url": "https://github.com/assemble/gray-matter.git" | ||
}, | ||
@@ -17,3 +17,3 @@ "licenses": [ | ||
"type": "MIT", | ||
"url": "https://github.com/assemble/matter/blob/master/LICENSE-MIT" | ||
"url": "https://github.com/assemble/gray-matter/blob/master/LICENSE-MIT" | ||
} | ||
@@ -20,0 +20,0 @@ ], |
@@ -0,0 +0,0 @@ # gray-matter [![NPM version](https://badge.fury.io/js/gray-matter.png)](http://badge.fury.io/js/gray-matter) |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ ;;; json |
@@ -0,0 +0,0 @@ --- |
@@ -0,0 +0,0 @@ ---yaml |
@@ -0,0 +0,0 @@ --- coffee |
@@ -0,0 +0,0 @@ ---coffee |
@@ -0,0 +0,0 @@ --- |
@@ -0,0 +0,0 @@ ;;; |
@@ -88,3 +88,3 @@ /** | ||
var fixture = file.readFileSync('./test/fixtures/alpha.hbs'); | ||
var actual = matter.stringifyJSON(fixture); | ||
var actual = matter.stringify(fixture); | ||
expect(actual).to.deep.equal({foo: 'bar', version: 2}); | ||
@@ -129,2 +129,19 @@ done(); | ||
describe('Use custom delimiters:', function () { | ||
xit('should use custom delimiters.', function (done) { | ||
var actual = matter.read('./test/fixtures/code-comments.js', { | ||
// /\/\*\*([\S\s]+)\*\// | ||
delims: ['\/\*\*', '\*\/'], | ||
delimsOpts: { | ||
body: '\\s+\\*\\s*([\\s\\S]+?)', | ||
escape: true | ||
} | ||
}); | ||
expect(actual).to.deep.equal(customDelims); | ||
done(); | ||
}); | ||
}); | ||
describe('Parse JSON:', function () { | ||
@@ -131,0 +148,0 @@ var expected = { |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
52690
577
1