Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Simple pagination module for arrays.
npm install arrpag --save
yarn add arrpag
bower install arrpag --save
The return object
is an object of this format:
/**
* @property currentPage - the current page - number
* @property nextPage - the next page - number
* @property prevPage - the previous page - number
* @property perPage - number of elements per page
* @property pages - total number of available pages
* @property results - the paginated sub-array from the given array
* @property totalCurrentResults - total number of current paginated items
* @property totalResults - total number of results -> should be the initial array lengt
*/
export interface IPaginationResult {
totalResults: number;
results: any[];
pages: number;
currentPage: number;
prevPage: number;
nextPage: number;
perPage: number;
totalCurrentResults: number;
}
const paginator = require("arrpag");
// ...
const arr = [1, 2, 3, 4, 5];
const paginationResult = paginator.paginate(arr, 2, 3);
import { paginate } from "arrapg";
// ...
const arr = [1, 2, 3, 4, 5];
const paginationResult = paginate(arr, 2, 3);
define(function(require, exports, module) {
var paginate = require("arrpag");
});
For the previous example the output should be:
{
totalResults: 5,
results: [ 4, 5 ],
pages: 2,
currentPage: 2,
prevPage: 1,
nextPage: 2,
perPage: 3,
totalCurrentResults: 2
}
npm run test
FAQs
Paginate the array
We found that arrpag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.