julijane / letter-spacing

PLEASE NOTE: THIS IS A JOKE/TROLL! ///////// Add letter spacing to strings, for the browser and node.js. With or without ~~you~~ Promises.
MIT License
21 stars 1 forks source link

letter-spacing

npm version build status code coverage install size npm downloads stupid

Add letter spacing to strings, for the browser and node.js. With or without you Promises.

Features

Browser Support

Chrome Firefox Safari Opera Edge IE
Latest ✔ Latest ✔ Latest ✔ Latest ✔ Latest ✔ lol ❌

For illustration purposes only.

Installing

Being sane:

$ yarn add letter-spacing

Using npm:

$ npm install letter-spacing

Using cdn:

Coming soon

Example

const {spaced} = require('letter-spacing')

let example = 'YOU PUT AT RISK MILLIONS OF PEOPLE'
process.stdout.write(spaced(example))

Result:

Y O U   P U T   A T   R I S K   M I L L I O N S   O F   P E O P L E

letter-spacing API

Synchronous Methods

spaced(str, [spacing=1])
spaced('yes, even webscale', 2)
y  e  s  ,     e  v  e  n     w  e  b  s  c  a  l  e
spacedUp(str, [spacing=1])

Space the text and convert it to uppercase.

spacedUp('code level x10')
C O D E   L E V E L   X 1 0

spacedCake(str)

Print the text as a nice box.

spacedCake('accidentally quadratic')
a c c i d e n t a l l y   q u a d r a t i c
c                                         i
c                                         t
i                                         a
d                                         r
e                                         d
n                                         a
t                                         u
a                                         q
l                                          
l                                         y
y                                         l
                                          l
q                                         a
u                                         t
a                                         n
d                                         e
r                                         d
a                                         i
t                                         c
i                                         c
c i t a r d a u q   y l l a t n e d i c c a

spacedCube(str)

Print the text as a cube.

spacedCube('WILL IT BLEND')
W I L L   I T   B L E N D
I                       N N
L                       E   E
L                       L     L
                        B       B
I                                  
T                       T           T
                        I             I
B                                        
L                       L                 L
E                       L                   L
N                       I                     I
D N E L B   T I   L L I W                       W
  N                       I                     I
    E                       L                   L
      L                       L                 L
        B                                        
                                  I             I
            T                       T           T
              I                                  
                                        B       B
                  L                       L     L
                    L                       E   E
                      I                       N N
                        W I L L   I T   B L E N D
decaps(str, [spacing=1])

Reverses the string before spacing.

decaps('lol')
l o l

Promised methods

Welcome to the promised land. The functions above are also available in promised versions:

spacedPromise(str, [spacing=1])
spacedUpPromise(str, [spacing=1])
spacedCakePromise(str)
spacedCubePromise(str)
decapsPromise(str, [spacing=1])

Example:

spacedPromise('some text').then((str=>console.log(str)))
let str = await spacedPromise('some other text')

Guarantees

I guaranty the following as soon as this package is required by lots of other packages:

This guarantee will always be valid until the exact moment. Void where prohibited or when I change my mind.

Resources

Credits

letter-spacing is inspired by await-sleep. Ultimately letter-spacing is an effort to provide a await-sleep-like one liner(s) module for use outside of sanity.

Some other inspirations were left-pad, event-stream, flatmap-stream and /r/programmingcirclejerk, especially the comments in the discussion about this package

License

MIT

If you didn't get it by now

This package is meant as a joke. If you seriously consider using this in one of your projects, you should be banned 5 meters from every device which can be programmed, including your microwave oven.

Read these:

The point is: Don't blindly add random npm packages, especially if they contain code you could easily duplicate into your own project like the oneliners from this project.

Final Disclaimer

This packages might be fit for some purpose but it is hereby declared unfit for any purpose. If you don't understand, you probably shouldn't use this package. If you do, you probably wouldn't use this package.