Socket
Socket
Sign inDemoInstall

yaml-front-matter

Package Overview
Dependencies
5
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.1.0

11

CHANGELOG.md

@@ -1,5 +0,14 @@

# Change Log
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [4.1.0](https://github.com/dworthen/js-yaml-front-matter/compare/v4.0.0...v4.1.0) (2019-12-24)
### Features
* Upgrade package dependencies ([39a68d2](https://github.com/dworthen/js-yaml-front-matter/commit/39a68d2c10de16b411cccb90865856c8cacbe265))
### [3.4.1](https://github.com/dworthen/js-yaml-front-matter/compare/v4.0.0-2...v3.4.1) (2018-02-27)
<a name="4.0.0"></a>

@@ -6,0 +15,0 @@ # [4.0.0](https://github.com/dworthen/js-yaml-front-matter/compare/v4.0.0-4...v4.0.0) (2018-03-08)

2

dist/yamlFront.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("js-yaml")):"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.yamlFront=t(require("js-yaml")):e.yamlFront=t(e.jsyaml)}(this,function(e){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(t,o){t.exports=e},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.loadFront=function(e,t){return u(e,t,!1)},t.safeLoadFront=function(e,t){return u(e,t,!0)};var r=o(0);function u(e,t,o){var u=t&&"string"==typeof t?t:t&&t.contentKeyName?t.contentKeyName:"__content",f=t&&"object"===(void 0===t?"undefined":n(t))?t:void 0,c=/^(-{3}(?:\n|\r)([\w\W]+?)(?:\n|\r)-{3})?([\w\W]*)*/.exec(e),i={},a=void 0;return(a=c[2])&&(i="{"===a.charAt(0)?JSON.parse(a):o?r.safeLoad(a,f):r.load(a,f)),i[u]=c[3]||"",i}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("js-yaml")):"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.yamlFront=t(require("js-yaml")):e.yamlFront=t(e.jsyaml)}(this,(function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.r(t),n.d(t,"loadFront",(function(){return f})),n.d(t,"safeLoadFront",(function(){return i}));var r=n(1);function u(e,t,n){var u,f=t&&"string"==typeof t?t:t&&t.contentKeyName?t.contentKeyName:"__content",i=t&&"object"===o(t)?t:void 0,c=/^(-{3}(?:\n|\r)([\w\W]+?)(?:\n|\r)-{3})?([\w\W]*)*/.exec(e),l={};return(u=c[2])&&(l="{"===u.charAt(0)?JSON.parse(u):n?r.safeLoad(u,i):r.load(u,i)),l[f]=c[3]||"",l}function f(e,t){return u(e,t,!1)}function i(e,t){return u(e,t,!0)}},function(t,n){t.exports=e}])}));

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("js-yaml")):"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.yamlFront=t(require("js-yaml")):e.yamlFront=t(e.jsyaml)}(this,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadFront=function(e,t){return o(e,t,!1)},t.safeLoadFront=function(e,t){return o(e,t,!0)};var r=n(0);function o(e,t,n){var o=t&&t.contentKeyName?t.contentKeyName:"__content",u=/^(-{3}(?:\n|\r)([\w\W]+?)(?:\n|\r)-{3})?([\w\W]*)*/.exec(e),c={},f=void 0;return(f=u[2])&&(c="{"===f.charAt(0)?JSON.parse(f):n?r.safeLoad(f,t):r.load(f,t)),c[o]=u[3]||"",c}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("js-yaml")):"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.yamlFront=t(require("js-yaml")):e.yamlFront=t(e.jsyaml)}(this,(function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.r(t),n.d(t,"loadFront",(function(){return f})),n.d(t,"safeLoadFront",(function(){return i}));var r=n(1);function u(e,t,n){var u,f=t&&"string"==typeof t?t:t&&t.contentKeyName?t.contentKeyName:"__content",i=t&&"object"===o(t)?t:void 0,c=/^(-{3}(?:\n|\r)([\w\W]+?)(?:\n|\r)-{3})?([\w\W]*)*/.exec(e),l={};return(u=c[2])&&(l="{"===u.charAt(0)?JSON.parse(u):n?r.safeLoad(u,i):r.load(u,i)),l[f]=c[3]||"",l}function f(e,t){return u(e,t,!1)}function i(e,t){return u(e,t,!0)}},function(t,n){t.exports=e}])}));

@@ -1,2 +0,2 @@

Copyright (c) 2012 - 2018 Derek Worthen
Copyright (c) 2012 - Present Derek Worthen

@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@@ -8,3 +8,3 @@ {

"module": "src/index.js",
"version": "4.0.0",
"version": "4.1.0",
"keywords": [

@@ -20,22 +20,15 @@ "yaml",

"dependencies": {
"commander": "1.0.0",
"commander": "^2.14.1",
"js-yaml": "^3.10.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.3",
"babel-preset-env": "^1.6.1",
"browser-sync": "^2.11.1",
"commander": "^2.14.1",
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.5.1",
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"babel-loader": "^8.0.6",
"http-server": "^0.11.1",
"mocha": "~1.3.0",
"should": "0.6.3",
"standard-version": "^4.3.0",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.9"
"mocha": "^6.2.2",
"should": "^13.2.3",
"standard-version": "^7.0.1",
"webpack": "^4.41.4",
"webpack-cli": "^3.3.10"
},

@@ -42,0 +35,0 @@ "bin": {

@@ -9,3 +9,3 @@ # Yaml Front Matter

This readme is for the 4.x branch which introduces breaking changes. View the [changelog](CHANGELOG.md) for more information.
This readme is for the 4.x release, which introduces breaking changes. View the [changelog](CHANGELOG.md) for more information.

@@ -216,1 +216,2 @@ [3.x readme](https://github.com/dworthen/js-yaml-front-matter/tree/v3.4.0)

```

@@ -1,147 +0,152 @@

var fs = require('fs');
var path = require('path');
var jsYaml = require('../dist/yamlFront')
var should = require('should');
var fs = require("fs");
var path = require("path");
var jsYaml = require("../dist/yamlFront");
var should = require("should");
describe('js-yaml-front', function () {
describe("js-yaml-front", function() {
var results = null;
var testStr = null;
var testStrWithExtraDashes = null;
var testJsonStr = null;
var testSafeYamlStr = null;
var results = null;
var testStr = null;
var testStrWithExtraDashes = null;
var testJsonStr = null;
var testSafeYamlStr = null;
var simpleYaml = fs.readFileSync(
path.resolve(__dirname, "./fixtures/yaml.txt"),
"utf8"
);
var yamlWithDashes = fs.readFileSync(
path.resolve(__dirname, "./fixtures/yamlWithExtraDashes.txt"),
"utf8"
);
var safeYaml = fs.readFileSync(
path.resolve(__dirname, "./fixtures/safeYaml.txt"),
"utf8"
);
var json = fs.readFileSync(
path.resolve(__dirname, "./fixtures/json.txt"),
"utf8"
);
var simpleYaml = fs.readFileSync(path.resolve(__dirname, './fixtures/yaml.txt'), 'utf8');
var yamlWithDashes = fs.readFileSync(path.resolve(__dirname, './fixtures/yamlWithExtraDashes.txt'), 'utf8');
var safeYaml = fs.readFileSync(path.resolve(__dirname, './fixtures/safeYaml.txt'), 'utf8');
// var testJsonStr = '---\n{"post": "title one",\n"anArray": ["one","two"],\n"subObject":\n';
// testJsonStr += '{"obj1": "cool", "obj2": "two"}}\n---\ncontent\nmore';
var json = fs.readFileSync(path.resolve(__dirname, './fixtures/json.txt'), 'utf8');
beforeEach(function() {
results = null;
testStr = simpleYaml;
testStrWithExtraDashes = yamlWithDashes;
testJsonStr = json;
testSafeYamlStr = safeYaml;
});
// var testJsonStr = '---\n{"post": "title one",\n"anArray": ["one","two"],\n"subObject":\n';
// testJsonStr += '{"obj1": "cool", "obj2": "two"}}\n---\ncontent\nmore';
function testSimpleYaml(key) {
key = key || "__content";
results.should.have.property("post", "title one");
results.should.have.property("anArray");
results.anArray.should.containEql("one");
results.anArray.should.containEql("two");
results.should.have.property("subObject");
results.subObject.should.have.property("obj1", "cool");
results.subObject.should.have.property("obj2", "two");
results.should.have.property("reg");
results.reg.should.be.an.instanceOf(RegExp);
results.should.have.property("fun");
results.fun.should.Function();
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
}
beforeEach(function () {
results = null;
testStr = simpleYaml;
testStrWithExtraDashes = yamlWithDashes;
testJsonStr = json;
testSafeYamlStr = safeYaml;
});
function testYamlWithDashes(key) {
key = key || "__content";
results.subObject.should.have.property("obj2", "two ---");
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
}
function testSimpleYaml(key) {
key = key || '__content';
results.should.have.property('post', 'title one');
results.should.have.property('anArray');
results.anArray.should.include('one');
results.anArray.should.include('two');
results.should.have.property('subObject');
results.subObject.should.have.property('obj1', 'cool');
results.subObject.should.have.property('obj2', 'two');
results.should.have.property('reg');
results.reg.should.be.an.instanceOf(RegExp);
results.should.have.property('fun');
results.fun.should.be.a('function');
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
};
function testSafeYaml(key) {
key = key || "__content";
results.should.not.have.property("reg");
results.should.not.have.property("fun");
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
}
function testYamlWithDashes(key) {
key = key || '__content';
results.subObject.should.have.property('obj2', 'two ---');
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
}
function testJson(key) {
key = key || "__content";
results.should.have.property("post", "title one");
results.should.have.property("anArray");
results.anArray.should.containEql("one");
results.anArray.should.containEql("two");
results.should.have.property("subObject");
results.subObject.should.have.property("obj1", "cool");
results.subObject.should.have.property("obj2", "two");
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
}
function testSafeYaml(key) {
key = key || '__content';
results.should.not.have.property('reg');
results.should.not.have.property('fun');
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
}
describe("loadFront", function() {
describe("loading yaml", function() {
it("should support loading yaml-front-matter", function() {
results = jsYaml.loadFront(testStr);
testSimpleYaml();
});
});
function testJson(key) {
key = key || '__content';
results.should.have.property('post', 'title one');
results.should.have.property('anArray');
results.anArray.should.include('one');
results.anArray.should.include('two');
results.should.have.property('subObject');
results.subObject.should.have.property('obj1', 'cool');
results.subObject.should.have.property('obj2', 'two');
results.should.have.property(key);
results[key].should.match(/content\r?\nmore/);
};
describe("loading yaml with arbitrary dashes", function() {
it("should support loading yaml-front-matter with dashes", function() {
results = jsYaml.loadFront(testStrWithExtraDashes);
testYamlWithDashes();
});
});
describe('loadFront', function () {
describe("loading json", function() {
it("should support loading json-front-matter", function() {
results = jsYaml.loadFront(testJsonStr);
testJson();
});
});
describe('loading yaml', function () {
it('should support loading yaml-front-matter', function () {
results = jsYaml.loadFront(testStr);
testSimpleYaml();
});
});
describe("loading without yaml", function() {
it("should support loading files without yaml-front-matter", function() {
results = jsYaml.loadFront("Hello World");
results.should.have.property("__content", "Hello World");
});
});
describe('loading yaml with arbitrary dashes', function () {
it('should support loading yaml-front-matter with dashes', function () {
results = jsYaml.loadFront(testStrWithExtraDashes);
testYamlWithDashes();
});
});
describe("loading empty string", function() {
it("should support loading no content", function() {
results = jsYaml.loadFront("");
results.should.have.property("__content", "");
});
});
describe('loading json', function () {
it('should support loading json-front-matter', function () {
results = jsYaml.loadFront(testJsonStr);
testJson();
});
});
describe("loading with options", function() {
it("should support changing content key name through options object", function() {
results = jsYaml.loadFront(testStr, { contentKeyName: "fileContents" });
testSimpleYaml("fileContents");
});
});
describe('loading without yaml', function () {
it('should support loading files without yaml-front-matter', function () {
results = jsYaml.loadFront('Hello World');
results.should.have.property('__content', 'Hello World');
});
});
describe("loading with specifying content key name", function() {
it("should support changing content key name with a string", function() {
results = jsYaml.loadFront(testStr, "fileContents");
testSimpleYaml("fileContents");
});
});
}); // End describe loadFront
describe('loading empty string', function () {
it('should support loading no content', function () {
results = jsYaml.loadFront('');
results.should.have.property('__content', '');
});
});
describe("safeLoadFront", function() {
describe("loading safe yaml", function() {
it("should support loading yaml-front-matter without RegExp or functions", function() {
results = jsYaml.safeLoadFront(testSafeYamlStr);
testSafeYaml();
});
});
describe('loading with options', function () {
it('should support changing content key name through options object', function () {
results = jsYaml.loadFront(testStr, { contentKeyName: 'fileContents' });
testSimpleYaml('fileContents');
});
});
describe('loading with specifying content key name', function () {
it('should support changing content key name with a string', function () {
results = jsYaml.loadFront(testStr, 'fileContents');
testSimpleYaml('fileContents');
});
});
}); // End describe loadFront
describe('safeLoadFront', function () {
describe('loading safe yaml', function () {
it('should support loading yaml-front-matter without RegExp or functions', function () {
results = jsYaml.safeLoadFront(testSafeYamlStr);
testSafeYaml();
});
});
describe('loading yaml', function () {
it('should not support loading yaml-front-matter that contain RegExp or functions', function () {
jsYaml.safeLoadFront.bind(this, testStr).should.throw();
});
});
}); // End describe safeLoadFront
});// End describe js-yaml-front
describe("loading yaml", function() {
it("should not support loading yaml-front-matter that contain RegExp or functions", function() {
jsYaml.safeLoadFront.bind(this, testStr).should.throw();
});
});
}); // End describe safeLoadFront
}); // End describe js-yaml-front

@@ -1,27 +0,32 @@

var path = require('path');
var path = require("path");
module.exports = function(env) {
const isBrowser = env && env.browser;
return {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, isBrowser ? 'docs/js' : 'dist'),
filename: 'yamlFront.js',
library: 'yamlFront',
libraryTarget: 'umd',
globalObject: 'this'
},
externals: {
'js-yaml': {
commonjs: 'js-yaml',
commonjs2: 'js-yaml',
root: 'jsyaml'
}
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', options: { presets: ['env'] }}
]
const isBrowser = env && env.browser;
return {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, isBrowser ? "docs/js" : "dist"),
filename: "yamlFront.js",
library: "yamlFront",
libraryTarget: "umd",
globalObject: "this"
},
externals: {
"js-yaml": {
commonjs: "js-yaml",
commonjs2: "js-yaml",
root: "jsyaml"
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
options: { presets: ["@babel/preset-env"] }
}
};
}
]
}
};
};

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc