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 cartesianProduct(sets) { | |
| return sets.reduce(function(items, nextSequence) { | |
| return nextSequence.map(function(element) { | |
| return items.map(function(item) { | |
| var copyItem = item.slice(0); | |
| copyItem.push(element); | |
| return copyItem; | |
| }); | |
| }).reduce(function(sum, current) { | |
| return sum.concat(current); |
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 tknz = typeof require === 'undefined' ? window.tokenizer | |
| : require('./tokenizer'); | |
| var t = tknz.Tokenizer(); | |
| t | |
| .simpleSymbols('=+-*/%<>!.', 'operator') | |
| .simpleSymbols('(', 'op_paren') | |
| .simpleSymbols(')', 'cl_paren') | |
| .simpleSymbols('{', 'op_brace') | |
| .simpleSymbols('}', 'cl_brace') | |
| .simpleSymbols(';', 'semicolon') |
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
| /* inline codes are within two ` */ | |
| 'a``b``c``d`e``f'.split(/``((?:[^`]|`[^`])*)``/) | |
| /* ["a", "b", "c", "d`e", "f"] */ |
NewerOlder