Skip to content
/ xtrace Public

a tool for adding clarity to your compositional-pipelines

License

Notifications You must be signed in to change notification settings

brekk/xtrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jan 3, 2019
639de93 · Jan 3, 2019

History

54 Commits
Jan 3, 2019
Jan 3, 2019
Feb 16, 2018
Jan 3, 2019
Jul 13, 2017
Jul 3, 2018
Jan 3, 2019
Sep 10, 2017
Feb 16, 2018
Jan 3, 2019
Oct 4, 2017
Jul 9, 2017
Jan 3, 2019
Jan 3, 2019
Jan 3, 2019
Jan 3, 2019
Jan 3, 2019
Jan 3, 2019
Jan 3, 2019
Jan 3, 2019

Repository files navigation

xtrace

a tool for adding clarity to your compositional-pipelines or just invoking side-effects in a clean way

Originally inspired by this book, this is a more fully-fledged solution for adding simple side-effects to a given operation.

API

Table of Contents

sideEffect

Pass a value to a side effect function but return the original value

Parameters

Examples

import {sideEffect} from 'xtrace'
import {pipe} from 'f-utility'
const multiplyByTwo = x => x * 2
const eventLog => { / * something async * / }
const multiplyByTwoAndNotify = pipe(
  multiplyByTwo
  sideEffect(eventLog)
)

Returns any a

taggedSideEffect

Pass a value and a tag to a side effect function but return the value

Parameters

  • fn Function a function
  • a any anything
  • b any anything

Returns any b

trace

Log a value and a tag but return the value

Parameters

  • fn Function a function
  • a any something to log
  • b any some value

Returns any b

scopedSideEffect

Pass a transformed value and a tag but return the value

Parameters

  • fn Function a function
  • fn2 Function a transformer function
  • a any anything
  • b any anything

Returns any b

scopedTrace

Log a transformed value and a tag but return the value

Parameters

  • fn Function a transformer function
  • a any anything
  • b any anything

Returns any b

About

a tool for adding clarity to your compositional-pipelines

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published