mirror of https://github.com/lukechilds/rollup.git
Brian Donovan
9 years ago
2 changed files with 35 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||
import { keys } from './object.js'; |
|||
|
|||
export default function validateKeys ( object, allowedKeys ) { |
|||
const actualKeys = keys( object ); |
|||
|
|||
actualKeys.forEach( key => { |
|||
if ( allowedKeys.indexOf( key ) < 0 ) { |
|||
throw new Error( `Unexpected key '${ key }' found, expected one of: ${ allowedKeys.join( ', ' ) }` ); |
|||
} |
|||
}); |
|||
} |
Loading…
Reference in new issue