@Iterable()
Allow object to be treated as iterables
With iterable() decorator objects can be treated as iterables, which mean spread operations, find, filter and all others array methods are availble.

Example

some.class.ts
1
@Iterable()
2
export class someClass{
3
value1: string = "test";
4
value2: number = 42;
5
objectValue: any = {name:"Me",role:"Programmer"}
6
}
Copied!
main.ts
1
const sc = new someClass()
2
console.log(JSON.stringify([...sc]))
3
//["test",42,{"name":"Me","role":"Programmer"}] <- order is not mandatory
Copied!
Last modified 3yr ago
Copy link
Contents
Example