Skip to content

Commit

Permalink
Merge pull request #8 from ashpool/no-dependencies
Browse files Browse the repository at this point in the history
Replace rsvp with native Promise
  • Loading branch information
ashpool committed Apr 12, 2016
2 parents 384955c + ca954cc commit cbd2dc1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions lib/carbon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var RSVP = require('rsvp'),
net = require('net'),
var net = require('net'),
url = require('url');

function CarbonClient (properties) {
Expand All @@ -17,7 +16,7 @@ function CarbonClient (properties) {

CarbonClient.prototype.write = function (metrics, timestamp) {
var self = this;
return new RSVP.Promise(function (resolve, reject) {
return new Promise(function (resolve, reject) {
self._connect().then(function (socket) {
var lines = '';
for (var path in metrics) {
Expand All @@ -41,7 +40,7 @@ CarbonClient.prototype.write = function (metrics, timestamp) {

CarbonClient.prototype._connect = function () {
var self = this;
return new RSVP.Promise(function (resolve, reject) {
return new Promise(function (resolve, reject) {
if (self._socket) {
return resolve(self._socket);
}
Expand Down Expand Up @@ -70,7 +69,7 @@ CarbonClient.prototype._connect = function () {

CarbonClient.prototype.end = function () {
var self = this;
return new RSVP.Promise(function (resolve) {
return new Promise(function (resolve) {
if (self._socket) {
self._socket.end();
}
Expand Down
6 changes: 3 additions & 3 deletions lib/graphite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var client = require('./carbon'),
var Client = require('./carbon'),
metric = require('./metric');

function GraphiteClient (properties) {
Expand All @@ -7,7 +7,7 @@ function GraphiteClient (properties) {

GraphiteClient.createClient = function (config) {
return new this({
carbon: new client(config)
carbon: new Client(config)
});
};

Expand All @@ -16,7 +16,7 @@ GraphiteClient.createClient = function (config) {
*
* @param metrics an object with values, e.g. {home:{indoor:{temp:21.2}}}
* @param timestamp defaults to Date.now()
* @returns {RSVP.Promise} a promise
* @returns {Promise} a promise
*/
GraphiteClient.prototype.write = function (metrics, timestamp) {
timestamp = timestamp || Date.now();
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphite-promise",
"version": "0.1.1",
"version": "0.1.2",
"description": "A node.js module to interface with Graphite promise style",
"keywords": [
"graphite"
Expand Down Expand Up @@ -29,7 +29,6 @@
"node": ">=4.2.6"
},
"dependencies": {
"rsvp": "^3.1.0"
},
"devDependencies": {
"chai": "^3.5.0",
Expand Down

0 comments on commit cbd2dc1

Please sign in to comment.