0.0.1 • Published 2 years ago

spectable v0.0.1

Weekly downloads
-
License
WTFPL
Repository
-
Last release
2 years ago

spectable

a set of tools for making your code more circumspect. spectable, you know, for kids...

ipCheck

There are 3 modes of operation

1) just get a boolean back

  const result = await ipCheck('154.145.11.3');// result = false (unless I guessed your ip)

2) call a fn with the boolean return from ipCheck

  const { log } = console;
  await ipCheck('154.145.11.3', log); // false printed on console 

3) call with 2 fns, one to run if it matches, and one to run if it misses.

  const matchFN = () => { console.log('yippie') };
  const missFN = () => { console.error('booo') };
  await ipCheck('thisdefinitely.isnot.your.ip', matchFN, missFN ); // booo printed to stderr.