Socket
Socket
Sign inDemoInstall

gray-matter

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gray-matter - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

4

bower.json
{
"name": "matter",
"version": "0.2.3",
"name": "gray-matter",
"version": "0.2.4",
"main": [

@@ -5,0 +5,0 @@ "index.js"

@@ -10,2 +10,3 @@ /**

// node_modules
var YAML = require('js-yaml');
var delims = require('delims');

@@ -64,2 +65,13 @@ var file = require('fs-utils');

// Stringify to jSON
matter.stringifyJSON = function(src, options) {
return matter(src, options).context;
};
// Stringify to YAML
matter.stringifyYAML = function(src, options) {
var front = matter(src, options).context;
return YAML.dump(front);
};
module.exports = matter;
{
"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.3",
"version": "0.2.4",
"author": {

@@ -6,0 +6,0 @@ "name": "Jon Schlinkert",

@@ -85,2 +85,19 @@ /**

describe('Stringify YAML:', function () {
it('should stringify JSON.', function (done) {
var fixture = file.readFileSync('./test/fixtures/alpha.hbs');
var actual = matter.stringifyJSON(fixture);
expect(actual).to.deep.equal({foo: 'bar', version: 2});
done();
});
it('should stringify YAML.', function (done) {
var fixture = file.readFileSync('./test/fixtures/alpha.hbs');
var actual = matter.stringifyYAML(fixture);
expect(actual).to.deep.equal('foo: bar\nversion: 2\n');
done();
});
});
describe('Read from file system:', function () {

@@ -87,0 +104,0 @@ it('should extract YAML front matter from files with content.', function (done) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc