Comparing version 0.1.5 to 0.1.6
@@ -49,2 +49,6 @@ (function(e, a) { for(var i in a) e[i] = a[i]; }(this, /******/ (function(modules) { // webpackBootstrap | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _nflow = __webpack_require__(1); | ||
@@ -56,4 +60,4 @@ | ||
global.nflow = _nflow2.default; | ||
module.exports = _nflow2.default; | ||
if (global) global.nFlow = _nflow2.default; | ||
exports.default = _nflow2.default; | ||
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) | ||
@@ -65,3 +69,3 @@ | ||
/* WEBPACK VAR INJECTION */(function(global) {'use strict'; | ||
'use strict'; | ||
@@ -86,5 +90,3 @@ Object.defineProperty(exports, "__esModule", { | ||
_logger2.default.init(root); | ||
global.nflow = root; | ||
exports.default = root; | ||
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) | ||
@@ -113,3 +115,2 @@ /***/ }, | ||
}); | ||
return flow; | ||
@@ -535,5 +536,4 @@ }; | ||
flow.parent = function () { | ||
var parent = arguments.length <= 0 || arguments[0] === undefined ? _consts.UNSET : arguments[0]; | ||
if (parent === _consts.UNSET) return flow.parent.value; | ||
if (!arguments.length) return flow.parent.value; | ||
var parent = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0]; | ||
parent && (0, _utils.assert)(!(0, _utils.isFlow)(parent), _consts.ERRORS.invalidParent, parent); | ||
@@ -562,6 +562,15 @@ var previousParent = flow.parent(); | ||
flow.parents.find = function (matcher) { | ||
return flow.parents().filter(typeof matcher == "string" ? function (f) { | ||
if (matcher == null) return null; | ||
var filter = matcher; | ||
if (typeof matcher == "string") filter = function (f) { | ||
return f.name() == matcher; | ||
} : matcher).pop(); | ||
};else if ((0, _utils.isFlow)(matcher)) filter = function (f) { | ||
return f == matcher; | ||
}; | ||
return flow.parents().filter(filter).pop(); | ||
}; | ||
flow.parents.has = function (matcher) { | ||
return !!flow.parents.find(matcher); | ||
}; | ||
@@ -1018,2 +1027,3 @@ flow.parents.root = function () { | ||
}); | ||
return flow; | ||
}; | ||
@@ -1020,0 +1030,0 @@ }; |
{ | ||
"name": "nflow", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "event/data/control flow", | ||
@@ -5,0 +5,0 @@ "main": "dist/nflow.js", |
@@ -55,4 +55,5 @@ import {assert, detach, dispatchInternalEvent, isFlow} from '../utils' | ||
*/ | ||
flow.parent = (parent=UNSET) => { | ||
if (parent===UNSET) return flow.parent.value; | ||
flow.parent = (...parentArgs) => { | ||
if (!parentArgs.length) return flow.parent.value; | ||
var parent = parentArgs[0] | ||
parent && assert(!isFlow(parent), ERRORS.invalidParent, parent) | ||
@@ -81,8 +82,14 @@ var previousParent = flow.parent() | ||
flow.parents.find = (matcher)=>{ | ||
if (matcher==null) return null | ||
var filter = matcher | ||
if (typeof(matcher)=="string") filter = f=>f.name()==matcher | ||
else if (isFlow(matcher)) filter = f=>f==matcher | ||
return flow.parents() | ||
.filter(typeof(matcher)=="string" | ||
? (f=>f.name()==matcher) | ||
: matcher) | ||
.filter(filter) | ||
.pop() | ||
} | ||
flow.parents.has = (matcher)=>( | ||
!!flow.parents.find(matcher) | ||
) | ||
@@ -89,0 +96,0 @@ flow.parents.root = (...args)=>{ |
@@ -37,4 +37,5 @@ import { DEFAULTS | ||
.forEach(f=>f(flow)) | ||
return flow | ||
} | ||
} |
import * as behaviours from './behaviours' | ||
export default (defaults, name, data)=>{ | ||
@@ -12,4 +10,3 @@ var flow = defaults.factory() | ||
}) | ||
return flow | ||
} |
@@ -1,3 +0,3 @@ | ||
import flow from './nflow' | ||
global.nflow = flow | ||
module.exports = flow | ||
import nFlow from './nflow' | ||
if (global) global.nFlow = nFlow | ||
export default nFlow |
@@ -7,3 +7,2 @@ import factory from './factory' | ||
logger.init(root) | ||
global.nflow = root | ||
export default root |
@@ -10,3 +10,3 @@ | ||
'web-test': './test/web-test.js', | ||
'nflow': './src/' | ||
'nflow': './src/index' | ||
}, | ||
@@ -13,0 +13,0 @@ output: { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2255664
21865