April-fools

april-fools

Randomly fool with an Error on April 1st.

⚠️ This is a foolproof way to lose friends and alienate people. Will likely get you fired!

Few lines of code to have fun on April fools day:

1
2
3
4
5
6
7
8
9
'use strict'

const date = new Date()

if (date.getMonth() === 3 && date.getDate() === 1 && Math.floor(Math.random() * 6) + 1 === 1) {
  const message = require('sentencer').make("Unexpected  with  ")

  throw new Error(message)
}

Related module -> sentencer.

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
require('april-fools'); // That's it! And it would randomly throw an error like below.

Error: Unexpected lunch with a brindle ravioli
    at Object.<anonymous> (/private/tmp/node_modules/april-fools/index.js:8:9)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)

GIF FTW

april-fools

Suggest a module

Comments