+9
-8
@@ -136,2 +136,10 @@ "use strict"; | ||
| // Create method shortcuts form functions. | ||
| var defineMethod = function defineMethod(Type, lambda) { | ||
| return define(this, Type, lambda) | ||
| } | ||
| var implementMethod = function implementMethod(object, lambda) { | ||
| return implement(this, object, lambda) | ||
| } | ||
| // Define `implement` and `define` polymorphic methods to allow definitions | ||
@@ -206,10 +214,2 @@ // and implementations through them. | ||
| // Create method shortcuts form functions. | ||
| var defineMethod = function defineMethod(Type, lambda) { | ||
| return _define(this, Type, lambda) | ||
| } | ||
| var implementMethod = function implementMethod(object, lambda) { | ||
| return _implement(this, object, lambda) | ||
| } | ||
| // And provided implementations for a polymorphic equivalents. | ||
@@ -223,2 +223,3 @@ _define(define, _define) | ||
| Method.Method = Method | ||
| Method.method = Method | ||
| Method.builtin = builtin | ||
@@ -225,0 +226,0 @@ Method.host = host |
+5
-0
| # Changes | ||
| ## 1.0.2 / 2012-12-26 | ||
| - Delegate to polymorphic methods from `.define` and `.implement` so, they | ||
| can be overidden. | ||
| ## 1.0.1 / 2012-11-11 | ||
@@ -4,0 +9,0 @@ |
+2
-2
| { | ||
| "name": "method", | ||
| "id": "method", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Functional polymorphic method dispatch", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
| "test": "~0.x.0", | ||
| "repl-utils": "~1.0.0", | ||
| "repl-utils": "~2.0.1", | ||
| "phantomify": "~0.1.0" | ||
@@ -29,0 +29,0 @@ }, |
+34
-0
@@ -238,2 +238,36 @@ "use strict"; | ||
| exports["test override define polymorphic method"] = function(assert) { | ||
| var define = Method.define | ||
| var implement = Method.implement | ||
| var fn = Method("fn") | ||
| var methods = {} | ||
| implement(define, fn, function(method, label, implementation) { | ||
| methods[label] = implementation | ||
| }) | ||
| function foo() {} | ||
| define(fn, "foo-case", foo) | ||
| assert.equal(methods["foo-case"], foo, "define set property") | ||
| } | ||
| exports["test override define via method API"] = function(assert) { | ||
| var define = Method.define | ||
| var implement = Method.implement | ||
| var fn = Method("fn") | ||
| var methods = {} | ||
| define.implement(fn, function(method, label, implementation) { | ||
| methods[label] = implementation | ||
| }) | ||
| function foo() {} | ||
| define(fn, "foo-case", foo) | ||
| assert.equal(methods["foo-case"], foo, "define set property") | ||
| } | ||
| require("test").run(exports) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1266243
1.41%417
6.38%