Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gray-matter

Package Overview
Dependencies
Maintainers
2
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.5.1 to 0.5.2

1

.verbrc.md

@@ -31,3 +31,2 @@ ---

#### TOC
<!-- toc -->

@@ -34,0 +33,0 @@

13

index.js

@@ -49,5 +49,9 @@ /*!

function matter(str, options) {
if (typeof str !== 'string') {
throw new Error('gray-matter expects a string');
}
str = str.replace(/^\uFEFF/, '').replace(/\r/g, '');
var orig = str,
data = {};
var orig = str;
var data = {};

@@ -60,3 +64,2 @@ var defaults = {

var opts = extend({}, defaults, options);
var delimiters = createDelims(opts.delims, opts.delimsOpts);

@@ -115,5 +118,3 @@ var lang;

matter.read = function (filepath, options) {
var opts = extend({
enc: 'utf8'
}, options);
var opts = extend({enc: 'utf8'}, options);
var obj = matter(fs.readFileSync(filepath, opts.enc), opts);

@@ -120,0 +121,0 @@ return extend(obj, {

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

var YAML = require('js-yaml');
var log = require('verbalize');

@@ -24,4 +23,2 @@ var extend = require('mixin-deep');

* Expose `parser`
*
* @type {Object}
*/

@@ -33,2 +30,9 @@

/**
* Requires cache.
*/
var requires = {};
/**
* Parse YAML front matter

@@ -45,2 +49,3 @@ *

try {
var YAML = requires.yaml || (requires.yaml = require('js-yaml'));
data = YAML.safeLoad(str, options);

@@ -148,3 +153,3 @@ } catch (err) {

try {
var coffee = require('coffee-script');
var coffee = requires.coffee || (requires.coffee = require('coffee-script'));
return coffee['eval'](str, options);

@@ -181,3 +186,3 @@ } catch (e) {

try {
var toml = require('toml');
var toml = requires.toml || (requires.toml = require('toml'));
return toml.parse(str.trim());

@@ -184,0 +189,0 @@ } catch (e) {

{
"name": "gray-matter",
"description": "A simple to use and extend front matter library. Supports parsing and extracting YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters.",
"version": "0.5.1",
"version": "0.5.2",
"author": {

@@ -22,3 +22,26 @@ "name": "Jon Schlinkert",

],
"main": "index.js",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "node_modules/.bin/mocha"
},
"dependencies": {
"coffee-script": "^1.8.0",
"delims": "^0.4.0",
"js-yaml": "^3.2.2",
"lodash": "^2.4.1",
"mixin-deep": "^0.1.0",
"toml": "^2.0.6",
"verbalize": "^0.1.2"
},
"devDependencies": {
"mocha": "^1.19.0",
"should": "^4.0.4",
"verb": "^0.2.15",
"verb-tag-jscomments": "^0.2.2"
},
"keywords": [
"assemble",
"JSON",

@@ -35,4 +58,6 @@ "coffee",

"frontmatter",
"generate",
"generator",
"javascript",
"jekyll",
"js",

@@ -44,2 +69,3 @@ "markdown",

"parsing",
"template",
"site",

@@ -50,25 +76,3 @@ "static",

"yfm"
],
"main": "index.js",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "node_modules/.bin/mocha"
},
"dependencies": {
"coffee-script": "^1.8.0",
"delims": "^0.3.0",
"js-yaml": "^3.2.1",
"lodash": "^2.4.1",
"mixin-deep": "^0.1.0",
"toml": "^2.0.6",
"verbalize": "^0.1.2"
},
"devDependencies": {
"mocha": "^1.19.0",
"should": "^4.0.4",
"verb": "^0.2.15",
"verb-tag-jscomments": "^0.2.2"
}
]
}

@@ -31,3 +31,2 @@ # gray-matter [![NPM version](https://badge.fury.io/js/gray-matter.svg)](http://badge.fury.io/js/gray-matter)

<!-- toc -->

@@ -39,9 +38,9 @@

* [API](#api)
* [[matter](index.js#L47)](#matterindexjsl47)
* [[.read](index.js#L111)](#readindexjsl111)
* [[.exists](index.js#L134)](#existsindexjsl134)
* [[.extend](index.js#L154)](#extendindexjsl154)
* [[.reconstruct](index.js#L179)](#reconstructindexjsl179)
* [[.toJSON](index.js#L194)](#tojsonindexjsl194)
* [[.toYAML](index.js#L207)](#toyamlindexjsl207)
* [[matter](index.js#L48)](#matterindexjsl48)
* [[.read](index.js#L115)](#readindexjsl115)
* [[.exists](index.js#L136)](#existsindexjsl136)
* [[.extend](index.js#L156)](#extendindexjsl156)
* [[.reconstruct](index.js#L181)](#reconstructindexjsl181)
* [[.toJSON](index.js#L196)](#tojsonindexjsl196)
* [[.toYAML](index.js#L209)](#toyamlindexjsl209)
* [Options](#options)

@@ -82,3 +81,3 @@ * [options.eval](#optionseval)

## API
### [matter](index.js#L47)
### [matter](index.js#L48)

@@ -105,3 +104,3 @@ Expects a string and returns and object:

### [.read](index.js#L111)
### [.read](index.js#L115)

@@ -128,3 +127,3 @@ Read a file then pass the string and `options` to `matter()` for parsing:

### [.exists](index.js#L134)
### [.exists](index.js#L136)

@@ -141,3 +140,3 @@ Return `true` if front-matter exists.

### [.extend](index.js#L154)
### [.extend](index.js#L156)

@@ -154,3 +153,3 @@ Extend and stringify **YAML** front matter. Takes an object as the second parameter, and returns either the extended, stringified object (YAML), or if no front matter is found an empty string is returned.

### [.reconstruct](index.js#L179)
### [.reconstruct](index.js#L181)

@@ -170,3 +169,3 @@ A convenience wrapper around the `matter()` and `matter.extend()` methods.

### [.toJSON](index.js#L194)
### [.toJSON](index.js#L196)

@@ -179,3 +178,3 @@ * `str` **{String}**

### [.toYAML](index.js#L207)
### [.toYAML](index.js#L209)

@@ -358,3 +357,3 @@ * `str` **{String}**

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 24, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 24, 2014._

@@ -361,0 +360,0 @@

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