https://github.com/thecommieaxolotl/thena
A simple, lightweight, and fast utility library for Node and the browser.
https://github.com/thecommieaxolotl/thena
browser node util utility
Last synced: 2 months ago
JSON representation
A simple, lightweight, and fast utility library for Node and the browser.
- Host: GitHub
- URL: https://github.com/thecommieaxolotl/thena
- Owner: TheCommieAxolotl
- License: mit
- Created: 2023-03-21T21:18:01.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T09:28:19.000Z (about 2 years ago)
- Last Synced: 2025-03-27T16:40:01.580Z (3 months ago)
- Topics: browser, node, util, utility
- Language: TypeScript
- Homepage: https://thenajs.vercel.app/
- Size: 91.8 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# thena
[](https://bundlejs.com/?q=thena) [](https://thenajs.vercel.app)A simple, lightweight, and fast utility library for Node and the browser.
```ts
import thena from 'thena'; // includes only browser-safe functions
import node from 'thena/node'; // includes both browser-safe and node-only functions// replace
for (let i = 0; i < 10; i++) {
console.log(i);
}const pkj = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkj.dependencies.thena = '^1.0.0';
fs.writeFileSync('package.json', JSON.stringify(pkj, null, 2));
// with
th.loop(10, () => {
console.log(i);
})const pkj = thena.stream('package.json')
pkj.dependencies.thena = '^1.0.0';
```## Utilities
### `thena`
- `each` - Iterates over an array or object and calls a function for each item.
- `loop` - Loops a function a specified number of times.
- `num` - Converts strings, arrays, and objects to numbers.
- `fetch` - Fetches a URL and returns a re-consumable response.### `thena/node`
*everything from `thena`*- `json` - Reads and parses a JSON file.
- `set` - Sets a value in a JSON file.
- `stream` - Read a JSON file and return a proxy that can be used to read and write to the file.
- `log` - Effortlessly colour and style your console logs.