/
index.esm.js
54 lines (45 loc) · 1.07 KB
/
index.esm.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
/*!
* @renoirb/polyfill-for-of-example v1.0.0-dev.0
* (c)
* Released under the UNLICENSED License.
*/
/**
* TypeScript support writing JavaScript too.
* https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html
*/
const greeter = message => `Howdy, ${message}`;
// Private constant, only included from Person class.
const introductions = {
fr: 'Bonsoir, mon nom est',
pt: 'Oi gente, meu nome é',
en: 'Hello, my name is'
};
class Person {
constructor(name = 'John Doe', lang) {
this.name = name;
this.lang = lang;
if (lang) {
this.lang = lang;
}
}
toString() {
const name = this.name;
const text = this.lang ? introductions[this.lang] : introductions.en;
return `${text} ${name}`;
}
}
var index = (people => {
const out = [];
for (const someone of people) {
const {
name = 'John Doe'
} = someone || {};
const p = new Person(name); // for (const [k, v] of Object.entries(rest)) {
// p[k] = v
// }
out.push(p);
}
return out;
});
export default index;
export { Person, greeter };