r/javascript • • Apr 11 '26

We transpiled PHPUnit (54k lines, 412 files) to JavaScript. 61.3% of tests passing

Thumbnail pext.dev
0 Upvotes

r/javascript • • Jul 21 '14

Revolutionary New Markup Language

Thumbnail
github.com
11 Upvotes

r/javascript • • Aug 02 '20

4 Nice and Simple React Hooks

Thumbnail
medium.com
0 Upvotes

r/javascript • • Sep 30 '21

I wrote a guide on how you can mint an NFT with JavaScript if anyone is curious!

Thumbnail
dev.to
1 Upvotes

r/javascript • • Oct 09 '18

Writing Lighter, Faster JavaScript Functions

Thumbnail
medium.com
40 Upvotes

r/javascript • • Aug 17 '25

Got tired of try-catch everywhere in TS, so I built a Result type that's just a tuple

Thumbnail github.com
0 Upvotes

Ever get tired of wrapping every JSON.parse() in try-catch? Been using Result libraries in TypeScript for a while, but got frustrated with the usual suspects.

What I wanted was something this simple:

 const [ok, error, value] = t(() => JSON.parse('invalid'));
 if (ok) {
   console.log(value); // parsed data
 } else {
   console.log(error); // SyntaxError
 }

No more try-catch blocks, no more .value/.error boilerplate, just destructure and go.

The main pain points with existing libraries:

  • Hard to serialize - can't return from API endpoints without manual extraction (e.g. React Router loader)

  • Bloated - unnecessary class hierarchies and methods

  • Boilerplate - constant .value and .error everywhere

So I built tuple-result - a functional Result library that's literally just a 3-element array [boolean, E, T] with helper functions.

 // Traditional Result pattern (still works!)
 const result = Ok(42);
 if (result.isOk()) {
   console.log(result.value); // 42
 } else {
   console.log(result.error);
 }
 
 // "New" destructuring pattern (no more .value/.error boilerplate)
 const [ok, error, value] = result;
 if (ok) {
   console.log(value); // 42
 }
 
 // Try wrapper for any function that might throw
 const parseResult = t(() => JSON.parse(userInput));
 const dbResult = t(() => db.user.findUnique({ where: { id } }));
 
 // Functional helpers
 const doubled = mapOk(result, x => x * 2);
 const message = match(result, {
   ok: (value) => `Success: ${value}`,
   err: (error) => `Error: ${error}`
 });

Key differences from ts-results/neverthrow:

  • Just arrays - easy to serialize, works in Remix loaders, JSON responses

  • Functional approach - pure helper functions, no classes

  • Tree-shakable - import only what you need

  • Type-safe - full TypeScript literal types

  • Bundle size - core (Ok/Err only) ~150B, full library ~500B

The destructuring pattern was inspired by the ECMAScript Try Operator proposal - mixed that idea with my Result library needs.

Still experimental but definitely usable in production. Curious if others have hit the same serialization and boilerplate issues with Result libraries?

GitHub: github.com/builder-group/community/tree/develop/packages/tuple-result


r/javascript • • Sep 06 '15

Replace the word β€˜migrant’ with β€˜fellow human’ with a single click (bookmarklet)

Thumbnail
dholmes.co.uk
2 Upvotes

r/javascript • • Jan 12 '23

JavaScript localStorage: The complete guide

Thumbnail deadsimplechat.com
2 Upvotes

r/javascript • • Jan 03 '15

Why you should not use AngularJs

Thumbnail
medium.com
2 Upvotes

r/javascript • • Oct 14 '17

JavaScript's Promise Leaks Memory

Thumbnail
alexn.org
5 Upvotes

r/javascript • • May 28 '21

20 JavaScript Concepts you should know as a JavaScript Programmer!

Thumbnail
blog.devgenius.io
3 Upvotes

r/javascript • • Nov 01 '19

AskJS [AskJS] Does anyone still use plain Javascript (as opposed to Typescript) for any serious project? Why? What are the benefits (for you, anyway)?

4 Upvotes

r/javascript • • Sep 20 '18

The Solo JavaScript Developer Challenging Google and Facebook

Thumbnail
wired.com
52 Upvotes

r/javascript • • Apr 11 '16

React Router is dead. Long live rrtr.

Thumbnail
medium.com
7 Upvotes

r/javascript • • Apr 04 '23

Are TypeScript Enums Really Harmful?

Thumbnail
blog.theodo.com
27 Upvotes

r/javascript • • May 03 '10

50 jQuery Snippets That Will Help You Become A Better JavaScript Developer

Thumbnail addyosmani.com
0 Upvotes

r/javascript • • Mar 28 '16

Babel 6 - useless by default - a lesson in how NOT to design software.

Thumbnail fourlightyears.blogspot.com
0 Upvotes

r/javascript • • Nov 16 '12

A Case for Coffeescript

Thumbnail
blog.gaslight.co
1 Upvotes

r/javascript • • Sep 18 '22

New Strings Method in ES6 JavaScript

Thumbnail
techynidhi.hashnode.dev
0 Upvotes

r/javascript • • Apr 07 '24

A proposal to add signals to JavaScript

Thumbnail
github.com
1 Upvotes

r/javascript • • Apr 05 '16

Vue.js, the real Angular 2.0

Thumbnail
medium.com
2 Upvotes

r/javascript • • Jan 13 '16

Please, Please Don’t Use β€œCSS in JS”

Thumbnail
medium.com
2 Upvotes

r/javascript • • May 06 '17

UglifyJS releases a breaking release with no changelog

Thumbnail
github.com
0 Upvotes

r/javascript • • Jun 12 '22

How to use bootstrap in React

Thumbnail
devtip.co
0 Upvotes