isnovid.merge
[0.1.0](https://github.com/isnovid/merge/tree/0.1.0)
Last updated 7 years ago by isnovid .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install isnovid.merge 
SYNC missed versions from official npm registry.

merge

0.1.1

If you want to use the library in pure javascript, compiled and compressed version are available at library/merge.js

Interface

Install

npm install isnovid.merge

git clone git://github.com/isnovid/merge.git

Require

Server merge = require "isnovid.merge"

Client merge = isnovid.merge

merge arguments..., depth

In turn puts all arguments to the first argument. Required to specify the depth argument.

source:
	a: 1
	b: 1
	c: 
		a: [1,2,3]
		b: 1
		c: 
			a: 1
			b: 1
target:
	a: 2
	c: 
		a: [2,3,4]
		c: 
			a: 2
result = merge source, target, Infinity
###
source =
		a: 2
		b: 1
		c: 
			a: [2,3,4]
			b: 1
			c: 
				a: 2
				b: 1
###

merge source, target, Infinity equivalently merge.deep source, target and merge.large soruce, target

merge source, target, 1 equivalently merge.shallow source, target

Further, examples of the use of depth limitation.

merge source, target, 1

source:
	a: 1
	b: 1
	c: 
		a: [1,2,3]
		b: 1
		c: 
			a: 1
			b: 1
target:
	a: 2
	c: 
		a: [2,3,4]
		c: 
			a: 2
result = merge source, target, Infinity
###
source =
	a: 2
	c: 
		a: [2,3,4]
		c: 
			a: 2
###

`merge source, target, 2`
```coffeescript
source:
	a: 1
	b: 1
	c: 
		a: [1,2,3]
		b: 1
		c: 
			a: 1
			b: 1
target:
	a: 2
	c: 
		a: [2,3,4]
		c: 
			a: 2
result = merge source, target, Infinity
###
source =
	a: 2
	b: 1
	c: 
		a: [2,3,4]
		c: 
			a: 2
###

merge source, target, 3

source:
	a: 1
	b: 1
	c: 
		a: [1,2,3]
		b: 1
		c: 
			a: 1
			b: 1
target:
	a: 2
	c: 
		a: [2,3,4]
		c: 
			a: 2
result = merge source, target, Infinity
###
source =
	a: 2
	b: 1
	c: 
		a: [2,3,4]
		b: 1
		c: 
			a: 2
###

merge source, target, 4

source:
	a: 1
	b: 1
	c: 
		a: [1,2,3]
		b: 1
		c: 
			a: 1
			b: 1
target:
	a: 2
	c: 
		a: [2,3,4]
		c: 
			a: 2
result = merge source, target, Infinity
###
source =
	a: 2
	b: 1
	c: 
		a: [2,3,4]
		b: 1
		c: 
			a: 2
			b: 1
###

Chenge log

0.1.1

Issues 1

0.1.0

Initial release.

Current Tags

  • 0.2.0                                ...           latest (7 years ago)

2 Versions

  • 0.2.0                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2016 © taobao.org |