How to use the is-plain-object/index.cjs.js function in is-plain-object

To help you get started, we’ve selected a few is-plain-object examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github octokit / request.js / lib / request.js View on Github external
function request (requestOptions) {
  if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
    requestOptions.body = JSON.stringify(requestOptions.body)
  }

  let headers = {}
  let status
  let url

  const fetch = (requestOptions.request && requestOptions.request.fetch) || nodeFetch

  return fetch(requestOptions.url, Object.assign({
    method: requestOptions.method,
    body: requestOptions.body,
    headers: requestOptions.headers,
    redirect: requestOptions.redirect
  }, requestOptions.request))

is-plain-object

Returns true if an object was created by the `Object` constructor, or Object.create(null).

MIT
Latest version published 4 years ago

Package Health Score

71 / 100
Full package analysis

Popular is-plain-object functions