npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

superset-fun

v1.1.5

Published

The `superset-fun` repository is a collection of various fun and interesting concepts in programming. From exploring asynchronous loops to experimenting with different data structures, this repository aims to provide engaging and educational content for d

Downloads

8

Readme

Superset-fun

The superset-fun repository is a collection of various fun and interesting concepts in programming. From exploring asynchronous loops to experimenting with different data structures, this repository aims to provide engaging and educational content for developers of all skill levels.

Contents

  • Asynchronous Loop Examples: Dive into the world of asynchronous programming with examples demonstrating how to loop through arrays, objects, and strings asynchronously using the loop function.
  • Standard Loop Examples: Compare and contrast asynchronous loop examples with traditional synchronous loop implementations to better understand the differences and benefits of each approach.
  • Fun Programming Challenges: Challenge yourself with fun programming exercises and puzzles designed to test your problem-solving skills and creativity.
  • Interactive Demos: Explore interactive demos and visualizations that illustrate various programming concepts in a fun and interactive way.

Purpose

The superset-fun repository serves as a playground for developers to experiment with new ideas, learn new concepts, and share their experiences with the programming community. Whether you're a beginner looking to learn the basics or an experienced developer seeking inspiration, there's something for everyone in this repository.

Asynchronous Loop Examples

This repository contains examples of asynchronous loops using the loop function. Each example demonstrates different use cases for looping with asynchronous operations.

Loop with Limit Number

loop(5, async x => {
	console.log('x:', x)
	await hold(500)
})

This example demonstrates a standard loop with a limit number. It logs the value of x asynchronously with a delay of 500 milliseconds.

Loop an Array

loop([5, 4, 3, 2, 1], async (n, index) => {
	console.log('n:', n, index)
	await hold(500)
})

This example demonstrates looping over an array using the loop function. It logs the value of each element along with its index asynchronously.

Loop an Object

loop({ one: 1, two: 2, three: 3 }, async (key, value) => {
	console.log(key, ':', value)
	await hold(500)
})

This example demonstrates looping over an object using the loop function. It logs the key-value pairs of the object asynchronously.

Loop a String

loop('Lorem ipsum', async (letter, index) => {
	process.stdout.write(letter)
	await hold(10)
})

This example demonstrates looping over a string using the loop function. It prints each letter of the string asynchronously with a delay of 10 milliseconds.

Async/Await Example

const data = [
	{ name: 'Naruto', clan: 'Uzumaki', children: ['Boruto', 'Himawari'] },
	{ name: 'Sasuke', clan: 'Uchiha', children: ['Sarada'] }
]

loop(data, async (data, index) => {
	console.log('index', ' :', index)

	await loop(data, async (key, val) => {
		if ( key != 'children' ) console.log(key, ' :', val)
		else await loop(val, async (data, index) => {
			console.log('children :', data)
		})
	})
	
	console.log('-----------------------------------------------')
}).then(_  => {
	console.log('Finished')
})

Standard Loop Examples

// Standard loop: for ( let x = 0; x < 5; x++ )
for (let x = 0; x < 5; x++) {
  console.log('x:', x);
}

// Standard loop: for ( let [x, n] of [5, 4, 3, 2, 1].entries() )
for (let [x, n] of [5, 4, 3, 2, 1].entries()) {
  console.log('n:', n, x);
}

// Standard loop: for ( let [key, val] of Object.entries({ one: 1, two: 2, three: 3 }) )
for (let [key, val] of Object.entries({ one: 1, two: 2, three: 3 })) {
  console.log(key, ':', val);
}

// Standard loop: for ( let char of 'Lorem ipsum' )
for (let char of 'Lorem ipsum') {
  console.log(char);
}

This section provides examples of standard loops for comparison with the asynchronous loop examples. This example demonstrates using async/await within a loop to process nested data structures asynchronously.

Contributions

Contributions to the superset-fun repository are welcome! If you have an interesting programming concept, a fun challenge, or an interactive demo to share, feel free to submit a pull request. Let's make learning and exploring programming fun together!