Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 24, 2019
1 parent ec25adc commit 5de0632
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import ColorClass = require('color');
declare namespace Randoma {
interface Options {
/**
[Initialization seed.](https://en.m.wikipedia.org/wiki/Random_seed) Multiple instances of `Randoma` with the same seed will generate the same random numbers.
[Initialization seed.](https://en.wikipedia.org/wiki/Random_seed) Multiple instances of `Randoma` with the same seed will generate the same random numbers.
*/
seed: string | number;
readonly seed: string | number;
}

type Color = ColorClass;
Expand Down
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ class Randoma {
return Math.floor(Math.random() * MAX_INT32);
}

constructor(options = {}) {
let {seed} = options;

constructor({seed}) {
if (typeof seed === 'string') {
seed = stringHash(seed);
}
Expand Down Expand Up @@ -57,9 +55,7 @@ class Randoma {
return new Date(this.integerInRange(startDate.getTime(), endDate.getTime()));
}

color(saturation) {
saturation = saturation || 0.5;

color(saturation = 0.5) {
let hue = this.float();
hue += GOLDEN_RATIO_CONJUGATE;
hue %= 1;
Expand Down

0 comments on commit 5de0632

Please sign in to comment.