Skip to content

Instantly share code, notes, and snippets.

View SMotaal's full-sized avatar
🙃
mia

Saleh Abdel Motaal SMotaal

🙃
mia
View GitHub Profile
@SMotaal
SMotaal / README.md
Last active October 13, 2018 11:58
Fragma: Concept: Throttle
@SMotaal
SMotaal / Specifiers.md
Last active November 22, 2018 10:56
Specifiers

Specifiers

I have been trying to find a good way to paraphrase intuitive concerns regarding scheme-less specifiers and I think that while import: is different from other ideas proposed for somewhat related purposes, it may be coming from similar but more tangible consideration.

Yesterday I did a little experiment with URL in node, Chrome, and Safari , and Firefox. My general thought is that new URL(x, y) is a resolution formula that follows closest to the web standards so my assumption is that it pairs well with the whatwg expectations on specifiers.

The bottom line is that constructing scheme-less specifiers that depend on scheme-less referrers is not possible, and the hack used just to get through the list of valid specifiers was to resolve the referrer against file://y:/ which is not a proposed solution by all means.

Given the importance of specifier resolution (ie x -> y = z) I am

@SMotaal
SMotaal / Proposal.md
Last active December 14, 2018 14:16
ECMAScript Proposal: Non-Module Namespaces

ECMAScript Proposal: Non-Module Namespaces

This is a first draft for a proposal for adding a new dimension to the current ECMAScript module architecture that would make it possible to fulfill platform dependent behaviours for common and non-common requirements without breaking the established compliance criteria. This is not yet a formal proposal.

In the default case of resolving an external dependency (which translates into bindings across two or more linked ES modules) the existing standards are technically sufficient and can only improve by increased adoption and natural progression. However, when it is necessary to either import from or respond to a specific platform, the current standards can be improved upon, which is the topic of several proposals, and is the main focus of this proposal.

Potential Use Cases

// Module-specific
@SMotaal
SMotaal / ESM.md
Created December 14, 2018 14:42
Node.js: Experimental Builds

Forks

guybedford/node/tree/irp-implementation

Setup


# clone
git clone https://github.com/guybedford/node.git --branch irp-implementation --single-branch node-esm
@SMotaal
SMotaal / README.md
Created December 25, 2018 18:48
URL.resolve Polyfill

URL.resolve(…) Polyfill

Concept

(url => (href, specifier) => {
  try {
    url.href = href;
    if (/^\.{1,2}\/|^\/(?=[^\/]|$)/.test(specifier)) {
 const [, path = '', search = '', hash = ''] = /([^?#]*)([^#]*)(.*)/.exec(specifier);
@SMotaal
SMotaal / results.md
Created January 20, 2019 19:29
RegExp Methods
browser regexp method time
Chrome /)|/ exec : 6.9599609375ms
Chrome /)|/ [Symbol.search] 6.98681640625ms
Chrome /)(?=|)/ exec 5.283203125ms
Chrome /)(?=|)/ [Symbol.search] 4.552001953125ms
Chrome /(?=)|)./ exec 4.844970703125ms
Chrome /(?=)|)./ [Symbol.search] 5.030029296875ms
Chrome /(?=)|)/ exec 4.688232421875ms
Chrome /(?=)|)/ [Symbol.search] 4.72802734375ms
@SMotaal
SMotaal / cjs.js
Last active February 27, 2019 20:50
Node.js: createRequireFromPath
module.exports = 'cjs';
@SMotaal
SMotaal / jsbin-settings.json
Last active March 10, 2019 18:14
Experiment: Globals
{"processors":{}}