这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ZIMkaRU
Copy link
Member

@ZIMkaRU ZIMkaRU commented Nov 17, 2023

Description:

This PR fixes cloneDeep util to not throw an error when cloning non-objects

Fixes:

PR status:

  • Version bumped
  • Change-log updated
  • Tests added or updated
  • PR keeps 100% test coverage
  • Type definition updated
  • Readme updated
  • Linter is applied
  • Const arrow functions are used instead of pure function definitions where applicable
  • Functions are listed in alphabetic order in index.js, index.d.ts and readme

@ZIMkaRU ZIMkaRU changed the title Bugfix/fix clone deep to not throw err for non obj Fix clone deep to not throw err for non obj Nov 17, 2023
Copy link

@ezewer ezewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small request, rest looks good!

const isObject = require('./isObject')

const cloneDeep = (obj) => {
if (!isObject(obj)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep consistency with lodash
we should add: if (obj instanceof Function) return {}

Copy link

@ezewer ezewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants