Permalink
Browse files

Prevent slice / concat, rather use .push for arguments in shell methods.

Also don't use prime.define, it can simply use this[key] = method directly.
  • Loading branch information...
1 parent f7567fa commit 12f7f847cdf7a3f1cfc4a1f17f59e00c289dd1c0 @arian committed Mar 2, 2013
Showing with 8 additions and 8 deletions.
  1. +8 −8 shell.js
View
@@ -62,19 +62,19 @@ var register = function(){
type.implementGenerics = function(methods){
prime.each(methods, function(method, key){
- prime.define(this, key, {
- writable: true,
- enumerable: true,
- configurable: true,
- value: method
- })
+ this[key] = method
this.prototype[key] = function(){
- return arguments.length ? method.apply(this, [this].concat(slice.call(arguments))) : method.call(this, this)
+ if (!arguments.length) return method.call(this, this)
+ var args = [this]
+ args.push.apply(args, arguments)
+ return method.apply(this, args)
}
g.prototype[key] = function(){
- return shell(method.apply(this, [this.valueOf()].concat(slice.call(arguments))))
+ var args = [this.valueOf()]
+ args.push.apply(args, arguments)
+ return shell(method.apply(this, args))
}
}, this)
return this

0 comments on commit 12f7f84

Please sign in to comment.