@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.some.class.ts
@Iterable()
export class someClass{
value1: string = "test";
value2: number = 42;
objectValue: any = {name:"Me",role:"Programmer"}
}
main.ts
const sc = new someClass()
console.log(JSON.stringify([...sc]))
//["test",42,{"name":"Me","role":"Programmer"}] <- order is not mandatory
Last modified 4yr ago