Socket
Socket
Sign inDemoInstall

@rjweb/utils

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjweb/utils - npm Package Compare versions

Comparing version 1.4.3 to 1.4.4

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 1.4.4
- Add `array.rotate`
## 1.4.3

@@ -2,0 +6,0 @@

@@ -22,2 +22,3 @@ "use strict";

remove: () => remove,
rotate: () => rotate,
sum: () => sum

@@ -44,2 +45,9 @@ });

}
function rotate(input, rotations) {
const arr = Array.from(input);
for (let i = 0; i < rotations; i++) {
arr.push(arr.shift());
}
return arr;
}
function sum(input) {

@@ -51,3 +59,4 @@ return input.reduce((prev, current) => prev + current, 0);

remove,
rotate,
sum
});

2

lib/cjs/pckg.json
{
"name": "@rjweb/utils",
"version": "1.4.3",
"version": "1.4.4",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -19,2 +19,9 @@ function remove(input, mode, value) {

}
function rotate(input, rotations) {
const arr = Array.from(input);
for (let i = 0; i < rotations; i++) {
arr.push(arr.shift());
}
return arr;
}
function sum(input) {

@@ -25,3 +32,4 @@ return input.reduce((prev, current) => prev + current, 0);

remove,
rotate,
sum
};
{
"name": "@rjweb/utils",
"version": "1.4.3",
"version": "1.4.4",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -15,2 +15,15 @@ /**

/**
* Rotate an Array
* @example
* ```
* import { array } from "@rjweb/utils"
*
* const arr = ['A', 'B', 'C', 'D', 'E']
*
* array.rotate(arr, 2) // ['C', 'D', 'E', 'A', 'B']
* array.rotate(arr, 4) // ['E', 'A', 'B', 'C', 'D']
* ```
* @since 1.4.4
*/ export declare function rotate<Arr extends any[]>(input: Arr, rotations: number): Arr;
/**
* Get the Sum of Numbers in an Array

@@ -17,0 +30,0 @@ * @example

{
"name": "@rjweb/utils",
"version": "1.4.3",
"version": "1.4.4",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

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