Comparing version 0.11.3 to 0.11.4
@@ -1,2 +0,2 @@ | ||
import { IDictionary } from 'common-types'; | ||
import { IDictionary } from "common-types"; | ||
export declare type Key = string | number; | ||
@@ -3,0 +3,0 @@ /** |
@@ -15,5 +15,5 @@ "use strict"; | ||
this._name = _name; | ||
this.pkProperty = 'id'; | ||
this.pkProperty = "id"; | ||
if (!_name) { | ||
throw new Error('A queue MUST have a named passed in to be managed'); | ||
throw new Error("A queue MUST have a named passed in to be managed"); | ||
} | ||
@@ -45,4 +45,4 @@ if (!Queue._queues[_name]) { | ||
const id = fbKey.key(); | ||
if (typeof queueItem !== 'object') { | ||
throw new Error('Using push() requires that the payload is an object'); | ||
if (typeof queueItem !== "object") { | ||
throw new Error("Using push() requires that the payload is an object"); | ||
} | ||
@@ -61,5 +61,6 @@ queueItem[this.pkProperty] = id; | ||
} | ||
Queue._queues[this._name] = typeof lodash_1.first(queue) === 'object' | ||
? queue.filter((item) => item[this.pkProperty] !== key) | ||
: queue.filter((item) => item !== key); | ||
Queue._queues[this._name] = | ||
typeof lodash_1.first(queue) === "object" | ||
? queue.filter((item) => item[this.pkProperty] !== key) | ||
: queue.filter((item) => item !== key); | ||
return this; | ||
@@ -88,5 +89,3 @@ } | ||
value[this.pkProperty] = key; | ||
this | ||
.dequeue(key) | ||
.enqueue(value); | ||
this.dequeue(key).enqueue(value); | ||
return this; | ||
@@ -99,3 +98,3 @@ } | ||
} | ||
if (typeof currently === 'object' && typeof value === 'object') { | ||
if (typeof currently === "object" && typeof value === "object") { | ||
value[this.pkProperty] = key; | ||
@@ -125,3 +124,3 @@ const updated = Object.assign({}, currently, value); | ||
} | ||
return (typeof lodash_1.first(queue) === 'object') | ||
return typeof lodash_1.first(queue) === "object" | ||
? queue.reduce((obj, item) => { | ||
@@ -134,15 +133,11 @@ const pk = item[this.pkProperty]; | ||
}, new Object()) | ||
: queue.reduce((obj, item) => obj = Object.assign({}, obj, { [item]: true }), new Object()); | ||
: queue.reduce((obj, item) => (obj = Object.assign({}, obj, { [item]: true })), new Object()); | ||
} | ||
map(fn) { | ||
const queuedSchemas = Queue._queues[this._name]; | ||
return queuedSchemas | ||
? queuedSchemas.map(fn) | ||
: []; | ||
return queuedSchemas ? queuedSchemas.map(fn) : []; | ||
} | ||
filter(fn) { | ||
const queue = Queue._queues[this._name]; | ||
return queue | ||
? queue.filter(fn) | ||
: []; | ||
return queue ? queue.filter(fn) : []; | ||
} | ||
@@ -157,3 +152,3 @@ toJSON() { | ||
const queue = Queue._queues[this._name]; | ||
const objectPayload = typeof lodash_1.first(queue) === 'object'; | ||
const objectPayload = typeof lodash_1.first(queue) === "object"; | ||
let index = 0; | ||
@@ -176,3 +171,2 @@ let result = [null, -1]; | ||
exports.default = Queue; | ||
; | ||
//# sourceMappingURL=queue.js.map |
{ | ||
"name": "firemock", | ||
"version": "0.11.3", | ||
"version": "0.11.4", | ||
"description": "firemock", | ||
@@ -8,12 +8,4 @@ "license": "MIT", | ||
"author": "Ken Snyder<ken@ken.net>", | ||
"keywords": [ | ||
"serverless", | ||
"typescript", | ||
"firebase", | ||
"mocking", | ||
"testing" | ||
], | ||
"files": [ | ||
"lib" | ||
], | ||
"keywords": ["serverless", "typescript", "firebase", "mocking", "testing"], | ||
"files": ["lib"], | ||
"main": "lib/index.js", | ||
@@ -20,0 +12,0 @@ "typings": "lib/index.d.ts", |
Sorry, the diff of this file is not supported yet
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
109062
1777