newtonify
v1.0.8
Published
Newton School of Technology's official fun npm package ππ‘ (thanks, gravity!)
Maintainers
Readme
π§© Usage
Import
Use destructuring to import the functions you need:
const {
newtonify,
lawOfCoding,
appleFall,
gravityText,
newtonRandom
} = require('newtonify');π§² 1. newtonify(text, mode)
Adds a Newton-inspired twist (with emojis and humor) to any message.
| Mode | Description |
| :---------- | :------------------------------------- |
| light | For simple, light-hearted messages. |
| heavy | For intense or "buggy" situations. |
| discovery | For moments of insight or realization. |
console.log(newtonify("Learning JavaScript", "discovery"));
console.log(newtonify("Debugging life", "heavy"));Output:
Learning JavaScript π§ (thanks, gravity!)
Debugging life β‘β‘ (thanks, gravity!)π§ 2. lawOfCoding(num?)
Returns one of Newtonβs "Laws of Coding" β funny and relatable programming truths. Pass a number to get a specific law, or call it without arguments for a random one.
console.log(lawOfCoding()); // Get a random law
console.log(lawOfCoding(2)); // Get the 2nd lawExample Output:
Newton's 2α΅Κ° Law of Coding:
A coder in motion stays in motion unless stopped by production bugs. π§βπ»π₯ 3. appleFall(text, mode?)
Literally drop an apple π or an idea π‘ around your message.
| Mode | Output Symbol | Default? |
| :------ | :------------ | :------- |
| apple | π | β
|
| idea | π‘ | β |
console.log(appleFall("Eureka!", "apple"));
console.log(appleFall("New idea incoming!", "idea"));Output:
π Eureka! π
π‘ New idea incoming! π‘π 4. gravityText(text, delay?)
Simulates gravity pulling your text down. Each letter prints on a new line with a specified delay (in milliseconds).
Great for fun console effects! Note: This is an async function.
await gravityText("Newton School", 150);Output:
N
e
w
t
o
n
S
c
h
o
o
lπ§ͺ 5. newtonRandom()
Retrieves a random, witty Newton fact, quote, or coding-related line.
console.log(newtonRandom());Possible Outputs:
Gravity pulled apples, curiosity pulls coders. π
An object at rest stays at rest until the next deadline hits. π
Innovation is just applied curiosity. ππ‘ Function Summary
| Function | Description | Example |
| :----------------------------- | :---------------------------------------------------------------------- | :-------------------------------- |
| π§² newtonify(text, mode) | Adds Newton-style emojis & humor (light, heavy, discovery modes). | newtonify("Debugging", "heavy") |
| π§ lawOfCoding(num?) | Returns a random or numbered βLaw of Coding.β | lawOfCoding(3) |
| π₯ appleFall(text, mode?) | Adds π (default) or π‘ around your text. | appleFall("Eureka!", "idea") |
| π gravityText(text, delay?) | Animates text vertically (like gravity) with a delay (ms). | await gravityText("Newton") |
| π§ͺ newtonRandom() | Returns a random Newton fact or quote. | newtonRandom() |
π Why We Built This
This project was created by students of Newton School of Technology to combine creativity π¨ with code π». It served as a valuable, hands-on learning experience covering core development concepts:
- β String manipulation and regex
- β Asynchronous functions and delays
- β JS modules & exports
- β The npm publishing process
- β Collaboration & open-source contribution
π¬ Contributing
Have a cool, Newton-inspired idea? π Weβd love to see your creativity!
- Fork this repository.
- Add your new feature or function (like
inertiaMode()π). - Create a descriptive pull request.
Your idea could be the next gravity-defying addition! π
π License
MIT License Β© Newton School of Technology Made with β€οΈ, curiosity, and gravity ππ‘
βGravity pulled apples. Curiosity pulls coders.β β Newton School of Technology
