disco-js

An index of functions by their inputs and output. Find functions like this: "array in, Boolean out". For beginners and non-beginners.

willnwhite

1,298

1

0.3.0

MIT

GitHub

Function Index

type signature in, functions out

Find functionality faster than you can re-invent it.

Example

var words = [word, word, word, ...]

"Are all the words in this list the same or not?"

Rather than

for (var i = 1; i < words.length; i++) {
  if (words[i] !== words[0]) {
    return false
  } else if (i === words.length - 1) {
    return true
  }
}

or

words.forEach((word, i) => {
  if (word !== words[0]) {
    return false
  } else if (i === words.length - 1) {
    return true
  }
})

or even

words.every(function (word) {
  return word === words[0]
})

Give FI a type signature: array in, Boolean out

FI gives you the functions with that signature: every includes some allTheSame

allTheSame(words)

Indexed

To be indexed next

Publishing functions to FI

allTheSame.json

{
  "name": "allTheSame",
  "inputs": ["array"],
  "output": "Boolean",
  "source code": ["https://gist.github.com/willnwhite/90582eece5b14b5bd03de16dcff4ec61/raw/dd3316166de791064eece3e1e9f36be16dc07a41/allTheSame.js"],
  "documentation": ["https://gist.github.com/willnwhite/90582eece5b14b5bd03de16dcff4ec61"]
}