Skip to content

Commit 688d14c

Browse files
committed
use join instead of 'with' due IE's reserved words.
1 parent 7a59299 commit 688d14c

7 files changed

Lines changed: 24 additions & 24 deletions

File tree

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "hook-javascript",
3-
"description": "Doubleleft API javascript client.",
4-
"version": "0.1.0",
3+
"description": "hook javascript client",
4+
"version": "0.2.1",
55
"homepage": "https://github.com/doubleleft/hook-javascript",
66
"main": "./dist/hook.js",
77
"ignore": [
88
"src",
9-
"dl-ext",
9+
"hook-ext",
1010
"docs",
1111
"grunt",
1212
"tests",

dist/hook.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
2-
* hook-javascript v0.1.0
2+
* hook-javascript v0.2.1
33
* https://github.com/doubleleft/hook-javascript
44
*
55
* @copyright 2014 Doubleleft
6-
* @build 11/5/2014
6+
* @build 11/11/2014
77
*/
88
(function(window) {
99
//
@@ -9917,7 +9917,7 @@ Hook.Client.prototype.getHeaders = function() {
99179917
// App authentication request headers
99189918
var request_headers = {
99199919
'X-App-Id': this.app_id,
9920-
'X-App-Key': this.key,
9920+
'X-App-Key': this.key
99219921
}, auth_token;
99229922

99239923
// Forward user authentication token, if it is set
@@ -10606,33 +10606,33 @@ Hook.Collection.prototype.find = function(_id) {
1060610606

1060710607
/**
1060810608
* Set the relationships that should be eager loaded.
10609-
* @method with
10609+
* @method join
1061010610
* @param {String} ...
1061110611
* @return {Hook.Collection}
1061210612
*
1061310613
* @example Simple relationship
1061410614
*
10615-
* client.collection('books').with('author').each(function(book) {
10615+
* client.collection('books').join('author').each(function(book) {
1061610616
* console.log("Author: ", book.author.name);
1061710617
* });
1061810618
*
1061910619
* @example Multiple relationships
1062010620
*
10621-
* client.collection('books').with('author', 'publisher').each(function(book) {
10621+
* client.collection('books').join('author', 'publisher').each(function(book) {
1062210622
* console.log("Author: ", book.author.name);
1062310623
* console.log("Publisher: ", book.publisher.name);
1062410624
* });
1062510625
*
1062610626
* @example Nested relationships
1062710627
*
10628-
* client.collection('books').with('author.contacts').each(function(book) {
10628+
* client.collection('books').join('author.contacts').each(function(book) {
1062910629
* console.log("Author: ", book.author.name);
1063010630
* console.log("Contacts: ", book.author.contacts);
1063110631
* });
1063210632
*
1063310633
*/
10634-
Hook.Collection.prototype.with = function() {
10635-
this.options.with = arguments;
10634+
Hook.Collection.prototype.join = function() {
10635+
this.options['with'] = arguments;
1063610636
return this;
1063710637
};
1063810638

@@ -11136,7 +11136,7 @@ Hook.Collection.prototype.buildQuery = function() {
1113611136
aggregation: 'aggr', // min / max / count / avg / sum
1113711137
operation: 'op', // increment / decrement
1113811138
data: 'data', // updateAll / firstOrCreate
11139-
with: 'with', // relationships
11139+
with: 'with', // join / relationships
1114011140
select: 'select', // fields to return
1114111141
distinct: 'distinct' // use distinct operation
1114211142
};

dist/hook.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "hook-javascript",
33
"title": "JavaScript Client for hook",
44
"description": "JavaScript client to hook",
5-
"version": "0.2.0",
5+
"version": "0.2.1",
66
"homepage": "http://github.com/doubleleft/hook-javascript",
77
"main": "dist/hook.js",
88
"authors": [{

src/collection.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,33 +180,33 @@ Hook.Collection.prototype.find = function(_id) {
180180

181181
/**
182182
* Set the relationships that should be eager loaded.
183-
* @method with
183+
* @method join
184184
* @param {String} ...
185185
* @return {Hook.Collection}
186186
*
187187
* @example Simple relationship
188188
*
189-
* client.collection('books').with('author').each(function(book) {
189+
* client.collection('books').join('author').each(function(book) {
190190
* console.log("Author: ", book.author.name);
191191
* });
192192
*
193193
* @example Multiple relationships
194194
*
195-
* client.collection('books').with('author', 'publisher').each(function(book) {
195+
* client.collection('books').join('author', 'publisher').each(function(book) {
196196
* console.log("Author: ", book.author.name);
197197
* console.log("Publisher: ", book.publisher.name);
198198
* });
199199
*
200200
* @example Nested relationships
201201
*
202-
* client.collection('books').with('author.contacts').each(function(book) {
202+
* client.collection('books').join('author.contacts').each(function(book) {
203203
* console.log("Author: ", book.author.name);
204204
* console.log("Contacts: ", book.author.contacts);
205205
* });
206206
*
207207
*/
208-
Hook.Collection.prototype.with = function() {
209-
this.options.with = arguments;
208+
Hook.Collection.prototype.join = function() {
209+
this.options['with'] = arguments;
210210
return this;
211211
};
212212

@@ -710,7 +710,7 @@ Hook.Collection.prototype.buildQuery = function() {
710710
aggregation: 'aggr', // min / max / count / avg / sum
711711
operation: 'op', // increment / decrement
712712
data: 'data', // updateAll / firstOrCreate
713-
with: 'with', // relationships
713+
'with': 'with', // join / relationships
714714
select: 'select', // fields to return
715715
distinct: 'distinct' // use distinct operation
716716
};

src/core/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Hook.Client.prototype.getHeaders = function() {
214214
// App authentication request headers
215215
var request_headers = {
216216
'X-App-Id': this.app_id,
217-
'X-App-Key': this.key,
217+
'X-App-Key': this.key
218218
}, auth_token;
219219

220220
// Forward user authentication token, if it is set

tests/collections/relationship.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// asyncTest("Collection: Querying relationships", function() {
2-
// client.collection('posts').with('author').then(function(posts) {
2+
// client.collection('posts').join('author').then(function(posts) {
33
// for (var i=0; i < posts.length; i++) {
44
// posts[i].author
55
// }

0 commit comments

Comments
 (0)