Files
DefinitelyTyped/types/entropy-string/entropy-string-tests.ts
Aaron Leopold 826c88fdf6 added type definitions for entropy-string 4.2 (#56121)
* added typedef for entropy-string

* changes to pass tests
2021-10-01 16:09:51 -07:00

25 lines
804 B
TypeScript

import { Entropy, charset64, CharSet } from 'entropy-string';
const entropy = new Entropy();
console.log(entropy.string());
const entropy2 = new Entropy({ total: 1e6, risk: 1e9 });
console.log(entropy2.string());
const entropy3 = new Entropy({ total: 1e6, risk: 1e9, charset: '0123456789ABCDEF' });
console.log(entropy3.string());
const entropy4 = new Entropy({ charset: new CharSet('0123456789ABCDEF') });
console.log(entropy4.string());
const entropy5 = new Entropy();
entropy5.useChars('0123456789ABCDEF');
console.log(entropy5.smallID());
const entropy6 = new Entropy({ charset: charset64 });
console.log(entropy6.string());
// This should throw a type error, as the Options type requires at least
// one of the optional properties from the Opts interface
// const entropy7 = new Entropy({});