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

cldoc

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cldoc - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

24

lib/doc.js

@@ -92,4 +92,10 @@ 'use strict';

function renderNavList(navTree, catName) {
let catNames = catName.split(':');
catName = catNames[0];
let toSize = 0;
if(catNames[1]) {
toSize = Number(catNames[1]) || 0;
}
let reg = new RegExp(catName);
let tree = getNavTree(navTree, reg, false);
let tree = getNavTree(navTree, reg, false, toSize);
let navTplPath = getTpl('nav.pug');

@@ -152,13 +158,3 @@ let navHtml = pug.renderFile(navTplPath, {

function defineFile(item, docDir) {
let { filepath, tabSize, basename, noFile } = item;
if(noFile) {
return {
title: basename,
tabSize: tabSize,
url: 'javascript:;',
basename: basename,
filepath: filepath,
keywords: []
};
}
let { filepath, tabSize, basename } = item;
let codeStr = fs.readFileSync(filepath, 'utf8');

@@ -210,3 +206,4 @@ let blocks = utils.getCodeBlocks(codeStr);

function getNavTree(navTree, filterReg, isBlack) {
function getNavTree(navTree, filterReg, isBlack, toSize) {
toSize = toSize || 0;
let tree = [];

@@ -228,2 +225,3 @@ let baseSize = 1000;

item.tabSize -= baseSize;
item.tabSize += toSize;
});

@@ -230,0 +228,0 @@ return tree;

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

let dirName = path.basename(treeDir);
let hasIndex = false;
for (let i = 0, l = files.length; i < l ; i++) {

@@ -30,3 +29,2 @@ let filename = files[i];

items.unshift(item);
hasIndex = true;
} else if(isMarkdown) {

@@ -37,10 +35,2 @@ items.push(item);

}
if(!hasIndex) {
items.unshift({
tabSize: tabSize - 1,
basename: dirName,
filepath: treeDir,
noFile: true,
});
}
return items;

@@ -47,0 +37,0 @@ });

{
"name": "cldoc",
"version": "0.3.0",
"version": "0.3.1",
"description": "Example",

@@ -5,0 +5,0 @@ "scripts": {

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