Comparing version 0.1.1 to 0.1.2
ChangeLog | ||
========= | ||
0.1.2 (2017-04-19) | ||
------------------ | ||
* #11: Added test framework. | ||
* #11: Added `follow()` function on Client object for an easy shortcut. | ||
0.1.1 (2017-04-03) | ||
@@ -5,0 +12,0 @@ ------------------ |
@@ -59,2 +59,13 @@ var url = require('url'); | ||
}, | ||
/** | ||
* This funciton is a shortcut for getResource().follow(x); | ||
* | ||
* This function returns a resource | ||
*/ | ||
follow: function(rel) { | ||
return this.getResource().follow(rel); | ||
} | ||
@@ -61,0 +72,0 @@ |
@@ -40,5 +40,9 @@ 'use strict'; | ||
}).then(function() { | ||
// Wipe out the local cache | ||
this.repr = null; | ||
return null; | ||
}); | ||
}.bind(this)); | ||
}, | ||
@@ -56,5 +60,9 @@ | ||
}).then(function() { | ||
// Wipe out the local cache | ||
this.repr = null; | ||
return null; | ||
}); | ||
}.bind(this)); | ||
}, | ||
@@ -61,0 +69,0 @@ |
{ | ||
"name": "restl", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Opiniated HAL client.", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "eslint lib/ && nyc mocha" | ||
}, | ||
@@ -29,2 +29,3 @@ "repository": { | ||
"bluebird": "^3.4.7", | ||
"node-fetch": "^1.6.3", | ||
"request": "^2.79.0", | ||
@@ -34,7 +35,10 @@ "request-promise-any": "^1.0.3" | ||
"devDependencies": { | ||
"eslint": "^3.15.0" | ||
}, | ||
"scripts" : { | ||
"test" : "eslint lib/" | ||
"chai": "^3.5.0", | ||
"eslint": "^3.15.0", | ||
"koa": "^2.2.0", | ||
"koa-logger": "^2.0.1", | ||
"koa-path-match": "^2.0.0", | ||
"mocha": "^3.2.0", | ||
"nyc": "^10.2.0" | ||
} | ||
} |
40
test.js
@@ -1,30 +0,14 @@ | ||
var restl = require('.'); | ||
var FooPromise = function() { | ||
Promise.apply(this, arguments); | ||
} | ||
var options = { | ||
auth: { | ||
user: 'developers@getturnstyle.com', | ||
pass: 'password' | ||
} | ||
} | ||
FooPromise.prototype = Object.create(Promise.prototype); | ||
FooPromise.foo = function(arg) { | ||
return this.then( function(result) { | ||
return result.foo(arg); | ||
}); | ||
}; | ||
var client = restl('http://192.168.0.21:3009/', options); | ||
var home = client.getResource(); | ||
home.follow('currentUser') | ||
.then(function(currentUser) { | ||
return currentUser.follow('accounts') | ||
}) | ||
.then(function(accounts) { | ||
return accounts.get(); | ||
}) | ||
.then(function(result) { | ||
console.log(result); | ||
}) | ||
.catch(function(err) { | ||
console.log(err); | ||
}); | ||
var test = new FooPromise(function(res, rej) { | ||
res('bla'); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
28521
24
612
4
7
1
+ Addednode-fetch@^1.6.3
+ Addedencoding@0.1.13(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addednode-fetch@1.7.3(transitive)