@kenanhancer/

ES6_ObjectDestructure

Nodejs

No description

fork
loading
Files
  • index.js
  • omit.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const omit = require('./omit');

const person = {
  firstName: "kenan",
  lastName: "hancer",
  age: 35,
  mail: "[email protected]"
};

const {
  firstName,
  lastName,
  mail = "[email protected]",
  contact = {
    city: "London",
    country: firstName
  }
} = person;

const a1 = omit('firstName')(person);
console.log(a1);

const myObject = {
  a: 1,
  b: 2,
  c: 3
};
const { a, ...noA } = myObject;

console.log(noA);

// console.log(firstName, lastName, mail, contact);

const obj1 = {
  firstName: "kenan",
  lastName: "hancer",
  age: 35,
  mail: "[email protected]",
  contact: {
    city: "London",
    country: firstName
  }
};

const obj2 = {
  job: "engineer"
};

const obj3 = Object.assign({}, obj1, obj2);

// console.log(obj3);

// const obj4 = { ...obj1, ...obj2 };

// console.log(obj4);
node v10.16.0