Skip to content

Commit cd5fa0c

Browse files
committed
feat: first commit
0 parents  commit cd5fa0c

15 files changed

+6421
-0
lines changed

.editorconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
# The JSON files contain newlines inconsistently
13+
[*.json]
14+
insert_final_newline = ignore
15+
16+
# Minified JavaScript files shouldn't be changed
17+
[**.min.js]
18+
indent_style = ignore
19+
insert_final_newline = ignore
20+
21+
[*.md]
22+
trim_trailing_whitespace = false

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.DS_Store
3+
*.log
4+
coverage

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: node_js
2+
node_js:
3+
- node
4+
cache:
5+
directories:
6+
- node_modules
7+
install:
8+
- npm install
9+
script:
10+
- yarn test
11+
after_success:
12+
- yarn codecov

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"npm-scripts.showStartNotification": false
3+
}

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4+
5+
<a name="0.0.1"></a>
6+
## 0.0.1 (2018-04-14)
7+
8+
9+
### Bug Fixes
10+
11+
* 099458 ([fd8be96](https://github.com/fjc0k/vue-merge-data/commit/fd8be96))
12+
* 09969 ([0fae39e](https://github.com/fjc0k/vue-merge-data/commit/0fae39e))
13+
* 1 ([92e8321](https://github.com/fjc0k/vue-merge-data/commit/92e8321))
14+
* 11 ([1b49bb2](https://github.com/fjc0k/vue-merge-data/commit/1b49bb2))
15+
* 405995 ([de32cc5](https://github.com/fjc0k/vue-merge-data/commit/de32cc5))
16+
* 44 ([1dc0f10](https://github.com/fjc0k/vue-merge-data/commit/1dc0f10))
17+
* 44 ([fbdb21f](https://github.com/fjc0k/vue-merge-data/commit/fbdb21f))
18+
* 4858 ([baa2882](https://github.com/fjc0k/vue-merge-data/commit/baa2882))
19+
* err ([69ff0dd](https://github.com/fjc0k/vue-merge-data/commit/69ff0dd))
20+
* error ([dff4287](https://github.com/fjc0k/vue-merge-data/commit/dff4287))
21+
* firb entry ([4dd9119](https://github.com/fjc0k/vue-merge-data/commit/4dd9119))
22+
23+
24+
### Features
25+
26+
* 444 ([7f763d8](https://github.com/fjc0k/vue-merge-data/commit/7f763d8))
27+
* add 11 ([d1d193c](https://github.com/fjc0k/vue-merge-data/commit/d1d193c))
28+
* ff ([9a8e576](https://github.com/fjc0k/vue-merge-data/commit/9a8e576))
29+
* first commit ([f7c493d](https://github.com/fjc0k/vue-merge-data/commit/f7c493d))
30+
* hello ([c5a4e45](https://github.com/fjc0k/vue-merge-data/commit/c5a4e45))
31+
* hello ([4427be6](https://github.com/fjc0k/vue-merge-data/commit/4427be6))
32+
* new ([1751fd5](https://github.com/fjc0k/vue-merge-data/commit/1751fd5))
33+
* world ([886c1a9](https://github.com/fjc0k/vue-merge-data/commit/886c1a9))

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 fjc0k <fjc0kb@gmail.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# vue-merge-data
2+
3+
[![npm](https://img.shields.io/npm/v/vue-merge-data.svg)](https://npm.im/vue-merge-data)
4+
[![npm downloads](https://img.shields.io/npm/dt/vue-merge-data.svg)](https://npm.im/vue-merge-data)
5+
[![Travis](https://img.shields.io/travis/fjc0k/vue-merge-data.svg)](https://travis-ci.org/fjc0k/vue-merge-data)
6+
[![Codecov](https://img.shields.io/codecov/c/github/fjc0k/vue-merge-data.svg)](https://codecov.io/gh/fjc0k/vue-merge-data)
7+
[![minified size](https://img.shields.io/bundlephobia/min/vue-merge-data.svg)](https://github.com/fjc0k/vue-merge-data/blob/master/dist/vue-merge-data.min.js)
8+
[![minzipped size](https://img.shields.io/bundlephobia/minzip/vue-merge-data.svg)](https://github.com/fjc0k/vue-merge-data/blob/master/dist/vue-merge-data.min.js)
9+
[![license](https://img.shields.io/github/license/fjc0k/vue-merge-data.svg)](https://github.com/fjc0k/vue-merge-data/blob/master/LICENSE)
10+
11+

dist/vue-merge-data.cjs.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*!
2+
* vue-merge-data v0.0.1
3+
* (c) 2018-present fjc0k <fjc0kb@gmail.com> (https://github.com/fjc0k)
4+
* Released under the MIT License.
5+
*/
6+
'use strict';
7+
8+
/* eslint guard-for-in: 0, no-case-declarations: 0, max-depth: 0 */
9+
var keys = Object.keys;
10+
function mergeData(target, source) {
11+
var propNames = keys(source);
12+
13+
for (var i in propNames) {
14+
var propName = propNames[i];
15+
var targetValue = target[propName];
16+
var sourceValue = source[propName];
17+
18+
if (targetValue) {
19+
switch (propName) {
20+
// append
21+
case 'staticClass':
22+
target[propName] = (targetValue + ' ' + sourceValue).trim();
23+
break;
24+
// override
25+
26+
case 'attrs':
27+
case 'domProps':
28+
case 'scopedSlots':
29+
case 'staticStyle':
30+
case 'props':
31+
case 'hook':
32+
case 'transition':
33+
var props = keys(sourceValue);
34+
35+
for (var ii in props) {
36+
var prop = props[ii];
37+
targetValue[prop] = sourceValue[prop];
38+
}
39+
40+
break;
41+
// expand
42+
43+
case 'class':
44+
case 'style':
45+
case 'directives':
46+
target[propName] = [].concat(sourceValue, targetValue);
47+
break;
48+
// expand
49+
50+
case 'on':
51+
case 'nativeOn':
52+
var listenerNames = keys(sourceValue);
53+
54+
for (var _ii in listenerNames) {
55+
var listenerName = listenerNames[_ii];
56+
57+
if (targetValue[listenerName]) {
58+
targetValue[listenerName] = [].concat(sourceValue[listenerName], targetValue[listenerName]);
59+
} else {
60+
targetValue[listenerName] = sourceValue[listenerName];
61+
}
62+
}
63+
64+
break;
65+
// override
66+
67+
default:
68+
target[propName] = source[propName];
69+
break;
70+
}
71+
} else {
72+
target[propName] = sourceValue;
73+
}
74+
}
75+
}
76+
77+
module.exports = mergeData;

dist/vue-merge-data.es.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*!
2+
* vue-merge-data v0.0.1
3+
* (c) 2018-present fjc0k <fjc0kb@gmail.com> (https://github.com/fjc0k)
4+
* Released under the MIT License.
5+
*/
6+
/* eslint guard-for-in: 0, no-case-declarations: 0, max-depth: 0 */
7+
var keys = Object.keys;
8+
function mergeData(target, source) {
9+
var propNames = keys(source);
10+
11+
for (var i in propNames) {
12+
var propName = propNames[i];
13+
var targetValue = target[propName];
14+
var sourceValue = source[propName];
15+
16+
if (targetValue) {
17+
switch (propName) {
18+
// append
19+
case 'staticClass':
20+
target[propName] = (targetValue + ' ' + sourceValue).trim();
21+
break;
22+
// override
23+
24+
case 'attrs':
25+
case 'domProps':
26+
case 'scopedSlots':
27+
case 'staticStyle':
28+
case 'props':
29+
case 'hook':
30+
case 'transition':
31+
var props = keys(sourceValue);
32+
33+
for (var ii in props) {
34+
var prop = props[ii];
35+
targetValue[prop] = sourceValue[prop];
36+
}
37+
38+
break;
39+
// expand
40+
41+
case 'class':
42+
case 'style':
43+
case 'directives':
44+
target[propName] = [].concat(sourceValue, targetValue);
45+
break;
46+
// expand
47+
48+
case 'on':
49+
case 'nativeOn':
50+
var listenerNames = keys(sourceValue);
51+
52+
for (var _ii in listenerNames) {
53+
var listenerName = listenerNames[_ii];
54+
55+
if (targetValue[listenerName]) {
56+
targetValue[listenerName] = [].concat(sourceValue[listenerName], targetValue[listenerName]);
57+
} else {
58+
targetValue[listenerName] = sourceValue[listenerName];
59+
}
60+
}
61+
62+
break;
63+
// override
64+
65+
default:
66+
target[propName] = source[propName];
67+
break;
68+
}
69+
} else {
70+
target[propName] = sourceValue;
71+
}
72+
}
73+
}
74+
75+
export default mergeData;

dist/vue-merge-data.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*!
2+
* vue-merge-data v0.0.1
3+
* (c) 2018-present fjc0k <fjc0kb@gmail.com> (https://github.com/fjc0k)
4+
* Released under the MIT License.
5+
*/
6+
(function (global, factory) {
7+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8+
typeof define === 'function' && define.amd ? define(factory) :
9+
(global.VueMergeData = factory());
10+
}(this, (function () { 'use strict';
11+
12+
/* eslint guard-for-in: 0, no-case-declarations: 0, max-depth: 0 */
13+
var keys = Object.keys;
14+
function mergeData(target, source) {
15+
var propNames = keys(source);
16+
17+
for (var i in propNames) {
18+
var propName = propNames[i];
19+
var targetValue = target[propName];
20+
var sourceValue = source[propName];
21+
22+
if (targetValue) {
23+
switch (propName) {
24+
// append
25+
case 'staticClass':
26+
target[propName] = (targetValue + ' ' + sourceValue).trim();
27+
break;
28+
// override
29+
30+
case 'attrs':
31+
case 'domProps':
32+
case 'scopedSlots':
33+
case 'staticStyle':
34+
case 'props':
35+
case 'hook':
36+
case 'transition':
37+
var props = keys(sourceValue);
38+
39+
for (var ii in props) {
40+
var prop = props[ii];
41+
targetValue[prop] = sourceValue[prop];
42+
}
43+
44+
break;
45+
// expand
46+
47+
case 'class':
48+
case 'style':
49+
case 'directives':
50+
target[propName] = [].concat(sourceValue, targetValue);
51+
break;
52+
// expand
53+
54+
case 'on':
55+
case 'nativeOn':
56+
var listenerNames = keys(sourceValue);
57+
58+
for (var _ii in listenerNames) {
59+
var listenerName = listenerNames[_ii];
60+
61+
if (targetValue[listenerName]) {
62+
targetValue[listenerName] = [].concat(sourceValue[listenerName], targetValue[listenerName]);
63+
} else {
64+
targetValue[listenerName] = sourceValue[listenerName];
65+
}
66+
}
67+
68+
break;
69+
// override
70+
71+
default:
72+
target[propName] = source[propName];
73+
break;
74+
}
75+
} else {
76+
target[propName] = sourceValue;
77+
}
78+
}
79+
}
80+
81+
return mergeData;
82+
83+
})));

0 commit comments

Comments
 (0)