Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
532 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | module.exports = {
|
---|
| 4 | isObject: function(obj) {
|
---|
| 5 | var type = typeof obj;
|
---|
| 6 | return type === 'function' || type === 'object' && !!obj;
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | , extend: function(obj) {
|
---|
| 10 | if (!this.isObject(obj)) {
|
---|
| 11 | return obj;
|
---|
| 12 | }
|
---|
| 13 | var source, prop;
|
---|
| 14 | for (var i = 1, length = arguments.length; i < length; i++) {
|
---|
| 15 | source = arguments[i];
|
---|
| 16 | for (prop in source) {
|
---|
| 17 | if (Object.prototype.hasOwnProperty.call(source, prop)) {
|
---|
| 18 | obj[prop] = source[prop];
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 | }
|
---|
| 22 | return obj;
|
---|
| 23 | }
|
---|
| 24 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.