Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cast(allowed /*: Array */ = []) /*: ChangesetDef */ {
let changes /*: Changes */ = get(this, CHANGES);
if (isArray(allowed) && allowed.length === 0) {
return this;
}
let changeKeys /*: Array */ = keys(changes);
let validKeys = emberArray(changeKeys).filter((key /*: string */) => includes(allowed, key));
let casted = take(changes, validKeys);
set(this, CHANGES, casted);
return this;
},