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

list-item

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

list-item - npm Package Compare versions

Comparing version 0.1.2 to 1.0.1

28

index.js

@@ -40,3 +40,3 @@ /*!

* @option {String} [options] `indent` The amount of leading indentation to use. default is ` `.
* @option {String|Array} [options] `chars` If a string is passed, [expand-range] will be used to generate an array of bullets (visit [expand-range] to see all options.) Or directly pass an array of bullets, numbers, letters or other characters to use for each list item. Default `['-', '*', '+', '~']`
* @option {String|Array} [options] `chars` If a string is passed, [expand-range] will be used to generate an array of bullets (visit [expand-range] to see all options.) Or directly pass an array of bullets, numbers, letters or other characters to use for each list item. Default `['-', '*', '+']`
* @param {Function} `fn` pass a function [expand-range] to modify the bullet for an item as it's generated. See the [examples].

@@ -48,3 +48,4 @@ * @api public

if (typeof opts === 'function') {
fn = opts; opts = null;
fn = opts;
opts = {};
}

@@ -56,3 +57,3 @@

return function(lvl, str, sublvl) {
if (lvl == null) {
if (!isNumber(lvl)) {
throw new Error('[listitem]: invalid arguments.');

@@ -63,4 +64,3 @@ }

var ch = chars(sublvl);
var bullet = ch && ch[lvl % ch.length];
var bullet = ch ? ch[lvl % ch.length] : '';
var indent = typeof opts.indent !== 'string'

@@ -80,3 +80,3 @@ ? (lvl > 0 ? ' ' : '')

};
};
}

@@ -87,2 +87,6 @@ /**

*
* - http://spec.commonmark.org/0.19/#list-items
* - https://daringfireball.net/projects/markdown/syntax#list
* - https://help.github.com/articles/markdown-basics/#lists
*
* TODO: split this out into simpler functions.

@@ -96,3 +100,3 @@ *

function character(opts, fn) {
var chars = opts.chars || ['-', '*', '+', '~'];
var chars = opts.chars || ['-', '*', '+'];
if (typeof chars === 'string') {

@@ -104,3 +108,3 @@ opts = Object.create(opts || {});

});
}
};
}

@@ -112,13 +116,13 @@ if (typeof fn === 'function') {

return chars;
}
};
}
function wrap (fn, chars) {
return function (sublvl) {
return function (/*sublvl*/) {
var args = [].slice.call(arguments);
return chars.map(function (ch) {
return chars.map(function (/*ch*/) {
var ctx = args.concat.apply([], arguments);
return fn.apply(fn, ctx);
});
}
};
}
{
"name": "list-item",
"description": "Generate a single formatted list item, allowing you to easily generate lists with proper indentation, bullets, numbers or other leading characters.",
"version": "0.1.2",
"version": "1.0.1",
"homepage": "https://github.com/jonschlinkert/list-item",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"repository": "jonschlinkert/list-item",

@@ -14,2 +11,6 @@ "bugs": {

},
"maintainers": [
"Anders D. Johnson (https://github.com/adjohnson916)",
"Jon Schlinkert (https://github.com/jonschlinkert)"
],
"license": "MIT",

@@ -28,4 +29,4 @@ "files": [

"expand-range": "^1.8.1",
"is-number": "^1.1.0",
"repeat-string": "^1.5.0"
"is-number": "^2.0.2",
"repeat-string": "^1.5.2"
},

@@ -35,3 +36,4 @@ "devDependencies": {

"romanize": "^0.1.0",
"should": "*"
"should": "*",
"verb": "git://github.com/verbose/verb"
},

@@ -51,3 +53,15 @@ "keywords": [

"unordered"
]
}
],
"verb": {
"related": {
"list": [
"fill-range",
"expand-range",
"to-regex-range",
"randomatic",
"romanize",
"deromanize"
]
}
}
}

@@ -5,6 +5,8 @@ # list-item [![NPM version](https://badge.fury.io/js/list-item.svg)](http://badge.fury.io/js/list-item)

## Install with [npm](npmjs.org)
## Install
```bash
npm i list-item --save
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i list-item --save
```

@@ -40,4 +42,4 @@

+ c
~ d
- e
- d
* e
```

@@ -75,4 +77,4 @@

## API
## API
### [listitem](index.js#L45)

@@ -82,9 +84,16 @@

* `options` **{String}**
- `nobullet` **{Boolean}**: Pass true if you only want the list iten and identation, but no bullets.
- `indent` **{String}**: The amount of leading indentation to use. default is ` `.
- `chars` **{String|Array}**: If a string is passed, [expand-range] will be used to generate an array of bullets (visit [expand-range] to see all options.) Or directly pass an array of bullets, numbers, letters or other characters to use for each list item. Default `['-', '*', '+', '~']`
* `fn` **{Function}**: pass a function [expand-range] to modify the bullet for an item as it's generated. See the [examples].
**Params**
*
`options` **{String}**
- `nobullet` **{Boolean}**: Pass true if you only want the list iten and identation, but no bullets.
- `indent` **{String}**: The amount of leading indentation to use. default is ``.
- `chars` **{String|Array}**: If a string is passed, [expand-range](https://github.com/jonschlinkert/expand-range)will be used to generate an array of bullets (visit [expand-range](https://github.com/jonschlinkert/expand-range)to see all options.) Or directly pass an array of bullets, numbers, letters or other characters to use for each list item. Default `['-', '*', '+']`
*
`fn` **{Function}**: pass a function [expand-range](https://github.com/jonschlinkert/expand-range)to modify the bullet for an item as it's generated. See the [examples].
**Example**
```js

@@ -103,30 +112,36 @@ var li = listitem(options);

## Related projects
* [deromanize](https://github.com/jonschlinkert/deromanize): Convert roman numerals to arabic numbers (useful for books, outlines, documentation, slide decks, etc)
* [expand-range](https://github.com/jonschlinkert/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://github.com/jonschlinkert/expand-range)
* [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://github.com/jonschlinkert/fill-range)
* [randomatic](https://github.com/jonschlinkert/randomatic): Generate randomized strings of a specified length, fast. Only the length is necessary, but you… [more](https://github.com/jonschlinkert/randomatic)
* [romanize](https://github.com/jonschlinkert/romanize): Convert numbers to roman numerals (useful for books, outlines, documentation, slide decks, etc)
* [to-regex-range](https://github.com/jonschlinkert/to-regex-range): Returns a regex-compatible range from two numbers, min and max. Useful for creating regular expressions… [more](https://github.com/jonschlinkert/to-regex-range)
## Running tests
## Run tests
Install dev dependencies.
Install dev dependencies:
```bash
npm i -d && npm test
```sh
$ npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/list-item/issues)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/list-item/issues/new).
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the license
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
***
_This file was generated by [verb](https://github.com/assemble/verb) on February 21, 2015._
[expand-range]: https://github.com/jonschlinkert/expand-range
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 07, 2015._
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