To update the isUnsplashObject
attribute and return a single Asset.create({...})
, you can follow this example:
if (this.get('fileUrl')) {
return Asset.create({
url: this.get('fileUrl'),
mime_type: this.get('fileContainer.mime_type'),
isUnsplashObject: (this.get('fileContainer.asset_kind') === 'UnsplashAsset')
});
}
This is similar to the following approach:
if (this.get('fileContainer.asset_kind') === 'UnsplashAsset') {
isUnsplashObject = true
} else {
isUnsplashObject = false
}
Alternatively, you can use a ternary operator like this:
isUnsplashObject = (this.get('fileContainer.asset_kind') === 'UnsplashAsset') ? true : false;
Or simply return the equality check result as it already yields a boolean value:
isUnsplashObject = (this.get('fileContainer.asset_kind') === 'UnsplashAsset')