Skip to content

Instantly share code, notes, and snippets.

Numbers

Number<Countable> = Either<Countable, Just<0>>

Numbers

Number<Countable> = Either<Countable, Just<0>>
@jasuperior
jasuperior / gist:138866567091e18705c2a27244fbdf02
Created January 23, 2018 14:40
aSymboler - A common interface for using symbol property values to create private keys.
const s = new Proxy({},{
get(target, prop){
if(!target[prop]) target[prop] = Symbol();
return target[prop];
},
set(){
return false;
}
})
@jasuperior
jasuperior / Rrray.js
Created December 26, 2017 15:24
Rrray(Relative Array): A concept using ES6 Proxies to construct a type of array whose values keep track of their sibling relationships. Also allows for circular/negative indexing.
class Rrray extends Array {
constructor(){
super(...arguments);
this.index = {}
return new Proxy(this, this.handler);
}
get handler () {
let $self = this;
return {
get(target, prop, proxy){
@jasuperior
jasuperior / Promiser.js
Last active March 21, 2022 06:46
An ES6 async/promise proof of concept using Proxies.
/*
Using Es6 Proxies, I created an object that can resolve promises from a chained object accessor pattern.
simply await the values, or supply a callback to .then() and watch the magic.
*/
Symbol.queue = Symbol("queue"); //using Symbols to hide properties from being used or altered
Symbol.data = Symbol("data");
function Promiser( obj ) {
return new Proxy(obj, {
get(target, prop){