From 617b4f1ef682cc7c3d7022b30cc3f7e37db62627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Wed, 8 Jul 2015 17:05:17 -0700 Subject: [PATCH] style(all): Convert to es6 + standard Code is functionally equivalent, but source has been moved to es6/es2015 style, including es6 modules. babel is now used for compiling. BREAKING CHANGE: UMD output is no longer pre-generated build/genfun.js and company are gone. Instead, CommonJS output is generated from the ES6 sources and output to dist/, mirroring the src/ tree. The files are separate, instead of concatenated. --- .gitignore | 2 +- jshint.conf.json | 17 --- package.json | 47 ++---- src/genfun.js | 366 +++++++++++++++++++++++------------------------ src/method.js | 71 ++++----- src/role.js | 13 +- src/util.js | 23 ++- test/genfun.js | 6 +- 8 files changed, 237 insertions(+), 308 deletions(-) delete mode 100644 jshint.conf.json diff --git a/.gitignore b/.gitignore index 2d1f21b..061319e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *~ node_modules/ -build/ +dist/ docs/ diff --git a/jshint.conf.json b/jshint.conf.json deleted file mode 100644 index 504b2d1..0000000 --- a/jshint.conf.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "undef": true, - "unused": true, - "globalstrict": true, - "node": true, - "maxlen": 80, - "trailing": true, - "quotmark": true, - "newcap": true, - "indent": 2, - "immed": true, - "forin": true, - "eqeqeq": true, - "curly": false, - "camelcase": false, // eventually should be true - "es3": false // Eventually should be true -} diff --git a/package.json b/package.json index f3ef05e..c379325 100644 --- a/package.json +++ b/package.json @@ -3,20 +3,20 @@ "description": "Prototype-friendly multiple method dispatch for JS.", "homepage": "http://github.com/zkat/genfun.js", "keywords": [ - "util", - "functional", - "server", - "client", "browser", + "client", "clos", - "oop" + "functional", + "oop", + "server", + "util" ], "author": "Kat Marchán ", "repository": { "type": "git", "url": "git://github.com/zkat/genfun.js" }, - "main": "src/genfun.js", + "main": "dist/genfun.js", "version": "0.1.3", "licenses": [ { @@ -27,41 +27,22 @@ "files": [ "Makefile", "README.md", - "src/*.js", "build/", "docs/", + "src/*.js", "test/*.js" ], "devDependencies": { - "browserify": "~2.28.0", - "uglify-js": "~2.3.6", + "babel": "^5.6.14", "jsdoc": "~3.2.0", - "jshint": "~2.1.10", - "mocha": "~1.12.0" + "mocha": "~1.12.0", + "semantic-release": "^3.3.2", + "standard": "^4.5.2" }, "readmeFilename": "README.md", "scripts": { - "prepublish": "make", - "test": "make test" - }, - "testling": { - "browsers": [ - "iexplore/7.0", - "iexplore/8.0", - "iexplore/9.0", - "iexplore/10.0", - "chrome/25.0", - "firefox/19.0", - "opera/12.0", - "firefox/nightly", - "opera/next", - "chrome/canary", - "iphone/6.0", - "ipad/6.0", - "safari/6.0", - "android-browser/4.2" - ], - "harness": "mocha", - "files": "test/*.js" + "build": "babel src --out-dir dist --source-map", + "prepublish": "npm run build", + "test": "npm run build && standard src/*.js && mocha" } } diff --git a/src/genfun.js b/src/genfun.js index 9601d18..0ae6b5d 100644 --- a/src/genfun.js +++ b/src/genfun.js @@ -1,9 +1,6 @@ -/* -*- js2-basic-offset: 2; indent-tabs-mode: nil; -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80; */ -"use strict"; -var Method = require("./method"), - Role = require("./role"), - util = require("./util"); +import Method from './method' +import Role from './role' +import * as util from './util' /** * Creates generic functions capable of multiple dispatch across several @@ -15,30 +12,32 @@ var Method = require("./method"), * @param {object} [opts] - Options used when initializing the genfun. * @returns {function} New generic function. */ -function Genfun() { - var genfun = this; - genfun.methods = []; - genfun.cache = {key: [], methods: [], state: Genfun.UNINITIALIZED}; - var fun = function() { - return apply_genfun(genfun, this, arguments); - }; - fun.genfun = genfun; - fun.addMethod = function(selector, func) { - return Genfun.addMethod(genfun, selector, func); - }; - fun.removeMethod = function(selector, func) { - return Genfun.removeMethod(genfun, selector, func); - }; - genfun._wrapper_function = fun; - return fun; +export default function Genfun () { + var genfun = this + genfun.methods = [] + genfun.cache = {key: [], methods: [], state: Genfun.UNINITIALIZED} + var fun = function () { + return applyGenfun(genfun, this, arguments) + } + fun.genfun = genfun + fun.addMethod = (selector, func) => { + return Genfun.addMethod(genfun, selector, func) + } + fun.removeMethod = (selector, func) => { + return Genfun.removeMethod(genfun, selector, func) + } + genfun._wrapperFunction = fun + return fun } -Genfun.UNITIALIZED = 0; -Genfun.MONOMORPHIC = 1; -Genfun.POLYMORPHIC = 2; -Genfun.MEGAMORPHIC = 3; +const STATES = { + UNINITIALIZED: 0, + MONOMORPHIC: 1, + POLYMORPHIC: 2, + MEGAMORPHIC: 3 +} -Genfun.MAX_CACHE_SIZE = 32; // Can't inline, so the cache needs to be bigger. +Genfun.MAX_CACHE_SIZE = 32 // Can't inline, so the cache needs to be bigger. /** * Defines a method on a generic function. @@ -49,30 +48,29 @@ Genfun.MAX_CACHE_SIZE = 32; // Can't inline, so the cache needs to be bigger. * @param {Function} methodFunction - Function to execute when the method * successfully dispatches. */ -Genfun.addMethod = function(genfun, selector, func) { - genfun = typeof genfun === "function" && +Genfun.addMethod = (genfun, selector, func) => { + genfun = typeof genfun === 'function' && genfun.genfun && genfun.genfun instanceof Genfun ? - genfun.genfun : genfun; + genfun.genfun : genfun if (selector.length) { - selector = [].slice.call(selector); + selector = [].slice.call(selector) for (var i = 0; i < selector.length; i++) { if (!selector.hasOwnProperty(i)) { - selector[i] = Object.prototype; + selector[i] = Object.prototype } } - var method = new Method(genfun, selector, func); - genfun.methods.push(method); - genfun.cache = {key: [], methods: [], state: Genfun.UNINITIALIZED}; - return method; + let method = new Method(genfun, selector, func) + genfun.methods.push(method) + genfun.cache = {key: [], methods: [], state: STATES.UNINITIALIZED} + return method } else { return Genfun.addMethod( Genfun.noApplicableMethod, - [genfun._wrapper_function], function(_gf, newthis, args) { - return func.apply(newthis, args); - }); + [genfun._wrapperFunction], + (_gf, newthis, args) => func.apply(newthis, args)) } -}; +} /** * Removes a previously-defined method on `genfun` that matches @@ -83,9 +81,9 @@ Genfun.addMethod = function(genfun, selector, func) { * @param {Array-like} selector - Objects to match on when finding a * method to remove. */ -Genfun.removeMethod = function() { - throw new Error("not yet implemented"); -}; +Genfun.removeMethod = () => { + throw new Error('not yet implemented') +} /** * This generic function is called when `genfun` has been called and no @@ -96,194 +94,189 @@ Genfun.removeMethod = function() { * @param {*} newthis - value of `this` the genfun was called with. * @param {Array} callArgs - Arguments the genfun was called with. */ -Genfun.noApplicableMethod = new Genfun(); -Genfun.addMethod(Genfun.noApplicableMethod, [], function(gf, thisArg, args) { - var msg = - "No applicable method found when called with arguments of types: (" + - [].map.call(args, function(arg) { - return (/\[object ([a-zA-Z0-9]+)\]/).exec(({}).toString.call(arg))[1]; - }).join(", ") + ")", - err = new Error(msg); - err.genfun = gf; - err.thisArg = thisArg; - err.args = args; - throw err; -}); +Genfun.noApplicableMethod = new Genfun() +Genfun.addMethod(Genfun.noApplicableMethod, [], (gf, thisArg, args) => { + let msg = + 'No applicable method found when called with arguments of types: (' + + [].map.call(args, (arg) => { + return (/\[object ([a-zA-Z0-9]+)\]/) + .exec(({}).toString.call(arg))[1] + }).join(', ') + ')' + let err = new Error(msg) + err.genfun = gf + err.thisArg = thisArg + err.args = args + throw err +}) -var _current_applicable_methods, - _current_this, - _current_args; -function hasNextMethod() { - if (typeof _current_applicable_methods === "undefined") { - throw new Error("hasNextMethod and callNextMethod must "+ - "be called inside a Genfun method."); +let _currentApplicableMethods +let _currentThis +let _currentArgs +Genfun.hasNextMethod = () => { + if (!_currentApplicableMethods) { + throw new Error('hasNextMethod and callNextMethod must ' + + 'be called inside a Genfun method.') } else { - return !!_current_applicable_methods.length; + return !!_currentApplicableMethods.length } } -Genfun.hasNextMethod = hasNextMethod; -function callNextMethod() { - if (hasNextMethod()) { - _current_args = arguments.length ? arguments : _current_args; - _current_applicable_methods = [].slice.call(_current_applicable_methods, 1); - return _current_applicable_methods[0].func.apply( - _current_this, _current_args); +Genfun.callNextMethod = (...args) => { + if (Genfun.hasNextMethod()) { + _currentArgs = args.length ? args : _currentArgs + _currentApplicableMethods = [].slice.call(_currentApplicableMethods, 1) + return _currentApplicableMethods[0].func.apply(_currentThis, _currentArgs) } else { - return noNextMethod(); + return Genfun.noNextMethod() } } -Genfun.callNextMethod = callNextMethod; -function noNextMethod() { - throw new Error("No next method available"); +Genfun.noNextMethod = () => { + throw new Error('No next method available') } -Genfun.noNextMethod = noNextMethod; /* * Internal */ -function apply_genfun(genfun, newthis, args) { - var applicable_methods = get_applicable_methods(genfun, args), - ret, tmp_current_methods, tmp_this, tmp_args; - if (applicable_methods.length) { - tmp_current_methods = _current_applicable_methods; - tmp_this = _current_this; - tmp_args = _current_args; - _current_applicable_methods = applicable_methods; - _current_this = newthis; - _current_args = args; - ret = applicable_methods[0].func.apply(newthis, args); - _current_applicable_methods = tmp_current_methods; - _current_this = tmp_this; - _current_args = tmp_args; - return ret; +function applyGenfun (genfun, newthis, args) { + let applicableMethods = getApplicableMethods(genfun, args) + let ret, tmpCurrentMethods, tmpThis, tmpArgs + if (applicableMethods.length) { + tmpCurrentMethods = _currentApplicableMethods + tmpThis = _currentThis + tmpArgs = _currentArgs + _currentApplicableMethods = applicableMethods + _currentThis = newthis + _currentArgs = args + ret = applicableMethods[0].func.apply(newthis, args) + _currentApplicableMethods = tmpCurrentMethods + _currentThis = tmpThis + _currentArgs = tmpArgs + return ret } else { - return Genfun.noApplicableMethod(genfun._wrapper_function, newthis, args); + return Genfun.noApplicableMethod(genfun._wrapperFunction, newthis, args) } } -function get_applicable_methods(genfun, args) { - var applicable_methods; - var maybe_methods = cached_methods(genfun, args); - if (maybe_methods) { - applicable_methods = maybe_methods; +function getApplicableMethods (genfun, args) { + let applicableMethods + let maybeMethods = cachedMethods(genfun, args) + if (maybeMethods) { + applicableMethods = maybeMethods } else { - applicable_methods = compute_applicable_methods(genfun, args); - cache_args(genfun, args, applicable_methods); + applicableMethods = computeApplicableMethods(genfun, args) + cacheArgs(genfun, args, applicableMethods) } - return applicable_methods; + return applicableMethods } -function cache_args(genfun, args, methods) { - if (genfun.cache.state === Genfun.MEGAMORPHIC) return; - var key = []; - var proto; +function cacheArgs (genfun, args, methods) { + if (genfun.cache.state === STATES.MEGAMORPHIC) { return } + var key = [] + var proto for (var i = 0; i < args.length; i++) { - proto = cacheable_proto(genfun, args[i]); + proto = cacheableProto(genfun, args[i]) if (proto) { - key[i] = proto; + key[i] = proto } else { - return; + return null } } - genfun.cache.key.unshift(key); - genfun.cache.methods.unshift(methods); + genfun.cache.key.unshift(key) + genfun.cache.methods.unshift(methods) if (genfun.cache.key.length === 1) { - genfun.cache.state = Genfun.MONOMORPHIC; + genfun.cache.state = STATES.MONOMORPHIC } else if (genfun.cache.key.length < Genfun.MAX_CACHE_SIZE) { - genfun.cache.state = Genfun.POLYMORPHIC; + genfun.cache.state = STATES.POLYMORPHIC } else { - genfun.cache.state = Genfun.MEGAMORPHIC; + genfun.cache.state = STATES.MEGAMORPHIC } } -function cacheable_proto(genfun, arg) { - var dispatchable = dispatchable_object(arg); - if (Object.hasOwnProperty.call(dispatchable, Role.role_key_name)) { - for (var j = 0; j < dispatchable[Role.role_key_name].length; j++) { - var role = dispatchable[Role.role_key_name][j]; +function cacheableProto (genfun, arg) { + var dispatchable = dispatchableObject(arg) + if (Object.hasOwnProperty.call(dispatchable, Role.roleKeyName)) { + for (var j = 0; j < dispatchable[Role.roleKeyName].length; j++) { + var role = dispatchable[Role.roleKeyName][j] if (role.method.genfun === genfun) { - return undefined; + return null } } } - return Object.getPrototypeOf(dispatchable); + return Object.getPrototypeOf(dispatchable) } -function cached_methods(genfun, args) { - if (genfun.cache.state === Genfun.UNINITIALIZED || - genfun.cache.state === Genfun.MEGAMORPHIC) return; - var protos = []; - var proto; +function cachedMethods (genfun, args) { + if (genfun.cache.state === STATES.UNINITIALIZED || + genfun.cache.state === STATES.MEGAMORPHIC) { + return null + } + var protos = [] + var proto for (var i = 0; i < args.length; i++) { - proto = cacheable_proto(genfun, args[i]); + proto = cacheableProto(genfun, args[i]) if (proto) { - protos[i] = proto; + protos[i] = proto } else { - return; + return } } for (i = 0; i < genfun.cache.key.length; i++) { - if (match_cached_methods(genfun.cache.key[i], protos)) { - return genfun.cache.methods[i]; + if (matchCachedMethods(genfun.cache.key[i], protos)) { + return genfun.cache.methods[i] } } } -function match_cached_methods(key, protos) { - if (key.length !== protos.length) return false; +function matchCachedMethods (key, protos) { + if (key.length !== protos.length) { return false } for (var i = 0; i < key.length; i++) { if (key[i] !== protos[i]) { - return false; + return false } } - return true; + return true } -function compute_applicable_methods(genfun, args) { - args = [].slice.call(args); - var discovered_methods = []; - function find_and_rank_roles(object, hierarchy_position, index) { - var roles = Object.hasOwnProperty.call(object, Role.role_key_name) ? - object[Role.role_key_name] : - []; - roles.forEach(function(role) { +function computeApplicableMethods (genfun, args) { + args = [].slice.call(args) + let discoveredMethods = [] + function findAndRankRoles (object, hierarchyPosition, index) { + var roles = Object.hasOwnProperty.call(object, Role.roleKeyName) ? + object[Role.roleKeyName] : + [] + roles.forEach(role => { if (role.method.genfun === genfun && index === role.position) { - if (discovered_methods.indexOf(role.method) < 0) { - Method.clear_rank(role.method); - discovered_methods.push(role.method); + if (discoveredMethods.indexOf(role.method) < 0) { + Method.clearRank(role.method) + discoveredMethods.push(role.method) } - Method.set_rank_hierarchy_position( - role.method, index, hierarchy_position); + Method.setRankHierarchyPosition(role.method, index, hierarchyPosition) } - }); + }) // When a discovered method would receive more arguments than // were specialized, we pretend all extra arguments have a role // on Object.prototype. - if (util.is_object_proto(object)) { - discovered_methods.forEach(function(method) { - if (method.minimal_selector <= index) { - Method.set_rank_hierarchy_position( - method, index, hierarchy_position); + if (util.isObjectProto(object)) { + discoveredMethods.forEach(method => { + if (method.minimalSelector <= index) { + Method.setRankHierarchyPosition(method, index, hierarchyPosition) } - }); + }) } } - args.forEach(function(arg, index) { - get_precedence_list(dispatchable_object(arg)) - .forEach(function(obj, hierarchy_position) { - find_and_rank_roles(obj, hierarchy_position, index); - }); - }); - var applicable_methods = discovered_methods.filter(function(method) { + args.forEach((arg, index) => { + getPrecedenceList(dispatchableObject(arg)) + .forEach((obj, hierarchyPosition) => { + findAndRankRoles(obj, hierarchyPosition, index) + }) + }) + let applicableMethods = discoveredMethods.filter(method => { return (args.length === method._rank.length && - Method.is_fully_specified(method)); - }); - applicable_methods.sort(function(a, b) { - return Method.score(a) - Method.score(b); - }); - return applicable_methods; + Method.isFullySpecified(method)) + }) + applicableMethods.sort((a, b) => Method.score(a) - Method.score(b)) + return applicableMethods } /* @@ -291,38 +284,31 @@ function compute_applicable_methods(genfun, args) { * inheritance/precedence chain for an object by navigating its * prototype pointers. */ -function get_precedence_list(obj) { - var precedence_list = []; - var next_obj = obj; - while(next_obj) { - precedence_list.push(next_obj); - next_obj = Object.getPrototypeOf(next_obj); +function getPrecedenceList (obj) { + var precedenceList = [] + var nextObj = obj + while (nextObj) { + precedenceList.push(nextObj) + nextObj = Object.getPrototypeOf(nextObj) } - return precedence_list; + return precedenceList } /* * Returns a useful dispatch object for value using a process similar to * the ToObject operation specified in http://es5.github.com/#x9.9 */ -function dispatchable_object(value) { +function dispatchableObject (value) { // To shut up jshint, which doesn't let me turn off this warning. - var Bool = Boolean, - Num = Number, - Str = String, - Obj = Object; + const Bool = Boolean + const Num = Number + const Str = String + const Obj = Object switch (typeof value) { - case "object": - return value; - case "boolean": - return new Bool(value); - case "number": - return new Num(value); - case "string": - return new Str(value); - default: - return new Obj(value); + case 'object': return value + case 'boolean': return new Bool(value) + case 'number': return new Num(value) + case 'string': return new Str(value) + default: return new Obj(value) } } - -module.exports = Genfun; diff --git a/src/method.js b/src/method.js index 9a60c84..86d75ef 100644 --- a/src/method.js +++ b/src/method.js @@ -1,5 +1,3 @@ -/* -*- js2-basic-offset: 2; indent-tabs-mode: nil; -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80; */ /* * Method * @@ -16,73 +14,66 @@ * sake of ordering. * */ -"use strict"; -var Role = require("./role"), - util = require("./util"); +import Role from './role' +import * as util from './util' -function Method(genfun, selector, func) { - var method = this; - method.genfun = genfun; - method.func = func; - method._rank = []; - method.minimal_selector = 0; +export default function Method (genfun, selector, func) { + var method = this + method.genfun = genfun + method.func = func + method._rank = [] + method.minimalSelector = 0 // TODO: The following is false in Firefox: // console.log(window.objproto == Object.prototype); - var tmp_selector = selector.length?selector:[Object.prototype]; - for (var object, i = tmp_selector.length - 1; i >= 0; i--) { - object = Object.hasOwnProperty.call(tmp_selector, i) ? - tmp_selector[i] : - Object.prototype; + const tmpSelector = selector.length ? selector : [Object.prototype] + for (var object, i = tmpSelector.length - 1; i >= 0; i--) { + object = Object.hasOwnProperty.call(tmpSelector, i) ? + tmpSelector[i] : + Object.prototype if (i > 0 && - !method.minimal_selector && - util.is_object_proto(object)) { - continue; + !method.minimalSelector && + util.isObjectProto(object)) { + continue } else { - method.minimal_selector++; - if (!Object.hasOwnProperty.call(object, Role.role_key_name)) { + method.minimalSelector++ + if (!Object.hasOwnProperty.call(object, Role.roleKeyName)) { if (Object.defineProperty) { // Object.defineProperty is JS 1.8.0+ Object.defineProperty( - object, Role.role_key_name, {value: [], enumerable: false}); + object, Role.roleKeyName, {value: [], enumerable: false}) } else { - object[Role.role_key_name] = []; + object[Role.roleKeyName] = [] } } // XXX HACK - no method replacement now, so we just shove // it in a place where it'll always show up first. This // would probably seriously break method combination if we // had it. - object[Role.role_key_name].unshift(new Role(method, i)); + object[Role.roleKeyName].unshift(new Role(method, i)) } } } -function set_rank_hierarchy_position(method, index, hierarchy_position) { - method._rank[index] = hierarchy_position; +Method.setRankHierarchyPosition = (method, index, hierarchyPosition) => { + method._rank[index] = hierarchyPosition } -Method.set_rank_hierarchy_position = set_rank_hierarchy_position; -function clear_rank(method) { - method._rank = []; +Method.clearRank = method => { + method._rank = [] } -Method.clear_rank = clear_rank; -function is_fully_specified(method) { - for (var i = 0; i < method.minimal_selector; i++) { +Method.isFullySpecified = method => { + for (var i = 0; i < method.minimalSelector; i++) { if (!method._rank.hasOwnProperty(i)) { - return false; + return false } } - return true; + return true } -Method.is_fully_specified = is_fully_specified; -function score(method) { +Method.score = method => { // TODO - this makes all items in the list equal - return method._rank.reduce(function(a, b) { return a + b; }, 0); + return method._rank.reduce((a, b) => a + b, 0) } -Method.score = score; - -module.exports = Method; diff --git a/src/role.js b/src/role.js index 8ec1123..b0b5c3c 100644 --- a/src/role.js +++ b/src/role.js @@ -1,7 +1,3 @@ -/* -*- js2-basic-offset: 2; indent-tabs-mode: nil; -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80; */ -"use strict"; - /* * Role * @@ -10,10 +6,9 @@ * do not prevent the objects a method was defined on from being garbage * collected. */ -function Role(method, position) { - this.method = method; - this.position = position; +export default function Role (method, position) { + this.method = method + this.position = position } -Role.role_key_name = "__" + Math.random().toString(36).substr(2) + "_roles__"; -module.exports = Role; +Role.roleKeyName = Symbol('roles') diff --git a/src/util.js b/src/util.js index 43a1140..9a7eaa0 100644 --- a/src/util.js +++ b/src/util.js @@ -1,25 +1,20 @@ -/* -*- js2-basic-offset: 2; indent-tabs-mode: nil; -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80; */ -"use strict"; - /* * XXX HACK Firefox gives weird errors where the global * Object.prototype !== the one inside this closure, so we tag it * here and use that for comparisons. */ -var prototest_key_name = - "__" + Math.random().toString(36).substr(2) + "_is_object_proto__", - hasDefineProperty = !!Object.defineProperty; +const prototestKeyName = Symbol('isObjectProto') +const hasDefineProperty = !!Object.defineProperty if (hasDefineProperty) { + var objproto = Object.prototype Object.defineProperty( - Object.prototype, - prototest_key_name, - {value: true, enumerable: false}); + objproto, + prototestKeyName, + {value: true, enumerable: false}) } -function is_object_proto(obj) { + +export function isObjectProto (obj) { return !hasDefineProperty || - Object.hasOwnProperty.call(obj, prototest_key_name); + Object.hasOwnProperty.call(obj, prototestKeyName) } - -exports.is_object_proto = is_object_proto; diff --git a/test/genfun.js b/test/genfun.js index 025be4a..7c4b4e1 100644 --- a/test/genfun.js +++ b/test/genfun.js @@ -1,8 +1,6 @@ -/* -*- js-indent-level: 2; js2-basic-offset: 2; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80; */ "use strict"; var assert = require("assert"); -var Genfun = require("../src/genfun"); +var Genfun = require("../dist/genfun"); describe("Genfun", function() { @@ -361,7 +359,7 @@ describe("Genfun", function() { }); }); }); - + describe("addMethod", function() { it("defines a new method on the genfun"); it("is accessible as a method on genfuns", function() {