1.1.3 • Published 10 years ago

falcor-graph-syntax v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Falcor Graph Syntax Build Status Coverage Status bitHound Score

Simplified GraphQL query syntax for Falcor.

Falcor path syntax can get very long and redundant:

[
	["foo", 1, "foo", ["foo", "bar"]],
	["foo", 1, "bar", 0, "foo"],
	["bar", 0, "foo", { from: 0, to: 9 }, ["foo", "bar"]],
	["bar", 0, "bar", { length: 10 }]
]

The deeper you go in the model, the worse it gets.

This library lets you use an alternative syntax, similar to that of GraphQL:

`
	foo(id: 1) {
		foo { foo, bar },
		bar(index: 0) { foo }
	},
	bar(index: 0) {
		foo(from: 0, to: 9) { foo, bar },
		bar(length: 10)
	}
`

Installation

npm install falcor-graph-syntax

Usage

Import the library.

import FalcorGraphSyntax from "falcor-graph-syntax";

Then replace your paths (strings or arrays)...

model.get(paths).subscribe(...);

... with your query (string), wrapped in the FalcorQuerySyntax() function.

model.get(FalcorQuerySyntax(query)).subscribe(...);
1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago