This file contains 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() { | |
// Do not use this library. This is just a fun example to prove a | |
// point. | |
var Bloop = window.Bloop = {}; | |
var mountId = 0; | |
function newMountId() { | |
return mountId++; | |
} |
This file contains 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 dom = Bloop.dom; | |
var Box = Bloop.createClass({ | |
getInitialState: function() { | |
return { number: 0 }; | |
}, | |
updateNumber: function() { | |
this.state.number++; | |
}, |
This file contains 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
/** | |
* Creates a RegExp from the given string, converting asterisks to .* expressions, | |
* and escaping all other characters. | |
*/ | |
function wildcardToRegExp (s) { | |
return new RegExp('^' + s.split(/\*+/).map(regExpEscape).join('.*') + '$'); | |
} | |
/** | |
* RegExp-escapes all characters in the given string. |