Socket
Book a DemoInstallSign in
Socket

list-methods

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

list-methods

Easily generate a JSON or markdown list (sorted array) of property names of all enumerable properties, own and inherited, of objects that have function values.

Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
16
128.57%
Maintainers
1
Weekly downloads
 
Created
Source

list-methods NPM version

Easily generate a JSON or markdown list (sorted array) of property names of all enumerable properties, own and inherited, of objects that have function values.

Quickstart

Install with npm:

npm i -g list-methods

Usage

Run the methods command without any arguments and a markdown file will be generated for index.js, or the first javascript file found in the current directory.

args

If you want to specify the source file to read, or the destination to write to, you can use this format:

methods [src] [dest]

Or:

  • -s | --src: reads the specified source file
  • -d | --dest: the destination path and file to write. note that extension is significant

Dest extension:

  • .yml: generates a YAML file
  • .md: generates a markdown file

template

Methods uses Lo-Dash templates, so they're super fast and easy to extend. There are a couple of ways you can specify the template to use.

Either as a third argument:

methods [src] [dest] [template]

Or with -t or --template:

methods -t docs

built-in templates

There are three built-in templates:

  • list: generates a simple, bullet list of methods
  • docs: generates a formatted markdown file, giving each method its own section with starter content for type and default, etc.
  • yaml: similar to docs, but outputs YAML. this is useful if you want to update and extend this file with other tools, like Verb or Assemble

custom templates

The only context passed to the templates is the array of properties generated. Example:

module.exports = [
  '# <%= data.name %> properties\n\n',
  '<% _.forEach(data, function(fn) { %>',
  '* <%- fn %>\n',
  '<% }); %>'
].join('');

You can either specify the filepath to the custom template, or the name of a npm module that is installed locally, and methods will try to use it:

methods -t my-template

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert Released under the MIT license

This file was generated by verb-cli on March 25, 2014.

Keywords

lodash

FAQs

Package last updated on 25 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts