pbeshai / tidy

Tidy up your data with JavaScript, inspired by dplyr and the tidyverse
https://pbeshai.github.io/tidy
MIT License
725 stars 21 forks source link

Feature Request: add a boolean flag to turn on/off debug #55

Closed peterpham closed 2 years ago

peterpham commented 2 years ago

Feature Request

Able to turn on/off debug depending when needed. For example: I want to suppress debug on production but show it on staging

For example:

const _DEBUG = false;
tidy(data, debug("info label", {limit: 15, show: _DEBUG})  );
pbeshai commented 2 years ago

Hi there! You can do this with any function in a tidy flow just by making it conditional. Tidy will ignore all falsy values in the flow. e.g.

const _DEBUG = false;
tidy(data, 
  _DEBUG && debug("info label", {limit: 15})  
);
// or
tidy(data, 
  _DEBUG ? debug("info label", {limit: 15}) : null 
);