Socket
Socket
Sign inDemoInstall

directory-tree-md

Package Overview
Dependencies
14
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.6 to 2.0.7

15

lib/directory-tree-md.js

@@ -5,2 +5,3 @@ 'use strict';

const PATH = require('path');
const YAML = require('yamljs');
const constants = {

@@ -24,14 +25,2 @@ DIRECTORY: 'directory',

function strToObj(str) {
const arr = str.split('\n').filter((item) => !!item);
const json = {};
for (let i = 0; i < arr.length; i += 1) {
const item = arr[i].split(":");
const key = item[0] ? String.prototype.trim.call(item[0]) : item[0]
const value = item[1] ? String.prototype.trim.call(item[1]) : item[1]
json[key] = value;
}
return json;
}
function directoryTree(path, options, onEachFile) {

@@ -62,3 +51,3 @@ const name = PATH.basename(path);

item.relative = item.path.replace(process.cwd(), '');
item.mdconf = contentMatch ? strToObj(contentMatch[1]) : {};
item.mdconf = contentMatch ? YAML.parse(contentMatch[1]) : {};
item.isEmpty = contentMatch ? !String.prototype.trim.call(contentStr.replace(contentMatch[0], '')) : true;

@@ -65,0 +54,0 @@ }

8

package.json
{
"name": "directory-tree-md",
"version": "2.0.6",
"version": "2.0.7",
"description": "Convert a directory tree to a JS object.",

@@ -20,3 +20,5 @@ "repository": {

"homepage": "https://github.com/react-doc/node-directory-tree-md",
"dependencies": {},
"dependencies": {
"yamljs": "^0.3.0"
},
"devDependencies": {

@@ -32,2 +34,2 @@ "chai": "^2.3.0",

}
}
}

@@ -26,3 +26,3 @@ # node-directory-tree-md

Markdown configuration set by comments.
Markdown configuration set by comments, support [yaml](http://www.yaml.org/).

@@ -34,2 +34,4 @@ ```markdown

des: A detailed description
header:
url: http://google.com
-->

@@ -54,3 +56,6 @@

"heder": "😆😆😆😆",
"des": "A detailed description"
"des": "A detailed description",
"header": {
"url": "http://google.com"
}
},

@@ -57,0 +62,0 @@ "isEmpty": true,

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