add scope default and type

Ready for merge. Just does what the PR title says. Tests are in `npm`.

/cc @isaacs for review