Skip to content

Instantly share code, notes, and snippets.

View bertolo1988's full-sized avatar
🎯
Focusing

Tiago BΓ©rtolo bertolo1988

🎯
Focusing
View GitHub Profile
@bertolo1988
bertolo1988 / wallet-address-signature-demo.js
Created March 17, 2023 11:45
Verify ethereum wallet ownership remotely.
/**
First install and run ganache.
> npm install ganache --global
> execute this code https://gist.github.com/bertolo1988/096d436f072d2513eb4ff1cd83201c47
**/
const Web3EthAccounts = require('web3-eth-accounts');
const PORT = 61063;
@bertolo1988
bertolo1988 / eip-1193-provider.js
Created March 17, 2023 11:44
Launches an EIP-1193 provider locally.
const ganache = require('ganache');
const options = {};
const server = ganache.server(options);
const PORT = 0; // 0 means any available port
server.listen(PORT, async (err) => {
if (err) throw err;
console.log(`ganache listening on port ${server.address().port}...`);
});
Method name clone is callable typeof is function enumerable properties name prototype constructor clone is independent
cloneJSON ❌ ❌ ❌ ❌ ❌ ❌ ❌
structuredClone ❌ ❌ ❌ ❌ ❌ ❌ ❌
underscoreContribClone βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneNemisj βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneTrincot ❌ βœ… βœ… ❌ ❌ βœ… βœ…
cloneKoolDandy βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneRfdc βœ… βœ… βœ… βœ… βœ… βœ… ❌
justClone βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneDeep βœ… βœ… βœ… βœ… βœ… βœ… ❌
Method name should clone an object with circular reference to an element of the array
cloneJSON ❌
structuredClone βœ…
underscoreContribClone ❌
cloneNemisj ❌
cloneTrincot βœ…
cloneKoolDandy ❌
cloneRfdc βœ…
justClone ❌
cloneDeep ❌
Method name __proto__ by referencing clones the __proto__ non enumerable properties in the prototype
cloneJSON ❌ ❌ ❌
structuredClone ❌ βœ… ❌
underscoreContribClone ❌ ❌ ❌
cloneNemisj ❌ ❌ ❌
cloneTrincot ❌ ❌ ❌
cloneKoolDandy ❌ ❌ ❌
cloneRfdc ❌ ❌ ❌
justClone ❌ ❌ ❌
cloneDeep βœ… ❌ βœ…
Method name frozen sealed non extensible
cloneJSON ❌ ❌ ❌
structuredClone ❌ ❌ ❌
underscoreContribClone ❌ ❌ ❌
cloneNemisj ❌ ❌ ❌
cloneTrincot ❌ ❌ ❌
cloneKoolDandy ❌ ❌ ❌
cloneRfdc ❌ ❌ ❌
justClone ❌ ❌ ❌
cloneDeep ❌ ❌ ❌
Method name getter setter enumerable non enumerable enumerable and writable non enumerable non writable and configurable non enumerable writable and non configurable non enumerable non writable and non configurable own symbol
cloneJSON ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
structuredClone ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
underscoreContribClone ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneNemisj ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneTrincot ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneKoolDandy ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneRfdc ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
justClone ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneDeep ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
Method name shallow object non shallow object circular references typeof constructor
cloneJSON βœ… βœ… ❌ βœ… βœ…
structuredClone βœ… βœ… βœ… βœ… βœ…
underscoreContribClone βœ… βœ… ❌ βœ… βœ…
cloneNemisj βœ… βœ… ❌ βœ… βœ…
cloneTrincot βœ… βœ… βœ… βœ… βœ…
cloneKoolDandy βœ… βœ… ❌ βœ… βœ…
cloneRfdc βœ… βœ… ❌ βœ… βœ…
justClone βœ… βœ… ❌ βœ… βœ…
cloneDeep βœ… βœ… ❌ βœ… βœ…
Method name string number boolean undefined null Symbol BigInt
cloneJSON βœ… βœ… βœ… ❌ βœ… ❌ ❌
structuredClone βœ… βœ… βœ… βœ… βœ… ❌ βœ…
underscoreContribClone βœ… βœ… βœ… βœ… βœ… βœ… βœ…
cloneNemisj βœ… βœ… βœ… βœ… βœ… βœ… βœ…
cloneTrincot βœ… βœ… βœ… βœ… βœ… βœ… βœ…
cloneKoolDandy βœ… βœ… βœ… βœ… βœ… βœ… βœ…
cloneRfdc βœ… βœ… βœ… βœ… βœ… βœ… βœ…
justClone βœ… βœ… βœ… βœ… βœ… βœ… βœ…
cloneDeep βœ… βœ… βœ… βœ… βœ… ❌ βœ…
@bertolo1988
bertolo1988 / how-to-clone-prototype-by-copying.js
Last active October 12, 2022 09:20
How to clone a javascript object without just referencing the prototype.
// How to clone a javascript object without just referencing the prototype
const assert = require('node:assert')
const input = { a: 1 }
// every prototype is an object with normal property descriptors
const prototypeDescriptors = Object.getOwnPropertyDescriptors(
Object.getPrototypeOf(input)
)