firebase-unchained
Advanced tools
Comparing version 1.5.0 to 2.0.0
@@ -36,5 +36,3 @@ 'use strict'; | ||
var ref = path.once ? path : db.child(path); | ||
return new Promise(function (resolve, reject) { | ||
ref.once('value', resolve, reject); | ||
}); | ||
return ref.once('value'); | ||
}; | ||
@@ -46,7 +44,3 @@ } | ||
return db.pget(path).then(function (snap) { | ||
var val = snap.exportVal(); | ||
if (val === null) { | ||
throw new Error('No value at this path'); | ||
} | ||
return val; | ||
return snap.exportVal(); | ||
}); | ||
@@ -59,7 +53,3 @@ }; | ||
return db.pget(path).then(function (snap) { | ||
var val = snap.val(); | ||
if (val === null) { | ||
throw new Error('No value at this path'); | ||
} | ||
return val; | ||
return snap.val(); | ||
}); | ||
@@ -72,5 +62,2 @@ }; | ||
return db.pget(path).then(function (snap) { | ||
if (!snap.hasChildren()) { | ||
throw new Error('No child value at this path'); | ||
} | ||
var results = []; | ||
@@ -88,10 +75,3 @@ snap.forEach(function (childSnap) { | ||
var ref = path.push ? path : db.child(path); | ||
if (arguments.length < 2) { | ||
return Promise.resolve(ref.push()); | ||
} | ||
return new Promise(function (resolve, reject) { | ||
ref.push(value, function (err) { | ||
return err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
return ref.push(value); | ||
}; | ||
@@ -103,7 +83,3 @@ } | ||
var ref = path.set ? path : db.child(path); | ||
return new Promise(function (resolve, reject) { | ||
ref.set(value, function (err) { | ||
return err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
return ref.set(value); | ||
}; | ||
@@ -115,7 +91,3 @@ } | ||
var ref = path.setWithPriority ? path : db.child(path); | ||
return new Promise(function (resolve, reject) { | ||
ref.setWithPriority(value, priority, function (err) { | ||
return err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
return ref.setWithPriority(value, priority); | ||
}; | ||
@@ -134,7 +106,3 @@ } | ||
var ref = path.update ? path : db.child(path); | ||
return new Promise(function (resolve, reject) { | ||
ref.update(value, function (err) { | ||
return err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
return ref.update(value); | ||
}; | ||
@@ -146,7 +114,3 @@ } | ||
var ref = path.remove ? path : db.child(path); | ||
return new Promise(function (resolve, reject) { | ||
ref.remove(function (err) { | ||
return err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
return ref.remove(); | ||
}; | ||
@@ -171,5 +135,5 @@ } | ||
var value = options[option]; | ||
return query[option].call(query, value); | ||
return query[option](value); | ||
}, ref); | ||
}; | ||
} |
{ | ||
"name": "firebase-unchained", | ||
"version": "1.5.0", | ||
"description": "Promise version of Firebase API without chaining", | ||
"version": "2.0.0", | ||
"description": "Firebase API without chaining", | ||
"main": "lib/index.js", | ||
@@ -20,2 +20,5 @@ "repository": { | ||
"license": "ISC", | ||
"peerDependencies": { | ||
"firebase": ">= 2.4.0 < 3" | ||
}, | ||
"devDependencies": { | ||
@@ -22,0 +25,0 @@ "babel-cli": "^6.3.17", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4693
1
127