Is stupid
A package to figure out if one is stupid.
Get Started
Installation
-
Install using
npm
:npm i is-stupid
-
Install using
yarn
:yarn install is-stupid
-
With
Deno
:import isStupid from 'https://unpkg.com/is-stupid/dist/index.js'
Basic Usage
This package uses both default exports and named exports, as such, it requires ES modules to be used.
For modern environments with ES module support (such as typescript
, or usage with bundlers):
import isStupid from 'is-stupid';
if (isStupid) {
console.log('oh no');
}
In CommonJS environments (such as Node), you may use esm
to import it:
const isStupid = require('esm')(module)('is-stupid');
API
boolean
[default]: A pre-calculated value for performance reasons.
import isStupid from 'is-stupid';
isStupid;
() => boolean
recalculate: Do calculation during runtime for maximum accuracy.
import { recalculate } from 'is-stupid';
recalculate();
() => StupidItem
smartRecalculate: Use heuristics, as well as additional utility functions. Can be slower than above functions.
import { smartRecalculate } from 'is-stupid';
smartRecalculate();
class extends Boolean
StupidItem: An item wrapping around Boolean
to provide further functionality.
boolean
StupidItem.IS_SURE: A variable indicating how sure the item is.
StupidItem.IS_SURE
() => boolean
StupidItem.prototype.isSureAboutBeingSure: Attempt to persuade the item.
smartRecalculate()
.isSureAboutBeingSure()
() => Promise<boolean>
StupidItem.prototype.takeSomeTimeToRethinkIsSure: Asynchronously give time for the item to think about it.
await smartRecalculate()
.takeSomeTimeToRethinkIsSure()
() => boolean
StupidItem.prototype.takeSomeTimeToRethinkIsSureSync: Synchronously give time for the item to think about it.
await smartRecalculate()
.takeSomeTimeToRethinkIsSureSync()
() => boolean
StupidItem.prototype[Symbol.toPrimitive]: Converts the item to a primitive.
stupidItem[Symbol.toPrimitive]()
Testing
Install dev-dependencies, then test:
$ npm i -D && npm t
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jason Lim
License
Copyright © 2021 Jason Lim. Released under the WTFPL license.