Gathering detailed insights and metrics for @ptomulik/octokit-paginate-rest-limit
Gathering detailed insights and metrics for @ptomulik/octokit-paginate-rest-limit
Gathering detailed insights and metrics for @ptomulik/octokit-paginate-rest-limit
Gathering detailed insights and metrics for @ptomulik/octokit-paginate-rest-limit
npm install @ptomulik/octokit-paginate-rest-limit
Typescript
Module System
Node Version
NPM Version
70.4
Supply Chain
98.8
Quality
75.2
Maintenance
100
Vulnerability
100
License
TypeScript (95.76%)
Shell (2.17%)
JavaScript (2.06%)
Total Downloads
1,373
Last Day
5
Last Week
5
Last Month
24
Last Year
197
11 Commits
2 Watchers
2 Branches
1 Contributors
Updated on May 19, 2021
Minified
Minified + Gzipped
Latest Version
1.1.4
Package Id
@ptomulik/octokit-paginate-rest-limit@1.1.4
Unpacked Size
19.22 kB
Size
5.67 kB
File Count
16
NPM Version
7.13.0
Node Version
12.22.1
Cumulative downloads
Total Downloads
Last Day
400%
5
Compared to previous day
Last Week
-16.7%
5
Compared to previous week
Last Month
-41.5%
24
Compared to previous month
Last Year
5.9%
197
Compared to previous year
18
Provides callback function that limits number of entries returned by @octokit/plugin-paginate-rest.js.
The paginate method provided by @octokit/plugin-paginate-rest.js fetches all available entries page-by-page and returns them gathered into a single array. The octokit-paginate-rest-limit.ts allows to reduce the number of entries returned (and pages fetched) when only few first records are required.
Browsers |
Load
|
---|---|
Node |
Install
then import modules in your code
|
1import { Octokit } from "@octokit/core"; 2import { paginateRest } from "@octokit/plugin-paginate-rest"; 3import { limit, MapFunction } from "@ptomulik/octokit-paginate-rest-limit"; 4 5const MyOctokit = Octokit.plugin(paginateRest); 6const octokit = new MyOctokit(); 7 8type Response = { data: { tag_name: string }[] }; 9 10// Retrieve (no more than) 2 releases and print their tag names. 11octokit.paginate( 12 "GET /repos/{owner}/{repo}/releases", 13 {owner: "octokit", repo: "plugin-paginate-rest.js"}, 14 limit(2) as MapFunction<Response> 15).then((releases) => { 16 console.log(releases.map((release) => release.tag_name)); 17});
Example output
1[ 'v2.13.3', 'v2.13.2' ]
1import { Octokit } from "@octokit/core"; 2import { paginateRest } from "@octokit/plugin-paginate-rest"; 3import { limit } from "@ptomulik/octokit-paginate-rest-limit"; 4 5const MyOctokit = Octokit.plugin(paginateRest); 6const octokit = new MyOctokit(); 7 8type Response = { data: { tag_name: string }[] }; 9 10// Retrieve (no more than) 2 releases and print their tag names. 11octokit 12 .paginate( 13 "GET /repos/{owner}/{repo}/releases", 14 { owner: "octokit", repo: "plugin-paginate-rest.js" }, 15 limit(2, ({ data }: Response) => data.map((release) => release.tag_name)) 16 ) 17 .then((names) => { 18 console.log(names); 19 });
Pagination parameters may be adjusted with adjust(max, parameters)
.
This operation adjusts per_page
property of parameters
to avoid
fetching redundant records.
1import { Octokit } from "@octokit/core"; 2import { paginateRest } from "@octokit/plugin-paginate-rest"; 3import { limit, adjust, MapFunction } from "@ptomulik/octokit-paginate-rest-limit"; 4 5const MyOctokit = Octokit.plugin(paginateRest); 6const octokit = new MyOctokit(); 7const max = 2; 8 9type Response = { data: { tag_name: string }[] }; 10 11// Retrieve (no more than) `max` releases and print their tag names. 12// The `per_page` is set to `max`. 13octokit.paginate( 14 "GET /repos/{owner}/{repo}/releases", 15 adjust(max, {owner: "octokit", repo: "plugin-paginate-rest.js"}), 16 limit(max) as MapFunction<Response> 17).then((releases) => { 18 console.log(releases.map((release) => release.tag_name)); 19});
incompatible with paginate.iterator,
will cause bugs when a value (function) returned by limit()
is reused;
namely, this is WRONG:
1 const first = limit(1); 2 octokit.paginate(..., first); 3 octokit.paginate(..., first); // !!this will not work as one would expect!!
Copyright (c) 2021 by Paweł Tomulik ptomulik@meil.pw.edu.pl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
dependency not pinned by hash detected -- score normalized to 6
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
48 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-12
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More