Skip to content

Commit

Permalink
Rename argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfbarr committed Sep 19, 2023
1 parent 9fab389 commit 5863ea4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function useLog({
* log(someState, {environments: ['production']})
* ```
*/
function log<T>(value: T, props?: LogConfig): void {
function log<T>(value: T, config?: LogConfig): void {
const clonedValue = JSON.parse(JSON.stringify(value)) as T
const prevValueRef = useRef<T>()
const printProps: Pick<
Expand All @@ -83,30 +83,30 @@ export function useLog({
> = {
value: clonedValue,
styles: {
componentCSS: props?.styles?.componentCSS ?? componentCSS,
subValueCSS: props?.styles?.subValueCSS ?? subValueCSS,
changeCSS: props?.styles?.changeCSS ?? changeCSS,
componentCSS: config?.styles?.componentCSS ?? componentCSS,
subValueCSS: config?.styles?.subValueCSS ?? subValueCSS,
changeCSS: config?.styles?.changeCSS ?? changeCSS,
},
componentName,
flags: {
isGrouped: props?.isGroupingEnabled ?? isGroupingEnabled,
isCollapsed: props?.isGroupCollapsed ?? isGroupCollapsed,
isGrouped: config?.isGroupingEnabled ?? isGroupingEnabled,
isCollapsed: config?.isGroupCollapsed ?? isGroupCollapsed,
},
printer: props?.printer ?? printer,
logLevel: props?.logLevel ?? logLevel,
groupLabelRenderer: props?.groupLabelRenderer ?? groupLabelRenderer,
inline: props?.inline ?? inline,
printer: config?.printer ?? printer,
logLevel: config?.logLevel ?? logLevel,
groupLabelRenderer: config?.groupLabelRenderer ?? groupLabelRenderer,
inline: config?.inline ?? inline,
}

if (environments.includes(process.env.NODE_ENV ?? 'production')) {
function logHooks(): void {
const isUnmounting = useRef(false)

const printFunc = (printProps: _PrintConfig<T>): void =>
(props?.render ?? render ?? print)(
(config?.render ?? render ?? print)(
getRenderFunctionProps(
printProps,
Boolean(props?.render ?? render),
Boolean(config?.render ?? render),
),
)

Expand Down

0 comments on commit 5863ea4

Please sign in to comment.