class A {
#x;
constructor(x, a) {
#x = x;
this.foo = this.foo.bind(a);
}
foo() {
console.log(this?.#x); // optional chaining
// Possible to use optional chaining?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const productLoader = new DataLoader(getBackendProducts); | |
const resolvers = { | |
Query: { | |
async product(_, { id }, __, info) { | |
const fields = getFields(info); | |
const backendFields = getBackendFields(fields, dependencyMap); | |
const backendResponse = await productLoader.load({ id, fields: backendFields }); | |
const schemaResponse = getSchemaResponse(backendResponse, fields, transformerMap); | |
return schemaResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const resolvers = { | |
Query: { | |
async product(_, { id }, __, info) { | |
const fields = getFields(info); | |
const backendFields = getBackendFields(fields, dependencyMap); | |
const backendResponse = await fetch(`/product?id=${id}&fields=${backendFields}`); | |
const schemaResponse = getSchemaResponse(backendResponse, fields, transformerMap); | |
return schemaResponse; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git branch -r | | |
awk '{print $1}' | | |
egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | | |
awk '{print $1}' |
Motivation -
- use
private
keyword - Use class private and not instance private.
- Statically analysable.
Based on this issue - tc39/proposal-private-fields#14, there is a lot of interest in using the private
keyword and no sigils, and sigils cannot be avoided for multiple reasons specified in the FAQ.
Addressing some of the comments by littledan,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const template = require("babel-template"); | |
module.exports = function SystemImportPlugin() { | |
return { | |
visitor: { | |
CallExpression(path) { | |
const callee = path.get("callee"); | |
if (!callee.isMemberExpression()) return; | |
const object = callee.get("object"); |
I hereby claim:
- I am boopathi on github.
- I am boopathi (https://keybase.io/boopathi) on keybase.
- I have a public key whose fingerprint is 1FAC 1419 710A D0DB 6C4B 7A11 873B 84CB 3041 903B
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const fs = require("fs"); | |
const minimist = require("minimist"); | |
const transform = require("./index"); | |
module.exports = run; | |
if (require.main === module) { | |
run(process.argv.slice(2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ConcatSource = require('webpack/lib/ConcatSource'); | |
var loaderUtils = require('loader-utils'); | |
module.exports = CombineChunksPlugin; | |
// opts.filename = 'vendor.[contenthash].js' | |
function CombineChunksPlugin(opts) { | |
if (opts) { | |
this.filename = opts.filename ? opts.filename : 'vendor.bundle.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lo-dash lib is the dependency | |
function readOnly(target){ | |
var _readOnly = function (target, acc) { | |
// acc is passed into the function to be used for observer | |
var _defineProperty = function (propName, target, acc) { | |
var i, len; | |
// operation to be performed when add occurred |
NewerOlder