diff --git a/lib/nopt.js b/lib/nopt.js index 97707e7..94a983c 100644 --- a/lib/nopt.js +++ b/lib/nopt.js @@ -246,12 +246,12 @@ function parse (args, data, remain, types, shorthands) { } var hadEq = false if (arg.charAt(0) === "-" && arg.length > 1) { - if (arg.indexOf("=") !== -1) { + var at = arg.indexOf('=') + if (at > -1) { hadEq = true - var v = arg.split("=") - arg = v.shift() - v = v.join("=") - args.splice.apply(args, [i, 1].concat([arg, v])) + var v = arg.substr(at + 1) + arg = arg.substr(0, at) + args.splice(i, 1, arg, v) } // see if it's a shorthand