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
/* Class representing a Trie data structure */ | |
export default class Trie { | |
/** | |
* Creates a Trie | |
* @return {Object} Trie | |
*/ | |
constructor() { | |
this.words = 0; | |
this.prefixes = 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
import fetch from 'isomorphic-fetch'; | |
export const REQUEST_POSTS = 'posts/REQUEST'; | |
export const RECEIVE_POSTS = 'posts/RECEIVE'; | |
export const ERROR_POSTS = 'posts/ERROR'; | |
export const ADD_FILTER = 'posts/ADD_FILTER'; | |
export const REMOVE_FILTER = 'posts/REMOVE_FILTER'; | |
// this action is a generic get all posts |
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 fetch from 'isomorphic-fetch'; | |
// usage : const { status, data, error } = yield fetcher('/api/url'); | |
export default function fetcher(url, options = {}) { | |
return new Promise((resolve) => { | |
fetch(url, Object.assign({}, { | |
credentials: 'same-origin', | |
headers: { | |
Accept: 'application/json', | |
'Content-Type': 'application/json', |