Skip to content

Instantly share code, notes, and snippets.

View kaanon's full-sized avatar

Kaanon MacFarlane kaanon

View GitHub Profile
@saadtazi
saadtazi / Promise.props without bluebird.md
Last active July 20, 2023 12:02
buebird inspired Promise.props using native Promise.all()

Usage

Promise.props({ a: 1, b: Promise.resolve(14) }).then(function (a) {
    console.log('resolved:::', a);
});
/// resolved::: { a: 1, b: 14 }

Promise.props({ a: 1, b: Promise.reject(14) }).catch(function (err) {
 console.log('rejected:::', err);
@jackgill
jackgill / bundle.js
Last active March 25, 2024 13:53
A node.js script to create a bundle containing an npm package, and all of its dependencies.
/*
* This script will download a package (and all of its dependencies) from the
* online NPM registry, then create a gzip'd tarball containing that package
* and all of its dependencies. This archive can then be copied to a machine
* without internet access and installed using npm.
*
* The idea is pretty simple:
* - npm install [package]
* - rewrite [package]/package.json to copy dependencies to bundleDependencies
* - npm pack [package]