Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
clearbit
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
prospector
clearbit
Commits
4dc98af4
Commit
4dc98af4
authored
Oct 10, 2014
by
Ben Drucker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap #find calls in Promise.method so assert failures become rejections
parent
21ac2cfc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
company.js
src/company.js
+3
-2
person.js
src/person.js
+3
-2
No files found.
src/company.js
View file @
4dc98af4
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
var
assert
=
require
(
'assert'
);
var
assert
=
require
(
'assert'
);
var
_
=
require
(
'lodash'
);
var
_
=
require
(
'lodash'
);
var
Promise
=
require
(
'bluebird'
);
module
.
exports
=
function
(
client
)
{
module
.
exports
=
function
(
client
)
{
function
Company
(
data
)
{
function
Company
(
data
)
{
...
@@ -12,7 +13,7 @@ module.exports = function (client) {
...
@@ -12,7 +13,7 @@ module.exports = function (client) {
return
!
this
.
id
;
return
!
this
.
id
;
};
};
Company
.
find
=
function
(
options
)
{
Company
.
find
=
Promise
.
method
(
function
(
options
)
{
assert
(
options
&&
options
.
domain
,
'A domain must be provided'
);
assert
(
options
&&
options
.
domain
,
'A domain must be provided'
);
return
this
.
client
.
request
(
_
.
extend
({
return
this
.
client
.
request
(
_
.
extend
({
api
:
'company'
,
api
:
'company'
,
...
@@ -22,7 +23,7 @@ module.exports = function (client) {
...
@@ -22,7 +23,7 @@ module.exports = function (client) {
.
then
(
function
(
data
)
{
.
then
(
function
(
data
)
{
return
new
this
(
data
);
return
new
this
(
data
);
});
});
};
}
)
;
Company
.
prototype
.
client
=
Company
.
client
=
client
;
Company
.
prototype
.
client
=
Company
.
client
=
client
;
...
...
src/person.js
View file @
4dc98af4
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
var
assert
=
require
(
'assert'
);
var
assert
=
require
(
'assert'
);
var
_
=
require
(
'lodash'
);
var
_
=
require
(
'lodash'
);
var
Promise
=
require
(
'bluebird'
);
module
.
exports
=
function
(
client
)
{
module
.
exports
=
function
(
client
)
{
function
Person
(
data
)
{
function
Person
(
data
)
{
...
@@ -12,7 +13,7 @@ module.exports = function (client) {
...
@@ -12,7 +13,7 @@ module.exports = function (client) {
return
!
this
.
id
;
return
!
this
.
id
;
};
};
Person
.
find
=
function
(
options
)
{
Person
.
find
=
Promise
.
method
(
function
(
options
)
{
assert
(
options
&&
options
.
email
,
'An email must be provided'
);
assert
(
options
&&
options
.
email
,
'An email must be provided'
);
return
this
.
client
.
request
(
_
.
extend
({
return
this
.
client
.
request
(
_
.
extend
({
api
:
'person'
,
api
:
'person'
,
...
@@ -23,7 +24,7 @@ module.exports = function (client) {
...
@@ -23,7 +24,7 @@ module.exports = function (client) {
.
then
(
function
(
data
)
{
.
then
(
function
(
data
)
{
return
new
this
(
data
);
return
new
this
(
data
);
});
});
};
}
)
;
Person
.
prototype
.
client
=
Person
.
client
=
client
;
Person
.
prototype
.
client
=
Person
.
client
=
client
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment