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

@naturalcycles/js-lib

Package Overview
Dependencies
Maintainers
2
Versions
525
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/js-lib - npm Package Compare versions

Comparing version 14.192.1 to 14.193.0

12

dist-esm/number/number.util.js

@@ -12,2 +12,14 @@ export function _randomInt(minIncl, maxIncl) {

}
/**
* Convenience function to "throttle" some code - run it less often.
*
* @example
*
* if (_runLessOften(10)) {
* // this code will run only 10% of the time
* }
*/
export function _runLessOften(percent) {
return Math.random() * 100 < percent;
}
// todo: _.random to support floats

@@ -14,0 +26,0 @@ /**

@@ -10,2 +10,12 @@ import { SortDirection } from '../types';

/**
* Convenience function to "throttle" some code - run it less often.
*
* @example
*
* if (_runLessOften(10)) {
* // this code will run only 10% of the time
* }
*/
export declare function _runLessOften(percent: number): boolean;
/**
* _inRange(-10, 1, 5) // false

@@ -12,0 +22,0 @@ * _inRange(1, 1, 5) // true

15

dist/number/number.util.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._round = exports._toPrecision = exports._toFixed = exports._sortNumbers = exports._clamp = exports._inRange = exports._randomArrayItem = exports._randomInt = void 0;
exports._round = exports._toPrecision = exports._toFixed = exports._sortNumbers = exports._clamp = exports._inRange = exports._runLessOften = exports._randomArrayItem = exports._randomInt = void 0;
function _randomInt(minIncl, maxIncl) {

@@ -17,2 +17,15 @@ return Math.floor(Math.random() * (maxIncl - minIncl + 1) + minIncl);

exports._randomArrayItem = _randomArrayItem;
/**
* Convenience function to "throttle" some code - run it less often.
*
* @example
*
* if (_runLessOften(10)) {
* // this code will run only 10% of the time
* }
*/
function _runLessOften(percent) {
return Math.random() * 100 < percent;
}
exports._runLessOften = _runLessOften;
// todo: _.random to support floats

@@ -19,0 +32,0 @@ /**

2

package.json
{
"name": "@naturalcycles/js-lib",
"version": "14.192.1",
"version": "14.193.0",
"scripts": {

@@ -5,0 +5,0 @@ "prepare": "husky install",

@@ -16,2 +16,15 @@ import { SortDirection } from '../types'

/**
* Convenience function to "throttle" some code - run it less often.
*
* @example
*
* if (_runLessOften(10)) {
* // this code will run only 10% of the time
* }
*/
export function _runLessOften(percent: number): boolean {
return Math.random() * 100 < percent
}
// todo: _.random to support floats

@@ -18,0 +31,0 @@

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