Code Monkey home page Code Monkey logo

lodash-fp-docs's Introduction

lodash/fp doc generator

This project aims to generate proper docs for Lodash's functional programming flavor, aka lodash/fp. The end goal would be generate a doc similar to the official documentation. The result can be found HERE.

Why

Lodash FP aims to combine the great functionality given by the library and the ideas of functional programming. Only, this behavior is [documented](FP Guide) in a manner unbefitting of what users are used to with the official documentation.

What changed in FP?

  • The order of arguments has been changed, in particular the data argument has been moved to the last position
  • No methods mutate the arguments
  • Some methods are curried
  • Some methods have their arguments capped, meaning some arguments have disappeared
  • Some methods with ...values have that argument now in an array

What now

Lodash's sources are generated using docdown. What it does is read the source files, extract the JSDoc comments, then generate a Markdown file. By overriding Docdown's behavior, we can change the documentation too, in the methods' signature and example:

  • change the order of arguments
  • remove now ignored arguments
  • group ...values arguments into an array argument
  • remove calls to console.log() that aim to demonstrate a value was mutated (only in example)
  • inject optional arguments that have become mandatory using their default value (only in example)

Run it

npm i
npm run doc:fp
// now open doc/fp.md!

lodash-fp-docs's People

Contributors

jfmengels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lodash-fp-docs's Issues

_.pull(values, array) example error

The example:

var array = ['a', 'b', 'c', 'a', 'b', 'c'];

_.pull(['a', 'c'], array);
// => ['b', 'b']

Actually, this _.pull example is the same as _.pullAll.

docs for get() with default value are incorrect

The docs say:

_.get(['a.b.c', 'default'], object);
// => 'default'

This does not work (result is undefined). To use a fallback/default, one has to use getOr:

_.getOr('default', 'a.b.c', object);
// => 'default'

I'm don't really understand where this error comes from, otherwise I had submitted a PR.

_.remove(predicate, values) has the mutable version description.

Description of this function:

Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. The predicate is invoked with three arguments: (value, index, array).

This is the mutable version function's behavior. Example of this function also the mutable version.

_.set(path, value, object)

does _.set(path, value, objcet) return value or a copy of object with {path: value} set?
And object is untouched.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.