Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Celestra Wiki #206

Open
Serrin opened this issue Aug 31, 2021 · 0 comments
Open

Celestra Wiki #206

Serrin opened this issue Aug 31, 2021 · 0 comments

Comments

@Serrin
Copy link
Owner

Serrin commented Aug 31, 2021

      ___  ____  __    ____  ___  ____  ____    __       _
     / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\     / )
    ( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   / _ \
     \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  \___/

Celestra Wiki

Table of contents

  • Notations
  • Planned changes
  • Completed changes
  • Dropped changes
  • ASCII logos
  • Test strings
  • Dropped proposals

Notations

Mark Description
ADD add
DPD deprecate
MOD modify
REM remove
REN rename
=> this has been done
-> this is a plan/question/todo

Planned changes

/*
https://github.com/tc39/proposal-set-methods

Set.prototype.intersection(other)
Set.prototype.union(other)
Set.prototype.difference(other)
Set.prototype.symmetricDifference(other)
Set.prototype.isSubsetOf(other)
Set.prototype.isSupersetOf(other)
Set.prototype.isDisjointFrom(other)
  diszjunkt halmazok
  In mathematics, two sets are said to be disjoint sets if they have no element in common.
*/

/* Set.prototype.intersection(<other>); */
if (!("intersection" in Set.prototype)) {
  Object.defineProperty(Set.prototype, "intersection", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (other) {
      var r = new Set();
      for (const item of this.keys()) {
        if (other.has(item)) { r.add(item); }
      }
      for (const item of other.keys()) {
        if (this.has(item)) { r.add(item); }
      }
      return r;
    }
  });
}

/* Set.prototype.union(<other>); */
if (!("union" in Set.prototype)) {
  Object.defineProperty(Set.prototype, "union", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (other) {
      var r = new Set();
      for (const item of this.keys()) { r.add(item); }
      for (const item of other.keys()) { r.add(item); }
      return r;
    }
  });
}

/* Set.prototype.difference(<other>); */
if (!("difference" in Set.prototype)) {
  Object.defineProperty(Set.prototype, "difference", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (other) {
      var r = new Set();
      for (const item of this.keys()) {
        if (!(other.has(item))) { r.add(item); }
      }
      return r;
    }
  });
}

/* Set.prototype.symmetricDifference(<other>); */
if (!("symmetricDifference" in Set.prototype)) {
  Object.defineProperty(Set.prototype, "symmetricDifference", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (other) {
      var r = new Set();
      for (const item of this.keys()) {
        if (!(other.has(item))) { r.add(item); }
      }
      for (const item of other.keys()) {
        if (!(this.has(item))) { r.add(item); }
      }
      return r;
    }
  });
}

/* Set.prototype.isSubsetOf(<other>); */
if (!("isSubsetOf" in Set.prototype)) {
  Object.defineProperty(Set.prototype, "isSubsetOf", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (other) {
      if (this.size > other.size) { return false; }
      for (const item of this.keys()) {
        if (!(other.has(item))) { return false; }
      }
      return true;
    }
  });
}

/* Set.prototype.isSupersetOf(<other>); */
if (!("isSupersetOf" in Set.prototype)) {
  Object.defineProperty(Set.prototype, "isSupersetOf", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (other) {
      if (other.size > this.size) { return false; }
      for (const item of other.keys()) {
        if (!(this.has(item))) { return false; }
      }
      return true;
    }
  });
}

/* Set.prototype.isDisjointFrom(<other>); */
if (!("isDisjointFrom" in Set.prototype)) {
  Object.defineProperty(Set.prototype, "isDisjointFrom", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (other) {
      if (this.size === 0 && other.size === 0) { return false; }
      for (const item of this.keys()) {
        if (other.has(item)) { return false; }
      }
      for (const item of other.keys()) {
        if (this.has(item)) { return false; }
      }
      return true;
    }
  });
}


var setA  = new Set([1,2,3,4]);
var setA2 = new Set([1,2,3,4]);
var setB  = new Set([3,4,5,6]);
var setAX = new Set([1,2]);
var setBX = new Set([5,6]);

console.log(setA.intersection(setB));  // 3,4
console.log(setA.intersection(setBX)); // empty
console.log(setA.union(setB)); // 1,2,3,4,5,6
console.log(setA.union(setAX)); // 1,2,3,4
console.log(setA.difference(setB)); // 1,2
console.log(setA.difference(setBX)); // 1,2,3,4
console.log(setA.difference(new Set())); // 1,2,3,4
console.log(setA.symmetricDifference(setB)); // 1,2,5,6
console.log(setA.symmetricDifference(setAX)); // 3,4
console.log(setAX.isSubsetOf(setA)); // true
console.log(setBX.isSubsetOf(setA)); // false
console.log(setA.isSubsetOf(setB));  // false
console.log(setA.isSupersetOf(setAX)); // true
console.log(setA.isSupersetOf(setBX)); // false
console.log(setB.isSupersetOf(setA));  // false
console.log(setA.isDisjointFrom(setBX)); // true
console.log(setA.isDisjointFrom(setA2)); // false
console.log(new Set().isDisjointFrom(new Set())); // false
// https://github.com/js-choi/proposal-function-un-this

if (!("unThis" in Function.prototype)) {
  Object.defineProperty(Function.prototype, "unThis", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function () { return Function.prototype.call.bind(this); }
  });
}

var slice = Array.prototype.slice.unThis();
console.log( slice({"length": 3, 0: "a", 1: "b", 2: "c"}) );
// Array(3) [ "a", "b", "c" ]

In Celestra v5.4.4:

/* unBind(<function>): function */
const unBind = (fn) => Function.prototype.call.bind(fn);
// https://github.com/tc39-transfer/proposal-array-filtering
// https://tc39.es/proposal-array-filtering/

if (!("filterReject" in Array.prototype)) {
  Object.defineProperty(Array.prototype, "filterReject", {
    "configurable": true, "writable": true, "enumerable": false,
    "value": function (fn, thisArg) {
      "use strict";
      function toArray (O) { return (Array.isArray(O) ? O : Array.from(O)); }
      return toArray(this).filter(
        function (v,i,t) { return !(fn.call(thisArg,v,i,t)); }
      );
    }
  });
}


/* testcases */

var arrFilterReject = [4,9,5,8,6,7];
const fnFilterReject = (v) => v >= 6;

console.log( arrFilterReject.filter(fnFilterReject) );
// Array(3) [ 9, 8, 6, 7 ]

console.log( arrFilterReject.filterReject(fnFilterReject) );
// Array(2) [4, 5]
console.log( Array.prototype.filterReject.call(arrFilterReject, fnFilterReject) );
// Array(2) [4, 5]

console.log( Array.prototype.filterReject.call({"length":3, 0:5, 1:6, 2:7}, fnFilterReject) );
// Array [ 5 ]
if (!("uniqueBy" in Array.prototype)) {
  Object.defineProperty(Array.prototype, "uniqueBy", {
    "configurable": true, "writable": true, "enumerable": false,
    value: function (fn) {
      if (fn == null) { return [...new Set(this)]; }
      const key = typeof fn !== "function" && fn, map = new Map();
      fn = key
        ? (item) => {
            var iKey;
            return (iKey = item === null
              || item === void 0 ? void 0 : item[key]) !== null
              && iKey !== void 0 ? iKey : item;
          }
        : fn;
      for (const item of this) {
        const key = fn(item);
        if (!map.has(key)) { map.set(key, item); }
      }
      return [...map.values()];
    }
  });
}

console.log([1, 2, 3, 3, 2, 1].uniqueBy());
// Array(3) [ 1, 2, 3 ]

const data = [
    { id: 1, uid: 10000 },
    { id: 2, uid: 10000 },
    { id: 3, uid: 10001 }
];

console.log(data.uniqueBy("uid"));
/*
Array [ {…}, {…} ]
0: Object { id: 1, uid: 10000 }
1: Object { id: 3, uid: 10001 }
length: 2
<prototype>: Array []
*/

console.log(data.uniqueBy(({ id, uid }) => `${id}-${uid}`));
/*
Array(3) [ {…}, {…}, {…} ]
0: Object { id: 1, uid: 10000 }
1: Object { id: 2, uid: 10000 }
2: Object { id: 3, uid: 10001 }
length: 3
<prototype>: Array []
*/
function isSameArray (a, b) {
  if (Array.isArray(a) && Array.isArray(b) && a.length === b.length) {
    for (var i = 0, l = a.length; i < l; i++) {
      if (a[i] !== b[i]) { return false; }
    }
    return true;
  }
  return false;
}
/* Map.from(); */
(!Map.from&&(Map.from=(o)=>new Map(Array.from(o))));
/* Map.of(); */
(!Map.of&&(Map.of=(...a)=>new Map(a)));
/* Set.from(); */
(!Set.from&&(Set.from=(o)=>new Set(Array.from(o))));
/* Set.of(); */
(!Set.of&&(Set.of=(...a)=>new Set(a)));

console.log(Set.from([4,5,6,7,4,5,2]));
// Set(5) [ 4, 5, 6, 7, 2 ]
console.log(Set.of(4,5,6,7,4,5,2));
// Set(5) [ 4, 5, 6, 7, 2 ]

console.log(Map.from([[4,5],[6,7],[3,4],[5,2]]));
// Map(4) { 4 → 5, 6 → 7, 3 → 4, 5 → 2 }
console.log(Map.of([4,5],[6,7],[3,4],[5,2]));
// Map(4) { 4 → 5, 6 → 7, 3 → 4, 5 → 2 }
/*
If n is NaN, the result is false.
If n is -0, the result is true.
If n is negative, the result is true.
Otherwise, the result is false.
*/
if (!Math.signbit) {
  Math.signbit = function (v) {
    return (((v = +v) !== v) ? !1 : ((v < 0) || Object.is(v, -0)));
  };
}

console.log("str       - " + Math.signbit("str") );
console.log("\"5\"       - " + Math.signbit("5") );
console.log("\"-5\"      - " + Math.signbit("-5") );
console.log("\"4.2\"     - " + Math.signbit("4.2") );
console.log("\"-4.2\"    - " + Math.signbit("-4.2") );
console.log("-3.14     - " + Math.signbit(-3.14) );
console.log("3.14      - " + Math.signbit(3.14) );
console.log("-1        - " + Math.signbit(-1) );
console.log("1         - " + Math.signbit(1) );
console.log("0         - " + Math.signbit(0) );
console.log("-0        - " + Math.signbit(-0) );
console.log("+0        - " + Math.signbit(+0) );
console.log("Infinity  - " + Math.signbit(Infinity) );
console.log("-Infinity - " + Math.signbit(-Infinity) );
console.log("+Infinity - " + Math.signbit(+Infinity) );

/*
str       - false - ok
"5"       - false - ok
"-5"      - true  - ok
"4.2"     - false - ok
"-4.2"    - true  - ok 
-3.14     - true  - ok
3.14      - false - ok
-1        - true  - ok
1         - false - ok
0         - false - ok
-0        - true  - ok
+0        - false - ok
Infinity  - false - ok
-Infinity - true  - ok
+Infinity - false - ok
*/
Array.from(stringVar, (v, i) => [i, v.codePointAt(0)]).values();
// or
[...stringVar].map((v, i) => [i, v.codePointAt(0)]).values();

-> check again, Stage 1, no MDN docs

if (!String.prototype.codePoints) {
  String.prototype.codePoints = function* () {
    let i = 0;
    for (let ch of this) { yield [i++, ch.codePointAt(0)]; }
  };
}

var icons = "ab01☃★♲cd23";
[...icons.codePoints()];
/*
Array(11)
0: Array [ 0, 97 ]
​1: Array [ 1, 98 ]
​2: Array [ 2, 48 ]
​3: Array [ 3, 49 ]
​4: Array [ 4, 9731 ]
​5: Array [ 5, 9733 ]
​6: Array [ 6, 9842 ]
​7: Array [ 7, 99 ]
​8: Array [ 8, 100 ]
​9: Array [ 9, 50 ]
​10: Array [ 10, 51 ]
​length: 11
*/
if (!Math.imulh) {
  Math.imulh = function imulh(u, v) {
    var u0 = u & 0xFFFF, u1 = u >> 16;
    var v0 = v & 0xFFFF, v1 = v >> 16;
    var w0 = u0 * v0;
    var t = ((u1 * v0) >>> 0) + (w0 >>> 16);
    var w1 = t & 0xFFFF;
    var w2 = t >> 16;
    w1 = ((u0 * v1) >>> 0) + w1;
    return u1 * v1 + w2 + (w1 >> 16);
  };
}

if (!Math.umulh) {
  Math.umulh = function umulh (u, v) {
    var u0 = u & 0xFFFF, u1 = u >>> 16;
    var v0 = v & 0xFFFF, v1 = v >>> 16;
    var w0 = u0 * v0;
    var t = ((u1 * v0) >>> 0) + (w0 >>> 16);
    var w1 = t & 0xFFFF;
    var w2 = t >>> 16;
    w1 = ((u0 * v1) >>> 0) + w1;
    return u1 * v1 + w2 + (w1 >>> 16);
  };
}

if (!Math.iaddh) {
  Math.iaddh = function iaddh (x0, x1, y0, y1) {
    x0 = x0 >>> 0; x1 = x1 >>> 0; y0 = y0 >>> 0; y1 = y1 >>> 0;
    var z0 = (x0 + y0) >>> 0;
    var c = ((x0 & y0) | (x0 | y0) & ~z0) >>> 31;
    var z1 = x1 + y1 + c;
    return z1 | 0;
  };
}

if (!Math.isubh) {
  Math.isubh = function isubh (x0, x1, y0, y1) {
    x0 = x0 >>> 0; x1 = x1 >>> 0; y0 = y0 >>> 0; y1 = y1 >>> 0;
    var z0 = (x0 - y0) >>> 0;
    var b = ((~x0 & y0) | (~(x0 ^ y0) & z0)) >>> 31;
    var z1 = x1 - y1 - b;
    return z1 | 0;
  };
}

Completed changes

https://github.com/Serrin/Celestra/issues

https://github.com/Serrin/Celestra/issues?q=is%3Aissue+is%3Aclosed

includes(<collection>,<value>);
contains(<collection>,<value>);
find(<collection>,<callback>);
findLast(<collection>,<callback>);
every(<collection>,<callback>);
some(<collection>,<callback>);
none(<collection>,<callback>);
join(<collection>[,separator=","]);
  • ADD - proposal-array-grouping
    https://github.com/tc39/proposal-array-grouping
    => Added in v5.4.1: Array.prototype.groupBy(<fn>[,thisArg]); and Array.prototype.groupByToMap(<fn>[,thisArg]);

  • REM - Remove many internal function calls without breaking change, only the getJson(); and getText(); will remain shorthands in v5.2.1.

Function Fix/Change
clearCookies(); Remove the internal calls of the getCookie(); and removeCookie();
domFadeToggle(<elem.>[,duration[,display]]); Remove the internal calls of the domFadeIn(<element>[,duration[,display]]); and domFadeOut(<element>[,duration]);
extend([deep,]<target>,<source1>[,srcN]); Make a function inside the extend(); function to remove the external recursion
isArrayBuffer(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isDataView(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isDate(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isEmptyMap(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isEmptySet(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isError(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isIterator(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isMap(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isRegexp(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isSameMap(<map1>,<map2>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isSameSet(<set1>,<set2>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isSet(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isTypedArray(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isWeakMap(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
isWeakSet(<value>); Remove the internal calls of the getType(<variable>[,type][,throw=false]);
zipObj(<collection1>,<collection2>); Remove the internal call of the zip(<collection1>[,collectionN]);
  • MOD - Celestra 5
    => Replace Collections functions with smaller size versions in v4.5.1 and v4.5.2
    => Rename the celTest object to CUT in the unittest.js in v4.5.2
    => Remove the _cut alias of the CUT object to in the unittest.js in v4.5.2
    => Replace the short object name _ with a new short name CEL

  • MOD - Celestra 4
    => Make a NodeJS prototype from the v3.1.2 (celestra.mjs)
    => The AMD and CommonJS descriptions have been removed from the documention in the v3.5.1.
    => The AMD and CommonJS module export codes have been removed in the v3.6.0.
    => In the ESM version remove the export of the standalone functions, only the whole object export and default export have to be remained in v3.6.0.
    => Make a new file in the Celestra repository with removed polyfills in v3.8.0.
    => Move polyfills into the celestra-polyfills.js and celestra-polyfills.min.js in v3.1.0 and v3.8.0.
    => Function name changes in v3.8.1: rename somethingOf(); functions to something();
    => Remove these aliases:

forOf(<collection>,<callback>);
mapOf(<collection>,<callback>);
sizeOf(<collection>);
filterOf(<collection>,<callback>);
hasOf(<collection>,<value>);
findOf(<collection>,<callback>);
everyOf(<collection>,<callback>);
someOf(<collection>,<callback>);
noneOf(<collection>,<callback>);
firstOf(<collection>);
lastOf(<collection>);
sliceOf(<collection>[,begin[,end]]);
reverseOf(<collection>);
sortOf(<collection>);
reduceOf(<collection>,<callback>[,initialvalue]);
concatOf(<collection1>[,collectionN]);
flatOf(<collection>);
enumerateOf(<collection>);
joinOf(<collection>[,separator=","]);
takeOf(<collection>[,n]);
dropOf(<collection>[,n]);

=> Function changes:

item(<collection>,<index>)
  -> remove

itemOf(<collection>,<index>);
  -> rename to item();
  • ADD - AJAX3 and REM - AJAX2
    Could be a promise based, like the FETCH ...
    Sample solutions:
    https://ccoenraets.github.io/es6-tutorial-data/promisify/
    https://stackoverflow.com/questions/30008114/how-do-i-promisify-native-xhr
    ... or make a FETCH polyfill like this: https://github.com/github/fetch
    => ... or the the current AJAX2 solution will remain because it works and FETCH will be recommended because it is supported everywhere in v4.3.1

  • Use the ES6 modules (ESM v1)
    => Make a module prototype from the v3.0.1
    => Added in v3.0.2 in a new file and the exisiting (DEV and MIN) files are remaining.
    => Modify the CUT to handle the ESM

  • Removable polyfills:
    In v3.0.1 the minimized size would be 35582 byte instead of 43052 byte - 7470 byte
    => Deprecated in v3.0.2
    => Archived in a new file and removed v3.1.0
    Array.from();, Array.of();, Array.prototype.fill();, Array.prototype.find();, Array.prototype.findIndex();, Object.create();, String.prototype.startsWith();, String.prototype.endsWith();, Object.is();, Array.prototype.copyWithin();, String.fromCodePoint();, String.prototype.codePointAt();, Number.MIN_SAFE_INTEGER;, Number.MAX_SAFE_INTEGER();, Number.EPSILON;, Number.isNaN();, isNaN();, Number.isInteger();, Number.isFinite();, Number.isSafeInteger();, Number.parseInt();, Number.parseFloat();
    MATH ES6 all: Math.acosh();, Math.asinh();, Math.atanh();, Math.cbrt();, Math.clz32();, Math.cosh();, Math.expm1();, Math.fround();, Math.hypot();, Math.imul();, Math.log1p();, Math.log10();, Math.log2();, Math.sign();, Math.sinh();, Math.tanh();, Math.trunc();

  • Unremovable polyfills in v3.1.0:
    The old Edge andd Firefox versions support need this or missing in a supported browser.
    Array.prototype.values();, ChildNode API, ParentNode API, Object.assign();, ChildNode.after();, ChildNode.before();, ChildNode.before();, ChildNode.remove();, ChildNode.replaceWith();, ParentNode.append();, ParentNode.prepend();, Element.prototype.toggleAttribute();, Array.prototype.includes();, String.prototype.includes();, String.prototype.trimStart();, String.prototype.trimLeft();, String.prototype.trimEnd();, String.prototype.trimRight();, String.prototype.padStart();, String.prototype.padEnd();, String.prototype.repeat();, NodeList.prototype.forEach();, Object.Object.values();, Object.entries();, Object.fromEntries();, Array.prototype.flat();, Element.prototype.closest();, Element.prototype.getAttributeNames();, Object.getOwnPropertyDescriptors();, window.screenLeft;, window.screenTop;, globalThis;, RegExp.prototype.flags;, GeneratorFunction();, String.prototype.matchAll();

  • MOD - Change to ES6 (Celestra 3.0)
    => ADD - ES6 Extension (ES6E) added in v2.5.0
    => MOD - Move the FP functions to other modules until the v3.0
    => MOD - Build the 3.0 prototypes and the 3.0 x15 (ES6 code modifier) to test the combined ES6 code - Built and tested with v2.6.0
    => ADD - Add the VERSION;
    => DPD - Deprecate the version;
    => ADD - Build the ES6 content in the ES6E
    => REM - Remove the version;
    => REM - Remove the IE11 from the tested browsers
    => REM - Remove the W10M EDGE 14 from the tested browsers

  • MOD - Simplify the qsa(); and qs(); in v2.6.0
    => The each(callback); method and the context as selector string has been deprecated in v2.5.2
    => Remove the each(callback); method from the qsa() in v2.6.0
    => The second (container) parameter type can be only an element, not element and string in v2.6.0

  • REN - Rename the "Celestra" object to "celestra"
    => The alias "Celestra" deprecated in v2.0.2
    => The alias "Celestra" has been removed in v2.1.0

  • REM - Remove the "function celToWindow()"
    => Deprecated in v2.0.8
    => Removed in v2.1.0

  • ADD - Array.prototype.values()
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values
    => Added in v2.4.1, Missing in Samsung Android browser.

Dropped changes

const arrayLastIndex = (a) =>
  (Array.isArray(a) ? (a.length > 0 ? a.length - 1 : 0) : null);

const arrayLastIndex=(a)=>(Array.isArray(a)?(a.length>0?a.length-1:0):null);

console.log(arrayLastIndex([]) + " - 0");
// 0 - 0
console.log(arrayLastIndex([4,5,6]) + " - 2");
// 2 - 2
console.log(arrayLastIndex(new Set([4,5,6])) + " - null");
// null - null
// test passed
// https://github.com/tc39/proposal-array-last

Object.defineProperty(Array.prototype, "lastItem", {
  enumerable: false,
  configurable: false,
  get () {
    var O = Object(this);
    var len = O.length > 0 ? parseInt(O.length) : 0;
    if (len === 0) {
      return undefined;
    } else if (len > 0) {
      return O[String(len - 1)];
    }
  },
  set (value) {
    var O = Object(this);
    var len = O.length > 0 ? parseInt(O.length) : 0;
    return O[String(len > 0 ? len - 1 : len)] = value;
  }
});
Object.defineProperty(Array.prototype, "lastIndex", {
  enumerable: false,
  configurable: false,
  get () {
    var O = Object(this);
    var len = O.length > 0 ? parseInt(O.length) : 0;
    return len > 0 ? len - 1 : 0;
  }
});


var a1 = [4,5,6,7,8];
console.log(a1.lastItem); // 8
a1.lastItem = 9;
console.log(a1.lastItem); // 9
console.log(a1.lastIndex); // 4

a1 = [];
console.log(a1.lastItem); // undefined
console.log(a1.lastIndex); // 0
a1.lastItem = 3;
console.log(a1.lastIndex); // 0;
console.log(a1.lastItem); // 3
a1.push(10);
console.log(a1.lastIndex); // 1
console.log(a1.lastItem); // 10
// https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/replaceChildren

var x = document.querySelector("p")
console.log( x.innerHTML );
// The <strong><code>ParentNode.replaceChildren()</code></strong> method replaces the existing children of a <a href="/en-US/docs/Web/API/Node"><code>Node</code></a> with a specified new set of children. These can be <a href="/en-US/docs/Web/API/DOMString"><code>DOMString</code></a> or <a href="/en-US/docs/Web/API/Node"><code>Node</code></a> objects.

// clear the parent
//x.replaceChildren();
//console.log(  x.innerHTML ); 
// empty string

// replace all elements (except the "<strong>" elements ??????), with the "<code>" elements
x.replaceChildren(
  ...x.querySelectorAll("strong"),
  ...x.querySelectorAll("code")
);
console.log( x.innerHTML ); 
// <strong></strong><code>ParentNode.replaceChildren()</code><code>Node</code><code>DOMString</code><code>Node</code>

// remove all elements and add the new "<strong>" elements from the parent ??????
x.replaceChildren( ...x.querySelectorAll("strong") );
console.log( x.innerHTML ); 
// <strong></strong>

ASCII logos


http://patorjk.com/software/taag/#p=display&f=Bulbhead&t=Celestra%202.0

bulbhead


(31357|24


  _  ___  __  ___  ___  ___ /\ ___   __  
 / )(__ )/  )(__ )| __)(__ )||(__ \ /. | 
( (  (_ \ )(  (_ \|__ \ / / || / _/(_  _)
 \_)(___/(__)(___/(___/(_/  \/(____) (_) 



  _  ___  __  ___  ___  ___    ___   __  
 / )(__ )/  )(__ )| __)(__ )||(__ \ /. | 
( (  (_ \ )(  (_ \|__ \ / / || / _/(_  _)
 \_)(___/(__)(___/(___/(_/  ||(____) (_) 



  ___  ____  __    ____  ___  ____  ____    __   
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\  
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\ 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)


  ___  ____  __    ____  ___  ____  ____    __      __    _  _ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    /  )  ( \/ )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )(    )  ( 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (__)()(_/\_)


  ___  ____  __    ____  ___  ____  ____    __      __ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    /  )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )( 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (__)


  ___  ____  __    ____  ___  ____  ____    __      ___     ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ \   / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    / _/  ( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (____)()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    / _/ 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (____)


  ___  ____  __    ____  ___  ____  ____    __      ___     __ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ \   /  )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    / _/    )( 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (____)()(__)


  ___  ____  __    ____  ___  ____  ____    __      ___     __    ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ \   /  )  / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    / _/    )(  ( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (____)()(__)()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      ___    ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ )  / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    (_ \ ( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (___/()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      ___ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    (_ \
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (___/


  ___  ____  __    ____  ___  ____  ____    __       __    ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\     /. |  / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   (_  _)( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)    (_)()\___/ 


  ___  ____  __    ____  ___  ____  ____    __       __  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\     /. | 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   (_  _)
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)    (_) 

 
  ___  ____  __    ____  ___  ____  ____    __      ___    ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    | __)  / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   |__ \ ( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (___/()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      ___ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    | __)
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   |__ \
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (___/


  ___  ____  __    ____  ___  ____  ____    __       _     ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\     / )   / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   / _ \ ( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  \___/()\___/ 


  ___  ____  __    ____  ___  ____  ____    __       _  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\     / ) 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   / _ \
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  \___/


  ___  ____  __    ____  ___  ____  ____    __      ___  ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ )/ _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    / /( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (_/()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      ___ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    (__ )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    / / 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (_/  


  ___  ____  __    ____  ___  ____  ____    __      ___    ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( _ )  / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   / _ \ ( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  \___/()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      ___ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( _ )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   / _ \
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  \___/


  ___  ____  __    ____  ___  ____  ____    __      ___   ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    / _ \ / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   \_  /( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)   (_/()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      ___ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    / _ \
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\   \_  /
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)   (_/ 


  ___  ____  __    ____  ___  ____  ____    __      __  ___    ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    /  )/ _ \  / _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )(( (_) )( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (__)\___/()\___/ 


  ___  ____  __    ____  ___  ____  ____    __      __  ___  
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    /  )/ _ \ 
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )(( (_) )
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (__)\___/ 
 
 
  ___  ____  __    ____  ___  ____  ____    __    _  _ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\  ( \/ )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\  )  ( 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)(_/\_)


  ___  ____  __    ____  ___  ____  ____    __      _  _ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( \/ )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )  ( 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (_/\_)


  ___  ____  __    ____  ___  ____  ____    __      _  _ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( \/ )
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )  ( 
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)()(_/\_)


  ___  ____  __    ____  ___  ____  ____    __      _  _  ____  _  _  ____ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( \( )( ___)( \/ )(_  _)
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )  (  )__)  )  (   )(  
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (_)\_)(____)(_/\_) (__) 


  ___  ____  __    ____  ___  ____  ____    __      _  _  ____  _  _  ____ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( \( )( ___)( \/ )(_  _)
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )  (  )__)  )  (   )(  
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)()(_)\_)(____)(_/\_) (__) 


  ___  ____  __    ____  ___  ____  ____    __      _  _  _  _  ____ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( \( )( \/ )(_  _)
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )  (  )  (   )(  
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)  (_)\_)(_/\_) (__) 


  ___  ____  __    ____  ___  ____  ____    __      _  _  _  _  ____ 
 / __)( ___)(  )  ( ___)/ __)(_  _)(  _ \  /__\    ( \( )( \/ )(_  _)
( (__  )__)  )(__  )__) \__ \  )(   )   / /(__)\    )  (  )  (   )(  
 \___)(____)(____)(____)(___/ (__) (_)\_)(__)(__)()(_)\_)(_/\_) (__) 


  __  ___   ___   __   ___   _   ___  ___  ___   ___  
 /  )(__ \ (__ ) /. | | __) / ) (__ )( _ )/ _ \ / _ \ 
  )(  / _/  (_ \(_  _)|__ \/ _ \ / / / _ \\_  /( (_) )
 (__)(____)(___/  (_) (___/\___/(_/  \___/ (_/  \___/ 


  __    ___     ___     __     ___ 
 /  )  (__ \   (__ )   /. |   | __)
  )(    / _/    (_ \  (_  _)  |__ \
 (__)  (____)  (___/    (_)   (___/
  _     ___    ___    ___     ___  
 / )   (__ )  ( _ )  / _ \   / _ \ 
/ _ \   / /   / _ \  \_  /  ( (_) )
\___/  (_/    \___/   (_/    \___/ 

 
 ____   __   ____  _   _  ____  ____  _  _  ____  ____  ____ 
(  _ \ /__\ (_  _)( )_( )( ___)(_  _)( \( )(  _ \( ___)(  _ \
 )___//(__)\  )(   ) _ (  )__)  _)(_  )  (  )(_) ))__)  )   /
(__) (__)(__)(__) (_) (_)(__)  (____)(_)\_)(____/(____)(_)\_)
 
 
  ___  _____  ____  ____ 
 / __)(  _  )(  _ \( ___)
( (__  )(_)(  )(_) ))__) 
 \___)(_____)(____/(____)


Test strings

// ASCII = 
"\t\n\r  !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
//127  7F  01111111  DEL  delete  &#127;

// ANSI
"\t\n\r  !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"

// combined
"\t\n\r  !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ &#60;&#62; ✓łŁ˘˛÷˙ˇ \\ \/ árvíztűrő tükörfúrógép ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP"

// unicode 
"\t\n\r  !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ &#60;&#62; ✓łŁ˘˛÷˙ˇ \\ \/ árvíztűrő tükörfúrógép ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP \uD834\uDF06 \u00E0\u00E8\u00EC\u00F2\u00F9"

// Blade Runner
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhäuser Gate. All those moments will be lost in time, like tears in rain. Time to die."

// lorem ipsum short 
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium."

// lorem ipsum medium
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci."

// lorem ipsum long
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum mollis diam. Pellentesque ut neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In dui magna, posuere eget, vestibulum et, tempor auctor, justo. In ac felis quis tortor malesuada pretium. Pellentesque auctor neque nec urna. Proin sapien ipsum, porta a, auctor quis, euismod ut, mi. Aenean viverra rhoncus pede. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut non enim eleifend felis pretium feugiat. Vivamus quis mi. Phasellus a est. Phasellus magna. In hac habitasse platea dictumst. Curabitur at lacus ac velit ornare lobortis. Curabitur a felis in nunc fringilla tristique. Morbi mattis ullamcorper velit. Phasellus gravida semper nisi. Nullam vel sem. Pellentesque libero tortor, tincidunt et, tincidunt eget, semper nec, quam. Sed hendrerit. Morbi ac felis. Nunc egestas, augue at pellentesque laoreet, felis eros vehicula leo, at malesuada velit leo quis pede. Donec interdum, metus et hendrerit aliquet, dolor diam sagittis ligula, eget egestas libero turpis vel mi. Nunc nulla. Fusce risus nisl, viverra et, tempor et, pretium in, sapien. Donec venenatis vulputate lorem. Morbi nec metus. Phasellus blandit leo ut odio. Maecenas ullamcorper, dui et placerat feugiat, eros pede varius nisi, condimentum viverra felis nunc et lorem. Sed magna purus, fermentum eu, tincidunt eu, varius ut, felis. In auctor lobortis lacus. Quisque libero metus, condimentum nec, tempor a, commodo mollis, magna. Vestibulum ullamcorper mauris at ligula. Fusce fermentum. Nullam cursus lacinia erat. Praesent blandit laoreet nibh. Fusce convallis metus id felis luctus adipiscing. Pellentesque egestas, neque sit amet convallis pulvinar, justo nulla eleifend augue, ac auctor orci leo non est. Quisque id mi. Ut tincidunt tincidunt erat. Etiam feugiat lorem non metus. Vestibulum dapibus nunc ac augue. Curabitur vestibulum aliquam leo. Praesent egestas neque eu enim. In hac habitasse platea dictumst. Fusce a quam. Etiam ut purus mattis mauris sodales aliquam. Curabitur nisi. Quisque malesuada placerat nisl. Nam ipsum risus, rutrum vitae, vestibulum eu, molestie vel, lacus. Sed augue ipsum, egestas nec, vestibulum et, malesuada adipiscing, dui. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc, vitae euismod ligula urna in dolor. Mauris sollicitudin fermentum libero. Praesent nonummy mi in odio. Nunc interdum lacus sit amet orci. Vestibulum rutrum, mi nec elementum vehicula, eros quam gravida nisl, id fringilla neque ante vel mi. Morbi mollis tellus ac sapien. Phasellus volutpat, metus eget egestas mollis, lacus lacus blandit dui, id egestas quam mauris ut lacus. Fusce vel dui. Sed in libero ut nibh placerat accumsan. Proin faucibus arcu quis ante. In consectetuer turpis ut velit. Nulla sit amet est. Praesent metus tellus, elementum eu, semper a, adipiscing nec, purus. Cras risus ipsum, faucibus ut, ullamcorper id, varius ac, leo. Suspendisse feugiat. Suspendisse enim turpis, dictum sed, iaculis a, condimentum nec, nisi. Praesent nec nisl a purus blandit viverra. Praesent ac massa at ligula laoreet iaculis. Nulla neque dolor, sagittis eget, iaculis quis, molestie non, velit. Mauris turpis nunc, blandit et, volutpat molestie, porta ut, ligula. Fusce pharetra convallis urna. Quisque ut nisi. Donec mi odio, faucibus at, scelerisque quis."

Dropped proposals

"use strict";

/*
https://github.com/DavidBruant/Map-Set.prototype.toJSON
This proposal was brought before the committee in the March 2016 meeting, and thoroughly rejected.

https://github.com/DavidBruant/Map-Set.prototype.toJSON/issues/16
In the March 2016 TC39 meeting, I brought this proposal to the committee.
It was thoroughly rejected, for a number of reasons. Primarily, that toJSON is a legacy artifact, and a better approach is to use a custom replacer that, for example, checks [Symbol.toStringTag] and dispatches to appropriate serializations.
In addition, the committee did not want to bless the toJSON approach by adding what would be an incomplete representation - one that would not obviate the need for developers to define their own serialization format and revivification logic.
*/
// V0
Map.prototype.toJSON = function toJSON() {
  return [...Map.prototype.entries.call(this)];
}
Set.prototype.toJSON = function toJSON() {
  return [...Set.prototype.values.call(this)];
}
/*
var m1 = new Map([["a",2],["b",4]]);
var s1 = new Set(["a",2,"b",4,8]);
JSON.stringify(["a",2,"b",4,8]);
// "[\"a\",2,\"b\",4,8]"
JSON.stringify(m1);
// "[[\"a\",2],[\"b\",4]]"
JSON.stringify(s1); // "[\"a\",2,\"b\",4,8]"
*/


/*
// https://github.com/tc39/Array.prototype.includes
// https://esdiscuss.org/topic/having-a-non-enumerable-array-prototype-contains-may-not-be-web-compatible

if (!Array.prototype.contains) {
  Array.prototype.contains = Array.prototype.includes;
}
if (!String.prototype.contains) {
  String.prototype.contains = String.prototype.includes;
}

"use strict";
if(!Array.prototype.contains){Array.prototype.contains=Array.prototype.includes;}
if(!String.prototype.contains){String.prototype.contains=String.prototype.includes;}
*/

if (!Array.prototype.contains) {
  Array.prototype.contains = (
    Array.prototype.includes ||
    function (v, f) { if (!f) { var f = 0; } return (this.indexOf(v,f) > -1); }
  );
}
if (!String.prototype.contains) {
  String.prototype.contains = (
    String.prototype.includes ||
    function (v, f) { if (!f) { var f = 0; } return (this.indexOf(v,f) > -1); }
  );
}


if (!document.all) { document.all = document.getElementsByTagName("*"); }


// https://www.w3.org/TR/selectors-api2/
[Element.prototype, document].forEach(
  function (p) {
    if (!p.query) {
      p.query = function (s) { return this.querySelector(s); };
    }
    if (!p.queryAll) {
      p.queryAll = function (s) {
        return Array.prototype.slice.call(this.querySelectorAll(s));
      };
    }
    if (!p.find) {
      p.find = function (s) { return this.querySelector(s); };
    }
    if (!p.findAll) {
      p.findAll = function (s) {
        return Array.prototype.slice.call(this.querySelectorAll(s));
      };
    }
  }
);


[Element.prototype, CharacterData.prototype, DocumentType.prototype].forEach(
  function (p) { if (!p.replace) { p.replace = p.replaceWith; } }
);


if (!Array.prototype.pushAll) {
  Array.prototype.pushAll = function (items) {
    if (!Array.isArray(items)) {
      throw new TypeError("pushAll error: Argument must be an array.");
    }
    //this.push.apply(this, items);
    var t = this;
    items.forEach(function (e) { t.push(e); });
    return this;
  };
}
// or
let arr1 = [0, 1, 2];
let arr2 = [3, 4, 5];
let arr3 = [6, 7, 8];
arr1.push(...arr2);
console.log(arr1); // Array(6) [ 0, 1, 2, 3, 4, 5 ]
arr1 = [0, 1, 2];
arr1.push(...arr2, 42, "dna");
console.log(arr1); // Array(8) [ 0, 1, 2, 3, 4, 5, 42, "dna" ]
arr1 = [0, 1, 2];
arr1.push(...arr2, ...arr3);
console.log(arr1); // Array(9) [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]
// or (bug!)
var arrayMerge = Function.prototype.apply.bind(Array.prototype.push);
let arr1 = [0, 1, 2];
let arr2 = [3, 4, 5];
let arr3 = [6, 7, 8];
arrayMerge(arr1, arr2);
console.log(arr1); // Array(6) [ 0, 1, 2, 3, 4, 5 ]
arr1 = [0, 1, 2];
arrayMerge(arr1, arr2, arr3);
console.log(arr1); // Array(6) [ 0, 1, 2, 3, 4, 5 ] -> bug!


// https://github.com/jeresig/nodelist
// Returns a plain JavaScript array containing all the nodes within the NodeList.
if (window.NodeList && !NodeList.prototype.toArray) {
  NodeList.prototype.toArray = function () {
    //return [...this];
    //return Array.from(this);
    return Array.prototype.slice.call(this);
  };
}


// https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/63
// This was a Firefox-specific method and was removed in Firefox 31.
// https://developer.mozilla.org/en-US/docs/Web/API/Window/back
if (!window.back) { window.back = function () { window.history.back(); }; }
// https://developer.mozilla.org/en-US/docs/Web/API/Window/forward
if (!window.forward) { window.forward=function() { window.history.forward(); };}


/*
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/quote

The non-standard quote() method returns a copy of the string, replacing various special characters in the string with their escape sequences and wrapping the result in double-quotes ("). __Only in Firefox 1 — 37__ __This is Obsolete since Gecko 37 (Firefox 37 / Thunderbird 37 / SeaMonkey 2.34)__

"Hello world!".quote()     // "\"Hello world!\""
"Hello\n\tworld!".quote()  // "\"Hello\\n\\tworld!\"" - eval ok
"\" \ — '".quote()         // "\"\\\"  — '\""
*/
// Only in Firefox 1 — 37
if (!String.prototype.quote) {
  String.prototype.quote = function () { return JSON.stringify(this); };
}


/*
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/count

http://whereswalden.com/2010/04/06/more-changes-coming-to-spidermonkey-the-magical-__count__-property-of-objects-is-being-removed/

Object.prototype.__count__
*/
// Only in Firefox 16 — 32
if (!Object.prototype.__count__) {
  Object.defineProperty(Object.prototype, "__count__", {
    configurable: true,
    get: function () { return Object.keys(this).length; }
  });
}


/*
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toInteger

Number.toInteger() was part of the draft ECMAScript 6 specification, but has been removed on August 23, 2013 in Draft Rev 17.

The Number.toInteger() method used to evaluate the passed value and convert it to an integer, but its implementation has been removed.

If the target value is NaN, null or undefined, 0 is returned. If the target value is false, 0 is returned and if true, 1 is returned.

Number.toInteger(number)

Number.toInteger(0.1);     // 0
Number.toInteger(1);       // 1
Number.toInteger(Math.PI); // 3
Number.toInteger(null);    // 0
*/
//if (!Number.toInteger) { Number.toInteger = parseInt; }
if (!Number.toInteger) {
  Number.toInteger = function (v) { return parseInt(v) || 0; };
}
/*
Added later:
Number.parseInt();
Number.parseFloat();
*/


// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction
//The GeneratorFunction constructor creates a new generator function object. In JavaScript every generator function is actually a GeneratorFunction object. Note that GeneratorFunction is not a global object. It could be obtained by evaluating the following code.
if (!window.GeneratorFunction) {
  window.GeneratorFunction = Object.getPrototypeOf(function*(){}).constructor;
}
/*
var g = new GeneratorFunction("a", "yield a * 2");
var iterator = g(10);
console.log(iterator.next().value); // 20
*/


// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/isGenerator
// The non-standard isGenerator() method used to determine whether or not a function is a generator. It has been removed from Firefox starting with version 58. It was part of an early Harmony proposal, but has not been included in the ECMAScript 2015 specification.
// only FF 5-58
if (!Function.prototype.isGenerator) {
  Function.prototype.isGenerator = function () {
    return (Object.getPrototypeOf(this).constructor ===
      Object.getPrototypeOf(function*(){}).constructor);
  };
}
/*
function f() {}
function* g() { yield 42; }
console.log("f.isGenerator() = " + f.isGenerator()); // false
console.log("g.isGenerator() = " + g.isGenerator()); // true
*/


// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
// The substr() method returns a portion of the string, starting at the specified index and extending for a given number of characters afterward.
// DEPRECATED

// Microsoft's JScript does not support negative values for the start index. To use this feature in JScript, you can use the following code:
// only run when the substr() function is broken
if ('ab'.substr(-1) != 'b') {
  /**
   *  Get the substring of a string
   *  @param  {integer}  start   where to start the substring
   *  @param  {integer}  length  how many characters to return
   *  @return {string}
   */
  String.prototype.substr = function(substr) {
    return function(start, length) {
      // call the original method
      return substr.call(this,
      	// did we get a negative start, calculate how much it is from the beginning of the string
        // adjust the start parameter for negative value
        start < 0 ? this.length + start : start,
        length)
    }
  }(String.prototype.substr);
}

// my real polyfill:
if (!String.prototype.substr) {
  String.prototype.substr = function (start, length) {
    var start2 = start < 0 ? this.length + start : start;
    if (start2 < 0) { start2 = 0; }
    if (length !== undefined) {
      return this.slice(start2, start2 + length);
    } else {
      return this.slice(start2);
    }
  };
}


// https://github.com/tc39/proposal-array-last

Object.defineProperty(Array.prototype, "lastItem", {
  enumerable: false,
  configurable: false,
  get () {
    var O = Object(this);
    var len = O.length > 0 ? parseInt(O.length) : 0;
    if (len === 0) {
      return undefined;
    } else if (len > 0) {
      return O[String(len - 1)];
    }
  },
  set (value) {
    var O = Object(this);
    var len = O.length > 0 ? parseInt(O.length) : 0;
    return O[String(len > 0 ? len - 1 : len)] = value;
  }
});
Object.defineProperty(Array.prototype, "lastIndex", {
  enumerable: false,
  configurable: false,
  get () {
    var O = Object(this);
    var len = O.length > 0 ? parseInt(O.length) : 0;
    return len > 0 ? len - 1 : 0;
  }
});

var a1 = [4,5,6,7,8];
console.log(a1.lastItem); // 8
a1.lastItem = 9;
console.log(a1.lastItem); // 9
console.log(a1.lastIndex); // 4
a1 = [];
console.log(a1.lastItem); // undefined
console.log(a1.lastIndex); // 0
a1.lastItem = 3;
console.log(a1.lastIndex); // 0;
console.log(a1.lastItem); // 3
a1.push(10);
console.log(a1.lastIndex); // 1
console.log(a1.lastItem); // 10


// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSource

if (!Array.prototype.toSource) {
  Array.prototype.toSource = function () { return JSON.stringify(this); };
}


/*
Mozilla String generic methods polyfill
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_String_generics
*/
(function() {
  "use strict";
  var m = [
    "contains", "substring", "toLowerCase", "toUpperCase", "charAt",
    "charCodeAt", "indexOf", "lastIndexOf", "startsWith", "endsWith",
    "trim", "trimLeft", "trimRight", "toLocaleLowerCase", "normalize",
    "toLocaleUpperCase", "localeCompare", "match", "search", "slice",
    "replace", "split", "substr", "concat", "localeCompare"
  ].forEach(function (n) {
    var fn = String.prototype[n];
    String[n] = function (a1) {
      return fn.apply(""+a1, Array.prototype.slice.call(arguments, 1));
    };
  });
}());
// minified:
(function(){"use strict";var m=["contains","substring","toLowerCase","toUpperCase","charAt","charCodeAt","indexOf","lastIndexOf","startsWith","endsWith","trim","trimLeft","trimRight","toLocaleLowerCase","normalize","toLocaleUpperCase","localeCompare","match","search","slice","replace","split","substr","concat","localeCompare"].forEach(function(n){var fn=String.prototype[n];String[n]=function(a1){return fn.apply(""+a1,Array.prototype.slice.call(arguments,1));};});}());
//console.log( String.slice("asasdsaads", 2, 8) );
// -> "asdsaa" OK


/*
Mozilla Array generic methods polyfill
https://bugzilla.mozilla.org/show_bug.cgi?id=1222547
*/
(function() {
  "use strict";
  var m = [
    "concat", "every", "filter", "forEach", "indexOf", "join",
    "lastIndexOf", "pop", "push", "reduce", "reduceRight", "reverse",
    "shift", "slice", "some", "sort", "splice", "unshift"
  ].forEach(function (n) {
    var fn = Array.prototype[n];
    Array[n] = function (a1) {
      return fn.apply(a1, Array.prototype.slice.call(arguments, 1));
    };
  });
}());
// minified:
(function(){"use strict";var m=["concat","every","filter","forEach","indexOf","join","lastIndexOf","pop","push","reduce","reduceRight","reverse","shift","slice","some","sort","splice","unshift"].forEach(function(n){var fn=Array.prototype[n];Array[n]=function(a1){return fn.apply(a1,Array.prototype.slice.call(arguments,1));};});}());
//console.log( Array.slice({0: "a", 1: "b", 2: "c", length: 3}) );
// -> Array(3) [ "a", "b", "c" ] OK
@Serrin Serrin added this to the 4.10.0 Defiant milestone Aug 31, 2021
@Serrin Serrin self-assigned this Aug 31, 2021
@Serrin Serrin changed the title Changes in v4.7.0 Changes in v5.0.1 Sep 13, 2021
@Serrin Serrin modified the milestones: 5.0.0 Defiant, 5.15.0 Voyager Sep 13, 2021
@Serrin Serrin changed the title Changes in v5.0.1 Celestra.next v6 Sep 15, 2021
@Serrin Serrin modified the milestones: 5.15.0 Voyager, Celestra.next Sep 15, 2021
@Serrin Serrin changed the title Celestra.next v6 Celestra.next Sep 19, 2021
@Serrin Serrin pinned this issue Dec 20, 2021
@Serrin Serrin unpinned this issue Dec 20, 2021
@Serrin Serrin changed the title Celestra.next Celestra Wiki Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant