Skip to content

Commit

Permalink
Add isGenerator function
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Wimmer committed Sep 24, 2016
1 parent 79d9b59 commit 41c4614
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tmjs-core",
"version": "1.0.0-alpha.2",
"version": "1.0.0-beta.1",
"description": "TM.js Core is used in all TM.js modules",
"main": "build/tmjs-core.js",
"scripts": {
Expand Down
19 changes: 12 additions & 7 deletions tmjs-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ g.tmjs = g.tmjs || {};

g.tmjs.__defineGetter__("core", () => "${version}");

g.tmjs.module = (name, version, getter) =>
g.tmjs.__defineGetter__(name, () =>
{
let module = getter(g.tmjs);
module.__defineGetter__("version", () => version);
return module;
});
Object.assign(g.tmjs, {
module: (name, version, getter) =>
g.tmjs.__defineGetter__(name, () =>
{
let module = getter(g.tmjs);
module.__defineGetter__("version", () => version);
return module;
}),

isGenerator: generator =>
generator instanceof (function *() {}).constructor
});

0 comments on commit 41c4614

Please sign in to comment.