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

sassdoc-extras

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sassdoc-extras - npm Package Compare versions

Comparing version 2.0.0-rc4 to 2.0.0

LICENSE.md

12

index.js
'use strict';
module.exports = {
byGroupAndType : require('./src/byGroupAndType'),
byType : require('./src/byType.js'),
flat : require('./src/flat'),
eachItem : require('./src/eachItem'),
markdown: require('./src/markdown'),
display: require('./src/display'),
groupName: require('./src/groupName'),
shortcutIcon: require('./src/shortcutIcon')
shortcutIcon: require('./src/shortcutIcon'),
};
{
"name": "sassdoc-extras",
"description": "SassDoc's Toolbelt",
"version": "2.0.0-rc4",
"version": "2.0.0",
"keywords": [
"sassdoc",
"index",
"themes",
"extras",
"tools"
],
"homepage": "http://sassdoc.com",
"repository": {

@@ -9,12 +20,16 @@ "type": "git",

},
"keywords": [
"sassdoc",
"index",
"themes"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/SassDoc/sassdoc-extra/issues"
},
"homepage": "http://sassdoc.com",
"license": "MIT",
"files": [
"src",
"index.js",
"LICENSE.md",
"README.md"
],
"dependencies": {

@@ -24,5 +39,7 @@ "marked": "^0.3.0",

},
"devDependencies": {
"mocha": "^1.21.4"
},
"scripts": {

@@ -29,0 +46,0 @@ "test": "mocha test/*.test.js"

@@ -1,4 +0,3 @@

sassdoc-extras
==============
# SassDoc Extras [![npm version](http://img.shields.io/npm/v/sassdoc-extras.svg?style=flat)](https://www.npmjs.org/package/sassdoc-extras) [![Build Status: Linux](http://img.shields.io/travis/SassDoc/sassdoc-extras.svg?style=flat)](https://travis-ci.org/SassDoc/sassdoc-extras?branch=master)
Extra tools for SassDoc theme builders
Extra tools for SassDoc theme authors. See [documentation](http://sassdoc.com/extra-tools/).
'use strict';
var eachItem = require('./eachItem');
module.exports = function (data){
module.exports = function byGroupAndType(data) {
var byGroupAndType = {};
eachItem(data, function (item, type){
data.forEach(function (item) {
var group = item.group[0];
var type = item.context.type;
if (byGroupAndType[group] === undefined) {
if (!(group in byGroupAndType)) {
byGroupAndType[group] = {};
}
if (!Array.isArray(byGroupAndType[group][type])){
if (!(type in byGroupAndType[group])) {
byGroupAndType[group][type] = [];

@@ -17,0 +16,0 @@ }

'use strict';
var eachItem = require('./eachItem');
module.exports = function (data) {
module.exports = function byType(data) {
var byType = {};
eachItem(data, function (item, type) {
data.forEach(function (item) {
var type = item.context.type;
if (!(type in byType)) {

@@ -10,0 +10,0 @@ byType[type] = [];

'use strict';
var eachItem = require('./eachItem');
/**
* Compute a `display` property regarding of access display
* Compute a `display` property in regards of `display.access`
* configuration.
*/
module.exports = function (ctx) {
var shouldBeDisplayed = function (item) {
var displayItemAccess = ctx.view.display.access.indexOf(item.access) !== -1;
module.exports = function display(ctx) {
ctx.data = ctx.data.filter(function (item) {
var displayItemAccess = ctx.display.access ? (ctx.display.access.indexOf(item.access) !== -1) : false;
var isAlias = item.alias;
var displayAlias = ctx.view.display.alias;
var displayAlias = ctx.display.alias;
return displayItemAccess && !(isAlias && !displayAlias);
};
ctx.data.count = 0;
eachItem(ctx.data, function (item) {
item.display = shouldBeDisplayed(item);
if (item.display) {
ctx.data.count++;
}
});
};
'use strict';
var eachItem = require('./eachItem');
/**

@@ -11,13 +9,11 @@ * Compute a `groupName` object from `group` array with slug as key and

*/
module.exports = function (ctx) {
ctx.groups = {};
module.exports = function groupName(ctx) {
ctx.groups = ctx.groups || {};
var groups = ctx.view.groups || {};
// Lowercase the slugs
Object.keys(groups).forEach(function (slug) {
ctx.groups[slug.toLowerCase()] = groups[slug];
// Lowercase the slugs.
Object.keys(ctx.groups).forEach(function (slug) {
ctx.groups[slug.toLowerCase()] = ctx.groups[slug];
});
eachItem(ctx.data, function (item) {
ctx.data.forEach(function (item) {
var group = {};

@@ -24,0 +20,0 @@

@@ -5,8 +5,4 @@ 'use strict';

module.exports = function (ctx) {
module.exports = function markdown(ctx) {
if (ctx.package && ctx.package.description) {
ctx.package.description = marked(ctx.package.description);
}
/**

@@ -34,59 +30,63 @@ * Wrapper for `marked` that takes only one argument to avoid

for (var type in ctx.data) {
for (var name in ctx.data[type]) {
var item = ctx.data[type][name];
if (ctx.package && ctx.package.description) {
ctx.package.description = md(ctx.package.description);
}
if ('description' in item) {
item.description = marked(item.description);
}
ctx.data.forEach(function (item) {
if ('description' in item) {
item.description = marked(item.description);
}
if ('content' in item && item.content.description) {
item.content.description = marked(item.content.description);
}
if ('output' in item) {
item.output = marked(item.output);
}
if ('return' in item && item.return.description) {
item.return.description = marked(item.return.description);
}
if ('content' in item && item.content.description) {
item.content.description = marked(item.content.description);
}
if ('author' in item) {
item.author = item.author.map(md);
}
if ('return' in item && item.return.description) {
item.return.description = marked(item.return.description);
}
if ('throw' in item) {
item.throw = item.throw.map(md);
}
if ('deprecated' in item) {
item.deprecated = marked(item.deprecated);
}
if ('todo' in item) {
item.todo = item.todo.map(md);
}
if ('author' in item) {
item.author = item.author.map(md);
}
if ('deprecated' in item) {
item.deprecated = item.deprecated.map(md);
}
if ('throw' in item) {
item.throw = item.throw.map(md);
}
if ('example' in item) {
item.example = item.example.map(
applyKey(md, 'description')
);
}
if ('todo' in item) {
item.todo = item.todo.map(md);
}
if ('parameter' in item) {
item.parameter = item.parameter.map(
applyKey(md, 'description')
);
}
if ('example' in item) {
item.example = item.example.map(
applyKey(md, 'description')
);
}
if ('property' in item) {
item.property = item.property.map(
applyKey(md, 'description')
);
}
if ('parameter' in item) {
item.parameter = item.parameter.map(
applyKey(md, 'description')
);
}
if ('since' in item) {
item.since = item.content.map(
applyKey(md, 'description')
);
}
if ('property' in item) {
item.property = item.property.map(
applyKey(md, 'description')
);
}
}
if ('since' in item) {
item.since = item.since.map(
applyKey(md, 'description')
);
}
});
};

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

/**

@@ -11,3 +10,3 @@ * Figure out a shortcut icon, and whether it is external or a local

*
* You can specify a local or external URL in `ctx.view.shortcutIcon`.
* You can specify a local or external URL in `ctx.shortcutIcon`.
*

@@ -25,4 +24,4 @@ * For a local file, it will be relative to `ctx.dir`.

*/
module.exports = function (ctx) {
var icon = ctx.view.shortcutIcon;
module.exports = function shortcutIcon(ctx) {
var icon = ctx.shortcutIcon;

@@ -34,3 +33,3 @@ if (!icon) {

if (/^([a-z]+:)?\/\//.test(icon)) {
// External URL
// External URL.
ctx.shortcutIcon = {type: 'external', url: icon};

@@ -37,0 +36,0 @@ return;

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