Skip to content

Commit

Permalink
.match now returns an array and can take multiple objects to match
Browse files Browse the repository at this point in the history
against. Added event handlers via $on. Now returns source object if
no-mutations have occured.
  • Loading branch information
anywhichway committed Feb 11, 2019
1 parent f272137 commit aee778c
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 172 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ JavaScript Object Query Language Representation - Funny it's mostly JSON.

JOQULAR is a query language specification. Although there is a reference implementation with this site others are free to write their own drivers.

Like SQL, JOQULAR allows you to mutate the returned records to meet you needs; however, if you do not perform any mutations you will get the matched object back rather than a copy.

Mutation options include property aliasing and redaction, value substitution (including array summaries, sorting, filtering, etc.), adding event handlers, freezing objects and properties.

Matching options include functional testing of both property names and values as well as over 30 built-in predicates.

You can also use JOQULAR to validate objects.

# Installation Of Reference Implementation

npm install joqular
Expand All @@ -16,8 +24,8 @@ const <matched> = await JOQULAR.match(<pattern>,<object>);

```
const pattern = {name:{$eq:"joe"}},
matched1 = await JOQULAR.match(pattern,{name:"joe",age:27}), // will resolve to the object with name "joe"
matched2 = await JOQULAR.match(pattern,{name:"jane",age:27}); // will resolve to undefined
[matched1] = await JOQULAR.match(pattern,{name:"joe",age:27}), // will resolve to the object with name "joe"
[matched2] = await JOQULAR.match(pattern,{name:"jane",age:27}); // will resolve to undefined
```

For now see the [Medium article](https://medium.com/@anywhichway/joqular-high-powered-javascript-pattern-matching-273a0d77eab5) for more information.
Expand Down Expand Up @@ -150,6 +158,8 @@ $nin

$not

$on

$or

$outside
Expand Down Expand Up @@ -217,6 +227,8 @@ $year

## Updates

2019-02-10 v2.0.1b - `.match` now returns an array and can take multiple objects to match against. Added event handlers via $on. Now returns source object if no-mutations have occured.

2019-02-10 v2.0.0b - Initial public reference implementation subsequent to deprecation of JOQULAR as an in memory datastore.


Expand Down
Loading

0 comments on commit aee778c

Please sign in to comment.