From aa63d7bf4bf38c7e6a3061218c322d684a15e2a5 Mon Sep 17 00:00:00 2001 From: haio Date: Mon, 28 Apr 2014 21:36:44 +0800 Subject: [PATCH 01/21] Convert principalId to String --- lib/models/acl.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/models/acl.js b/lib/models/acl.js index b14ebabc..3d2343d4 100644 --- a/lib/models/acl.js +++ b/lib/models/acl.js @@ -296,6 +296,7 @@ ACL.getStaticACLs = function getStaticACLs(model, property) { ACL.checkPermission = function checkPermission(principalType, principalId, model, property, accessType, callback) { + principalId = principalId.toString(); property = property || ACL.ALL; var propertyQuery = (property === ACL.ALL) ? undefined : {inq: [property, ACL.ALL]}; accessType = accessType || ACL.ALL; From f44d737e7edf4765a1f099f4ad154b21b4eef437 Mon Sep 17 00:00:00 2001 From: haio Date: Tue, 29 Apr 2014 09:34:48 +0800 Subject: [PATCH 02/21] Add more check on principalId --- lib/models/acl.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/models/acl.js b/lib/models/acl.js index 3d2343d4..3663273e 100644 --- a/lib/models/acl.js +++ b/lib/models/acl.js @@ -296,7 +296,9 @@ ACL.getStaticACLs = function getStaticACLs(model, property) { ACL.checkPermission = function checkPermission(principalType, principalId, model, property, accessType, callback) { - principalId = principalId.toString(); + if(principalId !== null && principalId !== undefined && (typeof principalId !== 'string') ) { + principlaId = principalId.toString(); + } property = property || ACL.ALL; var propertyQuery = (property === ACL.ALL) ? undefined : {inq: [property, ACL.ALL]}; accessType = accessType || ACL.ALL; From eae86b64f4fdac7de17a4985d7b4b4671e03f4fe Mon Sep 17 00:00:00 2001 From: haio Date: Tue, 29 Apr 2014 20:10:44 +0800 Subject: [PATCH 03/21] typo --- lib/models/acl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/models/acl.js b/lib/models/acl.js index 3663273e..ce6f936f 100644 --- a/lib/models/acl.js +++ b/lib/models/acl.js @@ -297,7 +297,7 @@ ACL.checkPermission = function checkPermission(principalType, principalId, model, property, accessType, callback) { if(principalId !== null && principalId !== undefined && (typeof principalId !== 'string') ) { - principlaId = principalId.toString(); + principalId = principalId.toString(); } property = property || ACL.ALL; var propertyQuery = (property === ACL.ALL) ? undefined : {inq: [property, ACL.ALL]}; From 429052a0dbe38cb5ec2351f5ca8c93d1d80b9c4c Mon Sep 17 00:00:00 2001 From: haio Date: Sat, 3 May 2014 11:43:03 +0800 Subject: [PATCH 04/21] Ensure roleId and principalId to be string in Role#isInRole --- lib/models/role.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/models/role.js b/lib/models/role.js index 86ff5cc3..8b64796f 100644 --- a/lib/models/role.js +++ b/lib/models/role.js @@ -373,8 +373,14 @@ Role.isInRole = function (role, context, callback) { async.some(context.principals, function (p, done) { var principalType = p.type || undefined; var principalId = p.id || undefined; + var roleId = result.id.toString(); + + if(principalId !== null && principalId !== undefined && (typeof principalId !== 'string') ) { + principalId = principalId.toString(); + } + if (principalType && principalId) { - roleMappingModel.findOne({where: {roleId: result.id, + roleMappingModel.findOne({where: {roleId: roleId, principalType: principalType, principalId: principalId}}, function (err, result) { debug('Role mapping found: %j', result); From ff2b5a70d68f8823e20ea65112af6c446dd075ca Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Wed, 7 May 2014 15:23:26 -0700 Subject: [PATCH 05/21] Fix client-server example --- example/client-server/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/client-server/client.js b/example/client-server/client.js index 4e1e423c..436e266b 100644 --- a/example/client-server/client.js +++ b/example/client-server/client.js @@ -3,7 +3,7 @@ var client = loopback(); var CartItem = require('./models').CartItem; var remote = loopback.createDataSource({ connector: loopback.Remote, - root: 'http://localhost:3000' + url: 'http://localhost:3000' }); client.model(CartItem); From 978bc574211df6ea091a283ce9465e58ab386140 Mon Sep 17 00:00:00 2001 From: haio Date: Sat, 10 May 2014 15:43:01 +0800 Subject: [PATCH 06/21] Fix bug in User#resetPassword --- lib/models/user.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/models/user.js b/lib/models/user.js index 374fe7c4..73a18d39 100644 --- a/lib/models/user.js +++ b/lib/models/user.js @@ -379,7 +379,7 @@ User.resetPassword = function(options, cb) { options = options || {}; if(typeof options.email === 'string') { - UserModel.findOne({email: options.email}, function(err, user) { + UserModel.findOne({ where: {email: options.email} }, function(err, user) { if(err) { cb(err); } else if(user) { @@ -392,7 +392,8 @@ User.resetPassword = function(options, cb) { cb(); UserModel.emit('resetPasswordRequest', { email: options.email, - accessToken: accessToken + accessToken: accessToken, + user: user }); } }) From 0ab3817c69dd9d0fe7c03f3c840da8bcaca85ed0 Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Mon, 12 May 2014 09:22:09 -0700 Subject: [PATCH 07/21] Add homepage to package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 1ed4687e..855356fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "loopback", "description": "LoopBack: Open Mobile Platform for Node.js", + "homepage": "http://loopback.io", "keywords": [ "StrongLoop", "LoopBack", From c6dbdc16a7cd2ebde7b6d5fa61858c206cfc7fc8 Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 11:55:04 -0700 Subject: [PATCH 08/21] Move content from wiki on LB modules. --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 46464037..65cfc26e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,63 @@ -# LoopBack +# What is LoopBack? -For a quick introduction and overview, see http://loopback.io/. +LoopBack is a Node.js mobile backend framework that you can run on-premises or in the cloud that enables you to: + + * Create dynamic REST APIs + * Access data from Oracle, MySQL, PostgreSQL, MS SQL Server, MongoDB, SOAP and REST APIs + * Push, geolocation, and file services + * Android, iOS, and JavaScript SDKs + +LoopBack consists of: + * A library of Node.js modules. + * A command line tool, `slc lb`, for creating and working with LoopBack applications. + * Client SDKs for native and web-based mobile clients. + +For more details, see http://loopback.io/. + +## LoopBack modules +The LoopBack Node.js modules are illustrated below: + +![LoopBack modules](http://content.screencast.com/users/RaymondFeng/folders/Jing/media/74fcdafa-7d4b-4b9e-9f1f-f303b2b6adc4/00000065.png) + +* Frameworks + * [loopback](https://github.com/strongloop/loopback) + * [loopback-datasource-juggler](https://github.com/strongloop/loopback-datasource-juggler) + * [strong-remoting](https://github.com/strongloop/strong-remoting) + +* Enterprise Connectors + * [loopback-connector-mongodb](https://github.com/strongloop/loopback-connector-mongodb) + * [loopback-connector-mysql](https://github.com/strongloop/loopback-connector-mysql) + * [loopback-connector-oracle](https://github.com/strongloop/loopback-connector-oracle) + * [loopback-connector-postgresql](https://github.com/strongloop/loopback-connector-postgresql) + * [loopback-connector-rest](https://github.com/strongloop/loopback-connector-rest) + * [loopback-connector-soap](https://github.com/strongloop/loopback-connector-soap) + +* Mobile services + * [loopback-push-notification](https://github.com/strongloop/loopback-push-notification) + * [loopback-storage-service](https://github.com/strongloop/loopback-storage-service) + +* Clients + * [loopback-ios](https://github.com/strongloop/loopback-ios) + * [loopback-remoting-ios](https://github.com/strongloop/loopback-remoting-ios) + * [loopback-android](https://github.com/strongloop/loopback-android) + * [loopback-remoting-android](https://github.com/strongloop/loopback-remoting-android) + * [loopback-angular](https://github.com/strongloop/loopback-angular) + +* Tools + * [loopback-explorer](https://github.com/strongloop/loopback-explorer) + * [loopback-workspace](https://github.com/strongloop/loopback-workspace) + * [strong-cli](https://github.com/strongloop/strong-cli) + +* Examples + * [loopback-example-full-stack](https://github.com/strongloop/loopback-example-full-stack) + * [loopback-example-office-supplies](https://github.com/strongloop/loopback-example-office-supplies) + * [loopback-example-todo](https://github.com/strongloop/loopback-example-todo) + * [loopback-example-access-control](https://github.com/strongloop/loopback-example-access-control) + * [loopback-example-proxy](https://github.com/strongloop/loopback-example-proxy) + * [strongloop-community/loopback-example-datagraph](https://github.com/strongloop-community/loopback-example-datagraph) + * [strongloop-community/loopback-mysql-example](https://github.com/strongloop-community/loopback-mysql-example) + * [strongloop-community/loopback-examples-ios](https://github.com/strongloop-community/loopback-examples-ios) + * [strongloop-community/loopback-example-ssl](https://github.com/strongloop-community/loopback-example-ssl) ## Documentation From 1b79853c3a73c5b5fe87db2666b87410c89dcea0 Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 12:06:13 -0700 Subject: [PATCH 09/21] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 65cfc26e..b0636456 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # What is LoopBack? -LoopBack is a Node.js mobile backend framework that you can run on-premises or in the cloud that enables you to: +LoopBack is a Node.js mobile backend framework that enables you to: * Create dynamic REST APIs * Access data from Oracle, MySQL, PostgreSQL, MS SQL Server, MongoDB, SOAP and REST APIs - * Push, geolocation, and file services - * Android, iOS, and JavaScript SDKs + * Run your application on-premises or in the cloud + * Use built-in push, geolocation, and file services + * Easily create client apps using Android, iOS, and JavaScript SDKs LoopBack consists of: * A library of Node.js modules. - * A command line tool, `slc lb`, for creating and working with LoopBack applications. + * A command line tool, `slc`, for creating and working with LoopBack applications. * Client SDKs for native and web-based mobile clients. For more details, see http://loopback.io/. From cce7a50c0d5529f432697cb89cf09392fb59b145 Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 12:07:33 -0700 Subject: [PATCH 10/21] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0636456..0cb9ce59 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ LoopBack is a Node.js mobile backend framework that enables you to: - * Create dynamic REST APIs + * Create dynamic REST APIs with little or no coding * Access data from Oracle, MySQL, PostgreSQL, MS SQL Server, MongoDB, SOAP and REST APIs + * Incorporate model relationships and access controls * Run your application on-premises or in the cloud * Use built-in push, geolocation, and file services * Easily create client apps using Android, iOS, and JavaScript SDKs From 7229f91c6abd2326d38f247428a002fbb81a55fc Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 12:10:41 -0700 Subject: [PATCH 11/21] Update README.md --- README.md | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0cb9ce59..05d6080a 100644 --- a/README.md +++ b/README.md @@ -61,25 +61,13 @@ The LoopBack Node.js modules are illustrated below: * [strongloop-community/loopback-examples-ios](https://github.com/strongloop-community/loopback-examples-ios) * [strongloop-community/loopback-example-ssl](https://github.com/strongloop-community/loopback-example-ssl) -## Documentation +## Resources -[See the full documentation](http://docs.strongloop.com/display/DOC/LoopBack). - -## API - -[Browse the API documentation](http://apidocs.strongloop.com/loopback). - -## Mailing List - -Discuss features and ask questions on [LoopBack Forum](https://groups.google.com/forum/#!forum/loopbackjs). - -## Issues - -File any issues [here on GitHub](https://github.com/strongloop/loopback/issues). - -## Features - -Read about the [features of LoopBack](https://github.com/strongloop/loopback/wiki/Features). + * [Documentation](http://docs.strongloop.com/display/DOC/LoopBack). + * [API documentation](http://apidocs.strongloop.com/loopback). + * [LoopBack Google Group](https://groups.google.com/forum/#!forum/loopbackjs). + * [GitHub issues](https://github.com/strongloop/loopback/issues). + * Read more about the [LoopBack's features](https://github.com/strongloop/loopback/wiki/Features). ## Contributing From 108ba21b6e5fae673349b61c604854717eb8d076 Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 12:16:15 -0700 Subject: [PATCH 12/21] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 05d6080a..c57ad69a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# What is LoopBack? - LoopBack is a Node.js mobile backend framework that enables you to: * Create dynamic REST APIs with little or no coding From cd9387362cdcf78b42e15e81a164e1f6746924a1 Mon Sep 17 00:00:00 2001 From: Al Tsang Date: Wed, 14 May 2014 14:04:58 -0700 Subject: [PATCH 13/21] Update README.md removed mobile backend to generalize LB --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c57ad69a..165b2902 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -LoopBack is a Node.js mobile backend framework that enables you to: +LoopBack is an enterprise Node.js framework that enables you to: - * Create dynamic REST APIs with little or no coding - * Access data from Oracle, MySQL, PostgreSQL, MS SQL Server, MongoDB, SOAP and REST APIs - * Incorporate model relationships and access controls + * Create dynamic end-to-end REST APIs with little or no coding + * Easily access data from Oracle, MySQL, PostgreSQL, MS SQL Server, MongoDB, SOAP and other REST APIs + * Incorporate model relationships and access controls for complex APIs * Run your application on-premises or in the cloud - * Use built-in push, geolocation, and file services + * Use built-in push, geolocation, and file services for mobile use cases * Easily create client apps using Android, iOS, and JavaScript SDKs LoopBack consists of: From cc5cf5429ddf0da8aebcca0e23767f66f6534c58 Mon Sep 17 00:00:00 2001 From: Al Tsang Date: Wed, 14 May 2014 14:08:22 -0700 Subject: [PATCH 14/21] Update README.md tweaked opening description again --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 165b2902..c10345d5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -LoopBack is an enterprise Node.js framework that enables you to: +LoopBack is a highly extensible, open source Node.js framework that enables you to: * Create dynamic end-to-end REST APIs with little or no coding * Easily access data from Oracle, MySQL, PostgreSQL, MS SQL Server, MongoDB, SOAP and other REST APIs From f20db61b0339640bb7709bba85572c99adb673db Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 15:53:02 -0700 Subject: [PATCH 15/21] Removed docs/api-datasource.md since it's covered in Juggler JSDoc. --- docs.json | 1 - 1 file changed, 1 deletion(-) diff --git a/docs.json b/docs.json index 805f38ca..77f709dc 100644 --- a/docs.json +++ b/docs.json @@ -13,7 +13,6 @@ "lib/models/data-model.js", "lib/models/role.js", "lib/models/user.js", - "docs/api-datasource.md", "docs/api-geopoint.md", "docs/api-model.md", "docs/api-model-remote.md" From e1889ff8ebf780b3fcfe43e155fe256511fe5efb Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 16:35:04 -0700 Subject: [PATCH 16/21] Remove docs/api-geopoint.md from docs --- docs.json | 1 - 1 file changed, 1 deletion(-) diff --git a/docs.json b/docs.json index 77f709dc..8c0894b5 100644 --- a/docs.json +++ b/docs.json @@ -13,7 +13,6 @@ "lib/models/data-model.js", "lib/models/role.js", "lib/models/user.js", - "docs/api-geopoint.md", "docs/api-model.md", "docs/api-model-remote.md" ], From d58a2f0938e287ec915fc2271dcea68111f0e669 Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 14 May 2014 18:30:00 -0700 Subject: [PATCH 17/21] Remove validation methods, now covered in JSDoc. --- docs/api-model.md | 139 ---------------------------------------------- 1 file changed, 139 deletions(-) diff --git a/docs/api-model.md b/docs/api-model.md index 5ec0beb2..7aaf3687 100644 --- a/docs/api-model.md +++ b/docs/api-model.md @@ -442,145 +442,6 @@ appearing in many groups, you could declare the models this way, user.groups.add(group, callback); // connect an existing group with the user user.groups.remove(group, callback); // remove the user from the group ``` - -### Validations - -#### Model.validatesFormatOf(property, options) - -Require a model to include a property that matches the given format. - -```js -User.validatesFormat('name', {with: /\w+/}); -``` - -#### Model.validatesPresenceOf(properties...) - -Require a model to include a property to be considered valid. - -```js -User.validatesPresenceOf('first', 'last', 'age'); -``` - -#### Model.validatesLengthOf(property, options) - -Require a property length to be within a specified range. - -```js -User.validatesLengthOf('password', {min: 5, message: {min: 'Password is too short'}}); -``` - -#### Model.validatesInclusionOf(property, options) - -Require a value for `property` to be in the specified array. - -```js -User.validatesInclusionOf('gender', {in: ['male', 'female']}); -``` - -#### Model.validatesExclusionOf(property, options) - -Require a value for `property` to not exist in the specified array. - -```js -User.validatesExclusionOf('domain', {in: ['www', 'billing', 'admin']}); -``` - -#### Model.validatesNumericalityOf(property, options) - -Require a value for `property` to be a specific type of `Number`. - -```js -User.validatesNumericalityOf('age', {int: true}); -``` - -#### Model.validatesUniquenessOf(property, options) - -Ensure the value for `property` is unique in the collection of models. - -```js -User.validatesUniquenessOf('email', {message: 'email is not unique'}); -``` - -**Note:** not available for all [connectors](#connectors). - -Currently supported in these connectors: - - - [In Memory](#memory-connector) - - [Oracle](http://github.com/strongloop/loopback-connector-oracle) - - [MongoDB](http://github.com/strongloop/loopback-connector-mongodb) - -#### myModel.isValid() - -Validate the model instance. - -```js -user.isValid(function (valid) { - if (!valid) { - console.log(user.errors); - // => hash of errors - // => { - // => username: [errmessage, errmessage, ...], - // => email: ... - // => } - } -}); -``` - -#### loopback.ValidationError - -`ValidationError` is raised when the application attempts to save an invalid -model instance. - -Example: - -```js -{ - "name": "ValidationError", - "status": 422, - "message": "The Model instance is not valid. \ - See `details` property of the error object for more info.", - "statusCode": 422, - "details": { - "context": "user", - "codes": { - "password": [ - "presence" - ], - "email": [ - "uniqueness" - ] - }, - "messages": { - "password": [ - "can't be blank" - ], - "email": [ - "Email already exists" - ] - } - }, -} -``` - -You might run into situations where you need to raise a validation error -yourself, for example in a "before" hook or a custom model method. - -```js -MyModel.prototype.preflight = function(changes, callback) { - // Update properties, do not save to db - for (var key in changes) { - model[key] = changes[key]; - } - - if (model.isValid()) { - return callback(null, { success: true }); - } - - // This line shows how to create a ValidationError - err = new ValidationError(model); - callback(err); -} -``` ### Shared methods From a08bcee44da2dd679b2ca181246b65e468a06f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 15 May 2014 09:41:50 +0200 Subject: [PATCH 18/21] Support all 1.x versions of datasource-juggler Modify the loopback-datasource-juggler semver specifier in peerDependencies and devDependencies from "~1.3.11" to "^1.3.11". The goal is to support newer 1.x versions like 1.4.0 or 1.5.x. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 855356fe..104c26ff 100644 --- a/package.json +++ b/package.json @@ -30,10 +30,10 @@ "async": "~0.2.10" }, "peerDependencies": { - "loopback-datasource-juggler": "~1.3.11" + "loopback-datasource-juggler": "^1.3.11" }, "devDependencies": { - "loopback-datasource-juggler": "~1.3.11", + "loopback-datasource-juggler": "^1.3.11", "mocha": "~1.17.1", "strong-task-emitter": "0.0.x", "supertest": "~0.9.0", From 7c001192922721c281b8e3f0e0e7d3d5cf66c458 Mon Sep 17 00:00:00 2001 From: Adam Schwartz Date: Thu, 15 May 2014 23:32:12 -0400 Subject: [PATCH 19/21] Fix typo "Unkown" => "Unknown" --- lib/models/data-model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/models/data-model.js b/lib/models/data-model.js index c3966036..4c0aeafd 100644 --- a/lib/models/data-model.js +++ b/lib/models/data-model.js @@ -66,7 +66,7 @@ function convertNullToNotFoundError(ctx, cb) { var modelName = ctx.method.sharedClass.name; var id = ctx.getArgByName('id'); - var msg = 'Unkown "' + modelName + '" id "' + id + '".'; + var msg = 'Unknown "' + modelName + '" id "' + id + '".'; var error = new Error(msg); error.statusCode = error.status = 404; cb(error); From 4b3d20e409c6f7f9d40baa74148a6b3034f56ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 16 May 2014 16:20:34 +0200 Subject: [PATCH 20/21] test/geo-point: relax too precise assertions Relax the assertions to verify only the integer part of the distances. The decimal part is subject to small variances depending on the exact implementation of floating-point arithmetic. For example, the distance calculated on Node v0.11.13 is different than the distance calculated on Node v0.10.x. --- test/geo-point.test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/geo-point.test.js b/test/geo-point.test.js index 2f3da597..bc84f717 100644 --- a/test/geo-point.test.js +++ b/test/geo-point.test.js @@ -3,8 +3,9 @@ describe('GeoPoint', function() { it("Get the distance to another `GeoPoint`", function() { var here = new GeoPoint({lat: 10, lng: 10}); var there = new GeoPoint({lat: 5, lng: 5}); - - assert.equal(here.distanceTo(there, {type: 'meters'}), 782777.923052584); + var distance = here.distanceTo(there, {type: 'meters'}); + + assert.equal(Math.floor(distance), 782777); }); }); @@ -12,8 +13,9 @@ describe('GeoPoint', function() { it("Get the distance between two points", function() { var here = new GeoPoint({lat: 10, lng: 10}); var there = new GeoPoint({lat: 5, lng: 5}); + var distance = GeoPoint.distanceBetween(here, there, {type: 'feet'}); - assert.equal(GeoPoint.distanceBetween(here, there, {type: 'feet'}), 2568169.038886431); + assert.equal(Math.floor(distance), 2568169); }); }); From b24d5e9d2094136dde47d4db2b78119721812b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 16 May 2014 20:10:29 +0200 Subject: [PATCH 21/21] 1.8.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 104c26ff..52eac453 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "Platform", "mBaaS" ], - "version": "1.8.1", + "version": "1.8.2", "scripts": { "test": "mocha -R spec" },