Socket
Socket
Sign inDemoInstall

sections

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

29

index.js

@@ -17,4 +17,2 @@ /*!

*
* {%= doc('examples/parse.md') %}
*
* @param {String} `string`

@@ -94,29 +92,2 @@ * @param {Function} `fn`

exports.render = function renderSections(parsed, fn) {
if (typeof str !== 'string') {
throw new TypeError('expected a string');
}
if (typeof fn !== 'function') {
fn = filter;
}
var len = parsed.sections.length;
var idx = -1;
var res = '';
while (++idx < len) {
var section = parsed.sections[idx];
var prev = parsed.sections[idx - 1] || {};
var next = parsed.sections[idx + 1] || {};
var val = fn(section, prev, next);
if (typeof val === 'string') {
section.formatted = val;
res += val;
}
}
return res;
};
/**

@@ -123,0 +94,0 @@ * Filter out empty sections

13

package.json
{
"name": "sections",
"description": "Manipulate sections in a string of markdown.",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/jonschlinkert/sections",

@@ -33,3 +33,10 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {

@@ -42,6 +49,6 @@ "list": [

},
"plugins": [
"gulp-format-md"
"reflinks": [
"verb"
]
}
}

@@ -14,5 +14,2 @@ # sections [![NPM version](https://img.shields.io/npm/v/sections.svg)](https://www.npmjs.com/package/sections) [![Build Status](https://img.shields.io/travis/jonschlinkert/sections.svg)](https://travis-ci.org/jonschlinkert/sections)

## Usage
## Usage
## Usage
## Usage

@@ -27,3 +24,3 @@ This is meant to be fast and opinionated, and only works with [ATX headings](http://spec.commonmark.org/0.24/#atx-headings).

### [.parse](index.js#L25)
### [.parse](index.js#L23)

@@ -35,4 +32,2 @@ Parses sections in a `string` of markdown and returns an object with two properties:

{%= doc('examples/parse.md') %}
**Params**

@@ -44,3 +39,3 @@

### [.format](index.js#L64)
### [.format](index.js#L63)

@@ -64,2 +59,16 @@ Format sections. By default, if no filter function is passed, this:

## Generate docs
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm i -d && npm run docs
```
Or, if [verb](https://github.com/verbose/verb) is installed globally:
```sh
$ verb
```
## Running tests

@@ -91,2 +100,2 @@

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 06, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 15, 2016._
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