raiondesu / js-random Goto Github PK
View Code? Open in Web Editor NEWA collection of simple and lightweight randomizers for JavaScript (TypeScript friendly)
Home Page: https://www.npmjs.com/package/@js-random/all
License: MIT License
A collection of simple and lightweight randomizers for JavaScript (TypeScript friendly)
Home Page: https://www.npmjs.com/package/@js-random/all
License: MIT License
declare function randomArray(length?: number, seed?: any[]): any[];
declare function randomHtmlElement(options?: {
attributes?: { [name: string]: string; },
classes: string[],
seed?: HTMLElement[] | Array<typeof HTMLElement>
}): HTMLElement;
declare function randomBigInt(min?: number | BigInt, max?: number | BigInt): BigInt;
declare function randomDate(range?: { from: Date, to: Date }): Date;
// Returns a URL to a random cat (´・ω・`)
declare function randomCat(type: 'gif' | 'image' | 'video'): string;
declare function random(): any;
Added tests for:
number
string
date
boolean
function
object
array
There are __tests__
folders in each package's directories. These are prepared to run tests. All the dependencies are ready and installed. Only tests themselves are absent...
Add versions of packages that assign themselves as random()
functions to the constructor of a respective type, like Constructor.random()
For example:
Number.random();
String.random();
Boolean.random();
Object.random();
...
Usage would then be (for number
, for example):
import '@js-random/number/integrate';
//or
require('@js-random/number/integrate');
// and then
Number.random(0, 10); // random number from 0 to 10
declare function randomFunction(options?: {
seed?: Array<Function> | object;
throwErrors?: boolean;
}): Function;
declare function randomString(length?: number, seed?: string, filter?: RegExp): string;
declare function randomString(options: {
length?: number,
seed?: string,
filter?: RegExp
}): string;
declare function randomObject(options?: {
seed?: object,
valueTypes?: string[] | Array<String | Object | Function | Array | Object>,
depth?: number,
keysAmount?: number | {
from: number,
to: number
}
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.