r/javascript • • Feb 20 '16

Show Reddit: I made a tool to fix frontend dev environment complexity - "easyfront". Any feedback about the idea?

Thumbnail
github.com
0 Upvotes

r/javascript • • Oct 29 '08

JSAway - 3D in Javascript

Thumbnail geepers.co.uk
0 Upvotes

r/javascript • • Jan 20 '20

SOLID: Interface Segregation Principle in JavaScript and TypeScript

Thumbnail
medium.com
0 Upvotes

r/javascript • • Aug 27 '20

light-date - Blazing fast & lightweight (157 bytes) date formatting for Node.js and the browser.

Thumbnail
github.com
0 Upvotes

r/javascript • • Feb 16 '22

AskJS [AskJS] I made a VSCode extension that finds functional and logic bugs in JS code

0 Upvotes

It understands your code and developer's intent, finds bugs, highlights them and suggests the fixes. Provides the best value during the development: write a function, test the output and if not as expected - run it to determine whats wrong and catch bugs. The extension is available in VSCode Marketplace now.

Please check it out and give me some feedback: https://gettensorbox.com .
Demo video link is in the comments.


r/javascript • • Sep 03 '25

Creating a JavaScript Debugging Utility to Guard Noisy Production Consoles

Thumbnail
magill.dev
0 Upvotes

I want everyone to know how clever this code is, so I shared it here.


r/javascript • • Mar 30 '26

Cookie Banners for shadcn/ui

Thumbnail
openpolicy.sh
0 Upvotes

We build a cookie banner component as a shadcn registry item so the component lives in your repo rather than loading from a CDN.

One command to install, styled with Tailwind, and driven by a single config file that also powers your Privacy Policy and Cookie Policy docs.

ConsentGate can conditionally render scripts based on what the user consented to.


r/javascript • • Mar 27 '24

AskJS [AskJS] Are there any component libraries left that are not for React?

0 Upvotes

Don’t asky why, I know everyone does React/Vue these days. I know of Shoelace, but they miss some critical UI components (autocomplete with backend data for example). Everything else is either 10 years old or require jQuery. Looking for a kit or a list of components built with modern Vanilla JS.


r/javascript • • Nov 07 '25

AskJS [AskJS] Rate my .env parser

0 Upvotes

Not sure if this will be removed, due to not having the title be in the question form, but you understand what I mean..

Here it is:

import process from 'node:process';

const cache = new Map<string, unknown>();

function expand(value: string, depth = 0): string {
	if (value === '' || depth > 10) return value;
	return value.replaceAll(/\${([^}]+)}|\$(\w+)/gi, (_: string, braced?: string, simple?: string) => {
		const key = (braced ?? simple)!;
		const [ref, fallback] = key.split(':-');
		const refValue = process.env[ref];
		if (refValue !== undefined) return expand(refValue, depth + 1);
		return fallback ?? '';
	});
}

function cast<T>(value: string): T {
	const lower = value.toLowerCase();
	if (lower === 'true') return true as T;
	if (lower === 'false') return false as T;
	if (lower === 'null') return null as T;

	if (value.trim() !== '') {
		const number = Number(value);
		if (!Number.isNaN(number) && String(number) === value) return number as T;
	}

	if ((value.startsWith('{') && value.endsWith('}')) || (value.startsWith('[') && value.endsWith(']'))) {
		try {
			return JSON.parse(value) as T;
		} catch {
			/* ignore */
		}
	}

	return value as T;
}

/**
 * Returns an environment variable, parsed and cached.
 *
 * Features:
 * - Expands nested refs like ${FOO} or $BAR
 * - Converts "true"/"false"/"null" and numeric strings
 * - Parses JSON arrays/objects
 * - Caches resolved values
 * - Returns `defaultValue` if environment variable is missing; logs an error if both value and default are empty
 */
export function env<T = string>(key: string, defaultValue?: T): T {
	if (cache.has(key)) return cache.get(key) as T;

	const raw = process.env[key];
	if (raw === undefined || raw.trim() === '') {
		if (defaultValue === undefined) {
			console.error(`Missing required environment variable: ${key}`);
			return defaultValue as T;
		}

		cache.set(key, defaultValue as T);
		return defaultValue as T;
	}

	const expanded = expand(raw);
	const value = cast(expanded);

	cache.set(key, value as T);
	return value as T;
}

PS: I have no idea how Laravel's env() function works under the hood, only that it allows for default values, if the key is missing or has no value in the .env file.


r/javascript • • Oct 28 '25

Fought ESM-only Faker v10 with Jest... My blood, sweat, and transformIgnorePatterns tears.

Thumbnail
orrymr.substack.com
0 Upvotes

This ESM vs CommonJS thing hurts my brain sometimes.


r/javascript • • May 15 '16

Is React the new jQuery?

Thumbnail
medium.com
0 Upvotes

r/javascript • • Apr 10 '14

"colbert bump makes unofficial .js logo, rather official .js logo"

Thumbnail
pbs.twimg.com
0 Upvotes

r/javascript • • May 12 '20

AskJS [AskJS] Is it just me or is the Async/Await pattern NOT easier to understand/use in a lot of cases?

1 Upvotes

I get it, await CAN be easier to understand for some cases, but a lot of the examples I see out there (both in production code and in example blogs) seem to hand-wave some assumptions, while deriding promises for making some of it's own.

One example is right from MDN here where then is a swear word. You are making an assumption that the developer knows that fetch body blob() is an promise/await-able function. If you didn't know that and ran the example as follows:

async function myFetch() {
    let response = await fetch('coffee.jpg');
    let myBlob = response.blob(); // removed await
    ....

It changes the function of the block of code in serious ways.

However, in the promise example:

fetch('coffee.jpg')
    .then(response => response.blob())

There's no mental consideration that the blob() method requires an await. The promise.then will inherently await for the result.

Now, I understand that await "feels" more comfortable for those that think in a procedural manner. "I have to do this, this, and this in this order." But it seems to scoff at declarative convention and declare itself the winner of some ephemeral readability/usability debate. I personally have no issue with a then chain. And it lends itself to the same step by step process in my head. It covers the above concern without a second thought from the developer and I think handles the situation in a more elegant fashion.

I understand await is the new hotness, but I think some of the hate that promises get is undeserved.

That's not even considering the third example they just replaced the fetch.then with a function call that does exactly the same thing...


r/javascript • • Feb 09 '20

β€œHoisting” doesn’t really exist in JavaScript! 😱 according to ECMAScript

Thumbnail
medium.com
0 Upvotes

r/javascript • • Nov 03 '22

Be Careful With JavaScript Default Parameters!

Thumbnail
charpeni.com
1 Upvotes

r/javascript • • Aug 10 '16

12 extremely useful hacks for JavaScript!

Thumbnail
blog.jscrambler.com
1 Upvotes

r/javascript • • Jul 23 '19

I said I'd bring more blockchain content. Read how Truffle is integrating Drizzle into Vue!

Thumbnail
trufflesuite.com
0 Upvotes

r/javascript • • May 13 '22

My first ever post as software engineer

Thumbnail
dev.to
0 Upvotes

r/javascript • • Jan 24 '25

AskJS [AskJS] Which OOP style to use in current-gen JS?

0 Upvotes

For the most part I largely ignored classes when they were made introduced since at that point it is just syntactic sugar on top of the already powerful prototypal inheritance. Eventually I ignored "classes" altogether when the frameworks and libraries I used are mostly functional in structure.

Class

class MyClass {
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }
     ...
}

Function constructor

function MyConstructor(x, y){
    this.x = x;
    this.y = y;
}

MyConstructor.prototype.myMethod = ....

Factory

function MyFactory(x, y){
    function myMethod(){
        ...
    }

    return { myMethod };
}

And other approaches like the old OLOO by Kyle SImpson.

What are your opinions on what OOP styles to use? Sell me on them.


r/javascript • • Feb 13 '25

I created a small functional Netflix clone with a custom video player using React Native

Thumbnail magically.life
0 Upvotes

r/javascript • • Oct 02 '18

Money in JavaScript

Thumbnail
timleland.com
1 Upvotes

r/javascript • • Nov 27 '20

Template for making package namespace

Thumbnail
dev.to
1 Upvotes

r/javascript • • May 08 '17

Comcast Presentation: Web Components: The Future of Web Development is Here

Thumbnail
slideshare.net
1 Upvotes

r/javascript • • Mar 02 '18

help [RANT] Why is JS ES6 import syntax designed with such incompetence?

1 Upvotes

Usually, in python, I can do

from x import y

Now, this is great becase my editor (PyCharm) can suggest me x, the package name and then y, that package's module, AS I TYPE.

But in JS,

import y from x

Here my editor doesn't tell me anything until I write a full export statement. Then when i try to edit that statement, it makes suggestions.

Why is this designed so badly? using from x import y is so much faster and natural, and still, somehow JS decided to mess up such a basic concept.