GithubHelp home page GithubHelp logo

spongemock's Introduction

Spongemock

This library provides resources for working with text to transform it into Spongebob mocking meme text.

sPoNgEBoB

Algorithm

At first, I thought that the letters started with lowercase and just alternated.

aT fIrSt, I tHoUgHt...

However, after reviewing quite a few uses of the meme, I found that there is an element of randomness to it.

This library will inspect the text and transform letters to uppercase or lowercase according to the following algorithm:

  1. If a non-ASCII or non-letter is encountered, it is ignored
  2. The first letter encountered has a 50% chance of being upper or lowercase
  3. If the next letter encountered is a different case, it has a 15% chance of being transformed (85% chance of staying a different case). This means that an or AN arrangements should appear infrequently, but occassionally. An or aN arrangements will appear often.
  • If the next letter encountered is the same case, it thus has a 85% chance of being transformed.
  1. If a letter is the same case as two previous letters, it has a 98% chance of being transformed. Arrangements of three of the same case as in ana or ANA are rare, but I have seen them occur in these memes.

Usage

import { spongeMock } from 'spongeMock';
spongeMock("This is a test string.");
// 'tHiS iS a TeSt StRiNg.'

Simple as that.

CLI

You can yarn global add spongemock to add a cli tool that allows you to spongemockify strings and files. You can give it a list of files to mock or else it will read from stdin.

spongemock README.md
git log | spongemock
spongemock -e "works on strings with -e argument"

spongemock's People

Contributors

ajcrites avatar

Stargazers

 avatar Florian Reichert avatar Zain Wania avatar Lloyd Atkinson avatar Aaron Belz avatar Scott Jones avatar Camille Appert avatar  avatar Hunter Parks avatar Bjorn Stange avatar Sam Gluck avatar Vincent M. van der Meulen avatar Brandon Semilla avatar Firoze Rakib avatar Daniel Durante avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.