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

list-item

Package Overview
Dependencies
Maintainers
1
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.1 to 0.1.2

33

index.js

@@ -51,5 +51,5 @@ /*!

opts = opts || {};
var ch = character(opts, fn);
var chars = character(opts, fn);
return function(lvl, str) {
return function(lvl, str, sublvl) {
if (lvl == null) {

@@ -60,2 +60,3 @@ throw new Error('[listitem]: invalid arguments.');

lvl = isNumber(lvl) ? +lvl : 0;
var ch = chars(sublvl);

@@ -83,2 +84,4 @@ var bullet = ch && ch[lvl % ch.length];

*
* TODO: split this out into simpler functions.
*
* @param {Object} `opts` Options to pass to [expand-range]

@@ -91,10 +94,26 @@ * @param {Function} `fn`

var chars = opts.chars || ['-', '*', '+', '~'];
if (typeof chars === 'string') {
opts = Object.create(opts || {});
return expand(chars, opts, fn);
return function (sublvl) {
return expand(chars, opts, function(ch) {
return fn ? fn(ch, sublvl) : ch;
});
}
}
return typeof fn === 'function'
? chars.map(fn)
: chars;
if (typeof fn === 'function') {
return wrap(fn, chars);
}
return function () {
return chars;
}
}
function wrap (fn, chars) {
return function (sublvl) {
var args = [].slice.call(arguments);
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.1",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/list-item",

@@ -6,0 +6,0 @@ "author": {

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