A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
Object.getOwnPropertyDescriptors = function getOwnPropertyDescriptors(obj) { | |
var descriptors = {}; | |
for (var prop in obj) { | |
if (obj.hasOwnProperty(prop)) { | |
descriptors[prop] = Object.getOwnPropertyDescriptor(obj, prop); | |
} | |
} | |
return descriptors; | |
}; |
/** | |
* I couldn't find a super simple example of how to run Karma, PhantomJs, with | |
* Jasmine tests via npm, so eventually I decided to create my own. Maybe | |
* someone will find it useful. | |
* | |
* | |
* Installation (using npm): | |
* | |
* npm install -g karma-cli | |
* npm install -g karma --save-dev |
type FrameScope = { | |
[key:string]: mixed | |
}; | |
type StackFrame = { | |
name?: string, | |
fileName?: string, | |
lineNumber?: number, | |
columnNumber?: number, | |
scope?: FrameScope | |
}; |
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments: