Skip to content

Instantly share code, notes, and snippets.

@lexfrl
Created June 3, 2015 15:07
Show Gist options
  • Select an option

  • Save lexfrl/a1b71efde881d8202585 to your computer and use it in GitHub Desktop.

Select an option

Save lexfrl/a1b71efde881d8202585 to your computer and use it in GitHub Desktop.
import rules from "./rules";
import Solver from "solvr";
import im from "immutable";
class MySolver extends Solver {
get(path) {
path = Solver.path(path);
if (path.join(".") === "user") {
return this.oneOf(["users"]);
}
return super.get(path);
}
oneOf(collectionPath) {
collectionPath = Solver.path(collectionPath);
let col = this.state.getIn(collectionPath);
return col && col.toSeq().first() && col.toSeq().first().toJS();
}
}
export default new MySolver(rules);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment