New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

firebase-database-pagination

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firebase-database-pagination - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

28

index.js

@@ -1,11 +0,11 @@

/**
* @typedef {import('@firebase/database-types').DataSnapshot} DataSnapshot
* @typedef {import('@firebase/database-types').Reference} Reference
* @typedef {DataSnapshot & { key: string }} DataSnapshotChild
*/
/** @template D
*
/**
* @template D
* @callback Transformer<D>
* @param {DataSnapshot} snapshot Child of provided reference
* @param {DataSnapshotChild} snapshot Child of provided reference
* @returns {D | Promise<D>}

@@ -21,4 +21,4 @@ */

* @param {import('@firebase/database-types').Query} query
* @param {(item: DataSnapshot) => any} valueGetter
* @param {CursorLimits} limits
* @param {(item: DataSnapshotChild) => any} valueGetter
* @param {CursorLimits | undefined} limits
* @param {number} maxPageSize

@@ -53,3 +53,3 @@ * @param {Transformer<T>} transformer

// Same as just getting this child
const child = await cursorQuery.ref.child(_limits.endAt).get()
const child = /** @type {DataSnapshotChild} */ (await cursorQuery.ref.child(_limits.endAt).get())
if (!child.exists()) return { results: [], next: null }

@@ -78,5 +78,6 @@ return { results: [await transformer(child)], next: null }

const children = await cursorQuery.limitToFirst(maxPageSize).get()
/** @type {?Cursor} */
/** @type {Cursor?} */
let next = null
children.forEach(d => {
children.forEach(_d => {
const d = /** @type {DataSnapshotChild} */ (_d)
if (d.key !== starting.startingKey) {

@@ -93,9 +94,8 @@ transforms.push(Promise.resolve(transformer(d)))

// Returned less data than a full page, so no more items
return { results, next: null }
} else {
return { results, next }
next = null
}
return { results, next }
}
/** @type {Cursor} */
/** @type {Cursor?} */
let previous = { startingKey: null, startAt: _limits.startAt }

@@ -113,3 +113,3 @@ /** @type {T[]} */

/** @param {DataSnapshot} d */
/** @param {DataSnapshotChild} d */
const orderByKeyGetter = d => d.key

@@ -116,0 +116,0 @@

{
"name": "firebase-database-pagination",
"version": "3.0.0",
"version": "4.0.0",
"description": "Pagination for Firebase RTDB",

@@ -20,3 +20,3 @@ "main": "index.js",

"engines": {
"node": ">=12"
"node": ">=14"
},

@@ -36,3 +36,3 @@ "scripts": {

"eslint": "^8.11.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-mocha": "^10.0.3",
"eslint-plugin-node": "^11.1.0",

@@ -39,0 +39,0 @@ "firebase-admin": "^10.0.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc