Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

thread-first

utanapishtim2MIT1.0.1

Like the thread first macro in clojure https://clojure.org/guides/threading_macros

readme

thread-first

Like the thread first macro in clojure https://clojure.org/guides/threading_macros

install

npm install thread-first

usage

  var threadFirst = require('thread-first')

  function head (array) {
    return Array.isArray(array) && array[0]
  }
  var text = 'abcd'
  var X = threadFirst(text, [
    ['replace', 'a', 'x'],
    'toUpperCase',
    ['split', ''],
    head
  ])
  console.log(X) // 'X'