This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default getFunctionArguments | |
| var COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg | |
| var ARGUMENTS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m | |
| var COMMA = /,/ | |
| /* | |
| * @param {Function} fn | |
| * @return {Array<String>} | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default lazy | |
| import defer from 'defer' | |
| /** | |
| * @param {Function} fn | |
| * @return {Function} | |
| **/ | |
| function lazy (fn) { | |
| return function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import inherit from 'inherit'; | |
| export default CallbackWorker; | |
| var inherit = function(a, b){ | |
| var fn = function(){}; | |
| fn.prototype = b.prototype; | |
| a.prototype = new fn; | |
| a.prototype.constructor = a; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Emitter from 'emitter'; | |
| import configurable from 'configurable'; | |
| import analyzer from './analyzer.js'; | |
| var DEFAULT_OPTIONS = { | |
| interval: 0, | |
| threshold: 0 | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function startMeasure () { | |
| var start = Date.now() | |
| return function stopMeasure () { | |
| return Date.now() - start | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cast from 'cast' | |
| /** | |
| * @param {*} values | |
| * @return {Promise} | |
| * @resolve {*} | |
| * @reject {Error} | |
| **/ | |
| export default function all (values) { | |
| return new Promise(function (resolve, reject) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| trait Accessible { | |
| public function __get ($name) { | |
| $getter = 'get' . ucfirst($name); | |
| if (method_exists($this, $getter)) { | |
| return $this->$getter(); | |
| } else if (property_exists($this, $name)) { | |
| return $this->$name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Todo from 'model' | |
| import TodoView from 'view' | |
| let firstThing = new Todo("write better specs") | |
| let secondThing = new Todo("drink a ''pac à l'eau''") | |
| let firstThingView = new TodoView(firstThing) | |
| let secondThingView = new TodoView(secondThing) | |
| document.body.appendChild(firstThingView) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scriptToWorker from 'script-to-worker' | |
| export default function functionToWorker (fn) { | |
| return scriptToWorker('(' + fn.toString() + ')()') | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import objectUrl from 'object-url' | |
| export default function scriptToWorker (script) { | |
| var blob = new Blob([script], {type: 'application/javascript'}) | |
| var url = objectUrl.create(blob) | |
| var worker = new Worker(url) | |
| objectUrl.revoke(url) | |
| return worker | |
| } |