I hereby claim:
- I am olslash on github.
- I am olslash (https://keybase.io/olslash) on keybase.
- I have a public key whose fingerprint is 88CA 494E 18E4 88BF E1FD EC81 6E73 C114 5978 E765
To claim this, I am signing this object:
| import React from 'react'; | |
| // import {} from 'lodash'; | |
| // import { PropTypes } from 'helpers/react'; | |
| // const {} = PropTypes; | |
| export default class $NAME$ extends React.Component { | |
| static propTypes = {}; | |
| static defaultProps = {}; |
| import { createReducer } from 'helpers/redux'; | |
| // import { } from 'lodash'; | |
| export const namespace = '$NS$'; | |
| const ACTION = 'nc/$NS$/ACTION'; | |
| const defaultState = { | |
| }; |
| import React from 'react'; | |
| // import { } from 'lodash'; | |
| // import { PropTypes } from 'helpers/react'; | |
| // const { } = PropTypes; | |
| const $NAME$ = ({ | |
| fields | |
| } = {}) => (WrappedComponent) => { | |
| class Wrapped$NAME$ extends React.Component { |
I hereby claim:
To claim this, I am signing this object:
| function getDeeperSuggestions(root, maxDepth) { | |
| // We traverse down every possible branch from the result node (the node | |
| // corresponding to the keypad entry), saving words we see as we go and | |
| // stopping when we reach the specified depth.sug | |
| // deepSuggestions is an array with (maxDepth) subarrays. | |
| // Each of the subarrays will be one depth level's suggestions. | |
| var deepSuggestions = []; | |
| while(deepSuggestions.length < maxDepth) { | |
| deepSuggestions.push([]); |
| Trie.prototype.getSuggestions = function(keyString, suggestionDepth) { | |
| // Traverse the tree based on the key digits in keyString, to find the | |
| // node where relevant words are stored. | |
| var result = []; | |
| var node = this; | |
| for(var i = 0; i < keyString.length; i++) { | |
| var thisKey = keyString[i]; | |
| if(!node.children.hasOwnProperty(thisKey)) { break; } | |
| node = node.children[thisKey]; |
| function insertWordIntoListByFrequency(list, word, useFrequency) { | |
| var wordToInsert = [word, useFrequency]; // Store word in a tuple. | |
| var wordsLength = list.length; | |
| if(wordsLength === 0) { | |
| // Handle the case where this node has no words yet | |
| list.push(wordToInsert); | |
| } else { | |
| // Find where to insert this word among others, based on its | |
| // frequency property. |
| function traverseAddingNodes(node) { | |
| var i = 0, len = word.length; | |
| // Traverse the tree's existing nodes as far as possible. | |
| for(i, len; i < len; i++) { | |
| var thisLetter = word[i]; | |
| var thisKey = keys[thisLetter]; | |
| if(node.children.hasOwnProperty(thisKey)) { | |
| node = node.children[thisKey]; | |
| } else { break; } |
| Trie.prototype.insert = function(word, useFrequency) { | |
| // Traverse the tree to the node where the word should be inserted. If any | |
| // needed nodes do not exist along the way, they are created. | |
| var nodeToAddWord = traverseAddingNodes(this); | |
| // Insert the word into the wordlist of the node returned above. Use the | |
| // data provided (frequency of use in English text) to place the word in | |
| // the correct position, so that we can recommend more common words first. | |
| insertWordIntoListByFrequency(nodeToAddWord.words, word, useFrequency); |
| var Trie = function() { | |
| this.children = {}; // Like {'2': <ref to Trie instance>, '3': ...} | |
| this.words = []; // Like [['award', 10764], ['aware', 6625]] | |
| }; |