New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

tinyjam

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinyjam - npm Package Compare versions

Comparing version
0.3.0
to
0.4.0
+18
-5
index.js

@@ -5,3 +5,2 @@ import fs from 'fs';

import {compile} from 'yeahjs';
import fm from 'front-matter';
import marked from 'marked';

@@ -107,7 +106,4 @@ import yaml from 'js-yaml';

log(`read ${shortPath}`);
const {attributes, body} = fm(fs.readFileSync(path, 'utf8'));
const {body, attributes} = parseFrontMatter(fs.readFileSync(path, 'utf8'));
if (attributes.body !== undefined)
throw new Error('Can\'t use reserved keyword "body" as a front matter property.');
data[name] = createCtx(rootPath, {...attributes, body: marked(body, markedOptions)});

@@ -142,1 +138,18 @@

}
const fmOpen = '---';
const fmClose = '\n---';
function parseFrontMatter(str) {
if (str.indexOf(fmOpen) !== 0 || str[fmOpen.length] === fmOpen[0]) return {body: str};
let close = str.indexOf(fmClose, fmOpen.length);
if (close < 0) close = str.length;
const attributes = yaml.load(str.slice(0, close));
if (attributes.body !== undefined)
throw new Error('Can\'t use reserved keyword "body" as a front matter property.');
const body = str.slice(close + fmClose.length, str.length);
return {body, attributes};
}

@@ -10,17 +10,16 @@ {

},
"version": "0.3.0",
"version": "0.4.0",
"author": "Vladimir Agafonkin",
"license": "ISC",
"dependencies": {
"front-matter": "^4.0.2",
"js-yaml": "^4.0.0",
"marked": "^1.2.7",
"yeahjs": "^0.2.0"
"js-yaml": "^4.1.0",
"marked": "^2.1.3",
"yeahjs": "^0.3.0"
},
"devDependencies": {
"dir-compare": "^2.4.0",
"eslint": "^7.17.0",
"dir-compare": "^3.3.0",
"eslint": "^7.29.0",
"eslint-config-mourner": "^3.0.0",
"rimraf": "^3.0.2",
"tape": "^5.1.1"
"tape": "^5.2.2"
},

@@ -27,0 +26,0 @@ "scripts": {