From 5de0632c5fafb2bebf0d985664ef47acbbfa64b8 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 24 Apr 2019 10:35:20 +0700 Subject: [PATCH] Meta tweaks --- index.d.ts | 4 ++-- index.js | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/index.d.ts b/index.d.ts index 2aefbe2..16e901a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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; diff --git a/index.js b/index.js index 7294033..7e638dc 100644 --- a/index.js +++ b/index.js @@ -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); } @@ -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;