import is from '@sindresorhus/is' ; import prepareError from './utils' ; Error . stackTraceLimit = 20 ; export default function errSerializer ( err ) { const response = prepareError ( err ) ; const redactedFields = [ 'message' , 'stack' , 'stdout' , 'stderr' ] ; for ( const field of redactedFields ) { const val = response [ field ] ; if ( is . string ( val ) ) { response [ field ] = val . replace ( /https:\/\/[^@]*?@/g , 'https://**redacted**@' ) ; } } return response ; }