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

front-matter

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

front-matter - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

notes.md

2

examples/no-front-matter.md

@@ -7,3 +7,3 @@ # Hello World

Some text here that is definitely not fromt matter.
Some text here that is definitely not front matter.

@@ -10,0 +10,0 @@ ---

@@ -11,2 +11,4 @@ var parser = require('js-yaml')

+ '(?:\\n)?)'
// NOTE: If this pattern uses the 'g' flag the `regex` variable definition will
// need to be moved down into the functions that use it.
var regex = new RegExp(pattern, 'm')

@@ -30,2 +32,9 @@

var match = regex.exec(string)
if (! match) {
return {
body: string
}
}
var yaml = match[match.length - 1].replace(/^\s+|\s+$/g, '')

@@ -32,0 +41,0 @@ var attributes = parser.load(yaml) || {}

@@ -11,3 +11,3 @@ {

"license": "MIT",
"version": "2.0.2",
"version": "2.0.3",
"homepage": "https://github.com/jxson/front-matter",

@@ -27,5 +27,5 @@ "bugs": "https://github.com/jxson/front-matter/issues",

"devDependencies": {
"coveralls": "^2.11.2",
"coveralls": "^2.11.6",
"istanbul": "^0.3.6",
"tape": "^3.5.0"
"tape": "^4.4.0"
},

@@ -32,0 +32,0 @@ "contributors": [

@@ -144,2 +144,34 @@ var fm = require('../')

test('Supports live updating', function(t) {
var seperator = '---'
var string = ''
for (var i = 0; i < seperator.length; i++) {
string += seperator[i]
try {
fm(string)
} catch (e) {
t.error(e)
}
}
string += '\n'
string += 'foo: bar'
var content = fm(string)
t.same(content, {
body: string
})
string += '\n---\n'
content = fm(string)
t.same(content, {
attributes: { foo: 'bar' },
body: ''
})
t.end()
})
function read(file, callback){

@@ -146,0 +178,0 @@ var dir = path.resolve(__dirname, '../examples')

Sorry, the diff of this file is not supported yet

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