Now I have not used FabricJS (waiting for spam votes), looking at the source, there is a method getObjects(). What this does is return an array of objects instead of a custom iterator, for example forEachObject().
, , forEach(), some(), every() .., , .
, , , , ? .
canvas
.getObjects()
.some(obj => {
if (obj.isType('image') && obj.hasOwnProperty('background') && obj.background === true) {
console.log('Aww shucks, you found me.');
return true;
}
});
, .
, , true. - true, some true.
EDIT .
, getObjects . .
canvas
.getObjects('image')
.some(obj => {
if (obj.background === true) {
console.log('Aww shucks, you found me.');
return true;
}
});
fabricjs getObjects
EDIT:
hasOwnProperty , . obj , , , undefined. === true.