npm --depth option edge case fix

When a dependency has depth === maxDepth, it should be set with its
package info instead of a plain version string (treated as a problem
by npm). It should also have its own dependencies/peerDependencies
set to an empty object to prevent them being output in `npm ls`.

Also see https://github.com/isaacs/npm/pull/4179
v0.2.5
added dev arg to mark devDependencies as extraneous
test: Using tap to test the output and added devDep test
Migrated to an object for config options
Updated README
Fix the detection of invalid version

Modify the condition checking whether a dependency version satisfies
the range required in package.json, so that 'latest' is always
considered as valid.
v1.0.0
Fixed config options object overriding choices
add gitignore
Allow tests to run on windows
tests: use a fixture for tests
v1.0.1
tests for depth=0 and 1
Invert the meaning of the "dev" option to correct value

The 1.0 style dev flag is incorrectly designed.  Any time a boolean
means "yes, do the thing", that should be the "true" option. In this
case, the flag is "dev", so "dev:true" should mean, "Yes, include dev
dependencies".

However, it was set as "dev:true" meaning "Yes, don't include the dev
dependencies", which is an awkward "no means yes" kind of situation.

I think that @davglass was trying to do the prudent thing and disrupt
the current behavior as little as possible, so that a default "falsey"
choice would do what it currently does, and not treat devDependencies as
extraneous.  I had misread his original pull request, and approved it.

It's unfortunate that this means yet another breaking change.
Thankfully, that's what the Major version in SemVer is for, and not many
libraries use this, apart from npm itself :)
Use util-extend module
Negative depth should be 0, not Infinity
v2.0.0
Correctly set the extraneous flag on dependencies.

The readInstalled_ function sets extraneous=true for every dependency not
required by its direct parent and leaves it to undefined for others.

After the dependency tree has been built, the markExtraneous function will
walk it depth-first and set extraneous=false on dependencies that are not
extraneous and then recurse until all dependencies have been flagged:

for d in dependencies:
  if d.parent is not extraneous:
    set d.extraneous = false
    execute recursively on d.dependencies

This will ensure that extraneous dependencies will not be marked as
extraneous=false incorrectly because of a dependency cycle.
v2.0.1