File: useObjectValuesAndEntries1.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (59 lines) | stat: -rw-r--r-- 2,196 bytes parent folder | download | duplicates (5)
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
57
58
59
//// [useObjectValuesAndEntries1.ts]
var o = { a: 1, b: 2 };

for (var x of Object.values(o)) {
    let y = x;
}

var entries = Object.entries(o);                    // [string, number][]
var values = Object.values(o);                      // number[]

var entries1 = Object.entries(1);                   // [string, any][]
var values1 = Object.values(1);                     // any[]

var entries2 = Object.entries({ a: true, b: 2 });   // [string, number|boolean][]
var values2 = Object.values({ a: true, b: 2 });     // (number|boolean)[]

var entries3 = Object.entries({});                  // [string, {}][]
var values3 = Object.values({});                    // {}[]

var a = ["a", "b", "c"];
var entries4 = Object.entries(a);                   // [string, string][]
var values4 = Object.values(a);                     // string[]

enum E { A, B }
var entries5 = Object.entries(E);                   // [string, any][]
var values5 = Object.values(E);                     // any[]

interface I { }
var i: I = {};
var entries6 = Object.entries(i);                   // [string, any][]
var values6 = Object.values(i);                     // any[]

//// [useObjectValuesAndEntries1.js]
var o = { a: 1, b: 2 };
for (var _i = 0, _a = Object.values(o); _i < _a.length; _i++) {
    var x = _a[_i];
    var y = x;
}
var entries = Object.entries(o); // [string, number][]
var values = Object.values(o); // number[]
var entries1 = Object.entries(1); // [string, any][]
var values1 = Object.values(1); // any[]
var entries2 = Object.entries({ a: true, b: 2 }); // [string, number|boolean][]
var values2 = Object.values({ a: true, b: 2 }); // (number|boolean)[]
var entries3 = Object.entries({}); // [string, {}][]
var values3 = Object.values({}); // {}[]
var a = ["a", "b", "c"];
var entries4 = Object.entries(a); // [string, string][]
var values4 = Object.values(a); // string[]
var E;
(function (E) {
    E[E["A"] = 0] = "A";
    E[E["B"] = 1] = "B";
})(E || (E = {}));
var entries5 = Object.entries(E); // [string, any][]
var values5 = Object.values(E); // any[]
var i = {};
var entries6 = Object.entries(i); // [string, any][]
var values6 = Object.values(i); // any[]