Skip to content

Instantly share code, notes, and snippets.

@RobinKnipe
Last active November 7, 2022 11:58
Show Gist options
  • Select an option

  • Save RobinKnipe/b3ae809180b0ed2c93b11b45e612dc32 to your computer and use it in GitHub Desktop.

Select an option

Save RobinKnipe/b3ae809180b0ed2c93b11b45e612dc32 to your computer and use it in GitHub Desktop.
Strip request/response and Sympol fields from a SuperAgent-style request/response object.
const strip = obj => Object
.fromEntries(
Object
.entries(obj)
.filter(([k]) => !/^(?:_|[Rr]e[sq]|.*Symbol).*$/.test(k))
.map(([k, v]) => [k, v instanceof Object ? strip(v) : v])
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment