GithubHelp home page GithubHelp logo

raiondesu / js-random Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 258 KB

A collection of simple and lightweight randomizers for JavaScript (TypeScript friendly)

Home Page: https://www.npmjs.com/package/@js-random/all

License: MIT License

JavaScript 23.43% TypeScript 76.57%
js ts typescript javascript string number boolean array random simple lightweight es5 micropackage monorepo

js-random's Introduction

js-random's People

Contributors

raiondesu avatar

Watchers

 avatar  avatar  avatar

js-random's Issues

Add `@js-random/string`

declare function randomString(length?: number, seed?: string, filter?: RegExp): string;
declare function randomString(options: {
  length?: number,
  seed?: string,
  filter?: RegExp
}): string;

Add tests for packages

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 `@js-random/html-element`

declare function randomHtmlElement(options?: {
  attributes?: { [name: string]: string; },
  classes: string[],
  seed?: HTMLElement[] | Array<typeof HTMLElement>
}): HTMLElement;

Make versions with side effects

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

Add `@js-random/object`

declare function randomObject(options?: {
  seed?: object,
  valueTypes?: string[] | Array<String | Object | Function | Array | Object>,
  depth?: number,
  keysAmount?: number | {
    from: number,
    to: number
  }
})

Add `@js-random/function`

declare function randomFunction(options?: {
  seed?: Array<Function> | object;
  throwErrors?: boolean;
}): Function;

Add `@js-random/cat`

// Returns a URL to a random cat (´・ω・`)
declare function randomCat(type: 'gif' | 'image' | 'video'): string;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.