Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

enhance: _merge fix #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

enhance: _merge fix #187

wants to merge 2 commits into from

Conversation

Beraliv
Copy link
Member

@Beraliv Beraliv commented Mar 9, 2019

Changes:

  • reduce size
  • simplify implementation
  • update performance tests
  • update docs
  • cover with tests

@Beraliv Beraliv changed the title enhance: Object.key => for/in enhance: _merge fix Mar 9, 2019
import _merge from '../_internal/_merge'

export default curry3(function mergeWith(cb, result) {
export default _curry2(function mergeWith(cb, result) {
Copy link
Member Author

@Beraliv Beraliv Mar 9, 2019

Choose a reason for hiding this comment

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

it works with 2+ arguments, so no need for curry3

@@ -2,10 +2,11 @@ import _curry3 from '../_internal/_curry3'
import _merge from '../_internal/_merge'

export default _curry3(function mergeDeepWithKey(func, left, right) {
return _merge(left, right, function(l, r, key) {
function mergeDeepWithKeyStrategy(l, r, key) {
Copy link
Member Author

Choose a reason for hiding this comment

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

anonymous function cannot be optimised in size

@@ -2,9 +2,13 @@ import _curry3 from '../_internal/_curry3'
import _merge from '../_internal/_merge'

export default _curry3(function mergeDeepWith(func, left, right) {
var cb = function(l, r) {
if (typeof l === 'object' && typeof r === 'object' && !Array.isArray(l)) return mergeDeepWith(func, l, r)
function mergeDeepWithStrategy(l, r) {
Copy link
Member Author

Choose a reason for hiding this comment

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

created name for better debugging

import mergeDeepLeft from '../mergeDeepLeft/mergeDeepLeft'
import _merge from '../_internal/_merge'

function mergeDeepRightStrategy(left, right) {
Copy link
Member Author

Choose a reason for hiding this comment

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

created name for better debugging

var cb = function(l, r) {
if (!Array.isArray(l) && typeof l === 'object' && typeof r === 'object') {
return mergeDeepLeft(l, r)
function mergeDeepLeftStrategy(left, right) {
Copy link
Member Author

Choose a reason for hiding this comment

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

created name for better debugging

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant