Repository: yargs/yargs (js)

Issue:
can't run example/usage-options.js
After I issued `node usage-option.js`, it displays error message like below.

```
YError: Invalid second argument. Expected string or boolean but received object.
    at argumentTypeError (/Users/fred/git/stocks-cn/node_modules/yargs/lib/argsert.js:65:9)
    at parsed.optional.forEach (/Users/fred/git/stocks-cn/node_modules/yargs/lib/argsert.js:47:39)
    at Array.forEach (<anonymous>)
    at argsert (/Users/fred/git/stocks-cn/node_modules/yargs/lib/argsert.js:42:21)
    at Object.Yargs.self.usage (/Users/fred/git/stocks-cn/node_modules/yargs/yargs.js:442:5)
    at Object.<anonymous> (/Users/fred/git/stocks-cn/usage-option.js:3:18)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)

/Users/fred/git/stocks-cn/node_modules/yargs/yargs.js:450
        throw new YError('.usage() description must start with $0 if being used as alias for .command()')
        ^
YError: .usage() description must start with $0 if being used as alias for .command()
    at Object.Yargs.self.usage (/Users/fred/git/stocks-cn/node_modules/yargs/yargs.js:450:15)
    at Object.<anonymous> (/Users/fred/git/stocks-cn/usage-option.js:3:18)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
```

I wonder whether the example code is deprecated.

Pull request:
fix(docs): usage-options example 
it fixes #1176

Patch:
diff --git a/example/usage-options.js b/example/usage-options.js
index 65a9c13..5bf9616 100644
--- a/example/usage-options.js
+++ b/example/usage-options.js
@@ -1,17 +1,18 @@
 var yargs = require('yargs');
 
-var argv = yargs.usage('This is my awesome program', {
-  'about': {
-    description: 'Provide some details about the author of this program',
-    required: true,
-    alias: 'a',
-  },
-  'info': {
-    description: 'Provide some information about the node.js agains!!!!!!',
-    boolean: true,
-    alias: 'i'
-  }
-}).argv;
+var argv = yargs.usage('This is my awesome program')
+  .options({
+    'about': {
+      description: 'Provide some details about the author of this program',
+      required: true,
+      alias: 'a',
+    },
+    'info': {
+      description: 'Provide some information about the node.js agains!!!!!!',
+      boolean: true,
+      alias: 'i'
+    }
+  }).argv;
 
 yargs.showHelp();
 
diff --git a/lib/apply-extends.js b/lib/apply-extends.js
index 1436b65..864567a 100644
--- a/lib/apply-extends.js
+++ b/lib/apply-extends.js
@@ -19,7 +19,7 @@ function getPathToDefaultConfig (cwd, pathToExtend) {
 function applyExtends (config, cwd) {
   let defaultConfig = {}
 
-  if (config.hasOwnProperty('extends')) {
+  if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
     if (typeof config.extends !== 'string') return defaultConfig
     const isPath = /\.json|\..*rc$/.test(config.extends)
     let pathToDefault = null
diff --git a/lib/decamelize.js b/lib/decamelize.js
deleted file mode 100644
index c3a4151..0000000
--- a/lib/decamelize.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-MIT License
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-'use strict'
-
-module.exports = (text, separator) => {
-  separator = typeof separator === 'undefined' ? '_' : separator
-
-  return text
-    .replace(/([a-z\d])([A-Z])/g, `$1${separator}$2`)
-    .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, `$1${separator}$2`)
-    .toLowerCase()
-}
diff --git a/lib/usage.js b/lib/usage.js
index 8c3b068..cbcb176 100644
--- a/lib/usage.js
+++ b/lib/usage.js
@@ -1,7 +1,7 @@
 'use strict'
 // this file handles outputting usage instructions,
 // failures, etc. keeps logging in one place.
-const decamelize = require('./decamelize')
+const decamelize = require('decamelize')
 const stringWidth = require('string-width')
 const objFilter = require('./obj-filter')
 const path = require('path')
diff --git a/package.json b/package.json
index 436c04b..f8f06cf 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
   ],
   "dependencies": {
     "cliui": "^5.0.0",
+    "decamelize": "^1.2.0",
     "find-up": "^3.0.0",
     "get-caller-file": "^2.0.1",
     "require-directory": "^2.1.1",


Test patch:
diff --git a/test/yargs.js b/test/yargs.js
index 66c5bf8..e64802e 100644
--- a/test/yargs.js
+++ b/test/yargs.js
@@ -1292,6 +1292,20 @@ describe('yargs dsl tests', () => {
         argv.z.should.equal(15)
       })
 
+      it('tolerates null prototype config objects', () => {
+        const argv = yargs
+          .config({
+            __proto__: null,
+            a: 2,
+            extends: './test/fixtures/extends/config_1.json'
+          })
+          .parse()
+
+        argv.a.should.equal(2)
+        argv.b.should.equal(22)
+        argv.z.should.equal(15)
+      })
+
       // see: https://www.npmjs.com/package/yargs-test-extends
       it('allows a module to be extended, rather than a JSON file', () => {
         const argv = yargs()