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
| var emptyFunction = () => {} | |
| /** | |
| * creates a new constructor function with `objects` merged in its prototype. | |
| * to prevent unwanted errors when calling `super()` a child class, the | |
| * prototype is actually a proxy returning **or** the actual method, or an | |
| * empty function. | |
| * | |
| * as the proxy gets the same shape as the initial object, the prototype chain | |
| * actually receives the present methods. |
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
| var _id = -1 | |
| var timersMap = new Map() | |
| var Timer = { | |
| /** | |
| * starts executing `func` at every frame from the moment `setTransition` is called | |
| * and during the duration in milliseconds. | |
| * | |
| * the method returns a number `id` which can be used as `clearTransition` parameter |
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
| var DEFAULT_MAX_LISTENERS = 12 | |
| function error(message, ...args){ | |
| console.error.apply(console, [message].concat(args)) | |
| console.trace() | |
| } | |
| class EventEmitter { | |
| constructor(){ | |
| this._maxListeners = DEFAULT_MAX_LISTENERS |
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
| var merge = require("react/lib/merge") | |
| var Store = require("../utils/store") | |
| var AppDispatcher = require("../dispatcher") | |
| var AppConstants = require("../constants") | |
| var ActionTypes = AppConstants.ActionTypes | |
| var API = require("../api") | |
| var _store = { |
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
| function contains(value){ | |
| var self = this | |
| , index = 0, l = self.length | |
| for(;index < l; index++) if(value === self[index]) return true | |
| return false | |
| } | |
| // … | |
| Array.prototype.contains = contains |
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
| var nativeSlice = Array.prototype.slice | |
| var CAN_SLICE_NODELISTS = function(){ | |
| try { | |
| nativeSlice.call(document.documentElement.children) | |
| return true | |
| } catch(e){ | |
| return false | |
| } | |
| }() | |
| var ACCEPTED_NODETYPES = { |
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
| var klass = require("bloody-class") | |
| var myClass = klass.extend({ | |
| get : function(){ | |
| return "deep" | |
| } | |
| }) | |
| .extend({ | |
| get : function(){ | |
| return "shallow" |
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
| var promise = require("bloody-promise") | |
| var log = function(string){ | |
| document.body.appendChild(document.createTextNode(string)) | |
| document.body.appendChild(document.createElement("br")) | |
| } | |
| var mapAsync = function(array, fn){ | |
| var index = -1 | |
| var length = array.length | |
| var promises = [] |
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
| var stream = require("bloody-stream") | |
| var concat = require("bloody-stream/lib/concat") | |
| var escapeRE = /([.*+?^=!:$(){}|[\]\/\\])/g | |
| var mapEscape = function(string){ | |
| return string.replace(escapeRE, "\\$1") | |
| } | |
| var tilde = function(words){ | |
| var wordsRE = RegExp("\\b" + words.map(mapEscape).join("\\b|\\b") + "\\b", "g") | |
| return stream.create(function(chunk){ | |
| if(!wordsRE.test(chunk)) { |
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
| function toUnicode(string) { | |
| var index = -1 | |
| var length = string.length | |
| var chars = [] | |
| var item | |
| while(++index < length) { | |
| item = string.charCodeAt(index).toString(16).toUpperCase() | |
| item = "\\u" + Array(5 - item.length).join("0") + item | |
| chars.push(item) | |
| } |