state
Version:
First-class states
49 lines (41 loc) • 1.18 kB
JavaScript
// Generated by CoffeeScript 1.6.3
(function() {
var RootState, StateExpression, state;
RootState = null;
StateExpression = null;
module.exports = state = function(owner, attributes, expression, options) {
var initial, name;
if (arguments.length < 2) {
if (typeof owner === 'string') {
attributes = owner;
} else {
expression = owner;
}
owner = void 0;
} else {
if (typeof owner === 'string') {
options = expression;
expression = attributes;
attributes = owner;
owner = void 0;
}
if (typeof attributes !== 'string') {
options = expression;
expression = attributes;
attributes = void 0;
}
}
expression = new StateExpression(attributes, expression);
if (owner) {
if (options) {
name = options.name, initial = options.initial;
}
return (new RootState(owner, expression, name, initial))._current;
} else {
return expression;
}
};
(require('./export-static')).apply(state);
RootState = require('./root-state');
StateExpression = require('./state-expression');
}).call(this);