Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@appolo/utils

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appolo/utils - npm Package Compare versions

Comparing version 8.0.33 to 8.0.34

lib/chainObject.js

15

lib/arrays.js

@@ -38,2 +38,17 @@ "use strict";

}
static range(start, end, increment) {
const isEndDef = typeof end !== 'undefined';
end = isEndDef ? end : start;
start = isEndDef ? start : 0;
if (typeof increment === 'undefined') {
increment = Math.sign(end - start);
}
const length = Math.abs((end - start) / (increment || 1));
let arr = Array.from({ length }), current = start;
for (let i = 0; i < length; i++) {
arr[i] = current;
current = current + increment;
}
return arr;
}
static random(arr) {

@@ -40,0 +55,0 @@ if (!arr || !arr.length) {

@@ -46,2 +46,24 @@ import {Classes} from "./classes";

public static range(start: number, end?: number, increment?: number): number[] {
const isEndDef = typeof end !== 'undefined'
end = isEndDef ? end : start
start = isEndDef ? start : 0
if (typeof increment === 'undefined') {
increment = Math.sign(end - start)
}
const length = Math.abs((end - start) / (increment || 1));
let arr: number[] = Array.from({length}),
current = start;
for (let i = 0; i < length; i++) {
arr[i] = current;
current = current + increment
}
return arr
}
public static random<T>(arr: T[]): T {

@@ -48,0 +70,0 @@

3

lib/chain.js

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

const arrays_1 = require("./arrays");
const chainObject_1 = require("./chainObject");
class Chain {

@@ -141,5 +142,5 @@ constructor(_value) {

function _(arr) {
return new Chain(arr);
return Array.isArray(arr) ? new Chain(arr) : new chainObject_1.ChainObject(arr);
}
exports._ = _;
//# sourceMappingURL=chain.js.map
import {Arrays} from "./arrays";
import {ChainObject} from "./chainObject";

@@ -180,5 +181,6 @@ export class Chain<K> {

}
export function _<K>(arr: K[]): Chain<K> {
return new Chain(arr);
export function _<K>(arr: K[]): Chain<K>
export function _<K extends object>(arr: K): ChainObject<K>
export function _<K = any>(arr: K[]): Chain<K> | ChainObject<any> {
return Array.isArray(arr) ? new Chain<K>(arr) : new ChainObject<any>(arr as any)
}

@@ -20,3 +20,3 @@ {

"main": "./index.js",
"version": "8.0.33",
"version": "8.0.34",
"license": "MIT",

@@ -23,0 +23,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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