From e3d384ccca811b9421ad83cc8c9aef9e3f2a4eef Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Mon, 21 Feb 2022 18:31:18 -0600 Subject: [PATCH 1/2] Ran lebab --- src/Data/ArrayBuffer/ArrayBuffer.js | 8 +- src/Data/ArrayBuffer/DataView.js | 32 +++---- src/Data/ArrayBuffer/Typed.js | 144 ++++++++++++++-------------- 3 files changed, 90 insertions(+), 94 deletions(-) diff --git a/src/Data/ArrayBuffer/ArrayBuffer.js b/src/Data/ArrayBuffer/ArrayBuffer.js index b341921..30033c4 100644 --- a/src/Data/ArrayBuffer/ArrayBuffer.js +++ b/src/Data/ArrayBuffer/ArrayBuffer.js @@ -6,10 +6,10 @@ exports.emptyImpl = function empty (s) { return new ArrayBuffer(s); }; -exports.byteLength = function byteLength (a) { +export function byteLength(a) { return a.byteLength; -}; +} -exports.sliceImpl = function sliceImpl (a, s, e) { +export function sliceImpl(a, s, e) { return a.slice(s, e); -}; +} diff --git a/src/Data/ArrayBuffer/DataView.js b/src/Data/ArrayBuffer/DataView.js index 6bfee81..4c6a9db 100644 --- a/src/Data/ArrayBuffer/DataView.js +++ b/src/Data/ArrayBuffer/DataView.js @@ -3,41 +3,41 @@ // module Data.ArrayBuffer.DataView -exports.whole = function whole (b) { +export function whole(b) { return new DataView(b); -}; +} -exports.remainderImpl = function remainderImpl (b,i) { +export function remainderImpl(b, i) { return new DataView(b,i); -}; +} -exports.partImpl = function partImpl (b,i,j) { +export function partImpl(b, i, j) { return new DataView(b,i,j); -}; +} -exports.buffer = function buffer (v) { +export function buffer(v) { return v.buffer; -}; +} -exports.byteOffset = function byteOffset (v) { +export function byteOffset(v) { return v.byteOffset; -}; +} -exports.byteLength = function byteLength (v) { +export function byteLength(v) { return v.byteLength; -}; +} -exports.getterImpl = function getterImpl (data, v, o) { +export function getterImpl(data, v, o) { return ((o + data.bytesPerValue) >>> 0) <= v.byteLength ? v[data.functionName].call(v,o,data.littleEndian) : null; -}; +} -exports.setterImpl = function setterImpl (data, v, o, n) { +export function setterImpl(data, v, o, n) { if (((o + data.bytesPerValue) >>> 0) <= v.byteLength) { v[data.functionName].call(v,o,n,data.littleEndian); return true; } else { return false; } -}; +} diff --git a/src/Data/ArrayBuffer/Typed.js b/src/Data/ArrayBuffer/Typed.js index 2ab0cb6..4463750 100644 --- a/src/Data/ArrayBuffer/Typed.js +++ b/src/Data/ArrayBuffer/Typed.js @@ -2,17 +2,17 @@ // module Data.ArrayBuffer.Typed -exports.buffer = function buffer (v) { +export function buffer(v) { return v.buffer; -}; +} -exports.byteOffset = function byteOffset (v) { +export function byteOffset(v) { return v.byteOffset; -}; +} -exports.byteLength = function byteLength (v) { +export function byteLength(v) { return v.byteLength; -}; +} exports.lengthImpl = function lemgthImpl (v) { return v.length; @@ -36,130 +36,126 @@ function newArray (f) { }; } -exports.newUint8ClampedArray = newArray(Uint8ClampedArray); -exports.newUint32Array = newArray(Uint32Array); -exports.newUint16Array = newArray(Uint16Array); -exports.newUint8Array = newArray(Uint8Array); -exports.newInt32Array = newArray(Int32Array); -exports.newInt16Array = newArray(Int16Array); -exports.newInt8Array = newArray(Int8Array); -exports.newFloat32Array = newArray(Float32Array); -exports.newFloat64Array = newArray(Float64Array); - +export var newUint8ClampedArray = newArray(Uint8ClampedArray); +export var newUint32Array = newArray(Uint32Array); +export var newUint16Array = newArray(Uint16Array); +export var newUint8Array = newArray(Uint8Array); +export var newInt32Array = newArray(Int32Array); +export var newInt16Array = newArray(Int16Array); +export var newInt8Array = newArray(Int8Array); +export var newFloat32Array = newArray(Float32Array); +export var newFloat64Array = newArray(Float64Array); // ------ -exports.everyImpl = function everyImpl (a,p) { +export function everyImpl(a, p) { return a.every(p); -}; -exports.someImpl = function someImpl (a,p) { - return a.some(p); -}; +} +export function someImpl(a, p) { + return a.some(p); +} -exports.fillImpl = function fillImpl (x, s, e, a) { +export function fillImpl(x, s, e, a) { return a.fill(x,s,e); -}; - +} -exports.mapImpl = function mapImpl (a,f) { +export function mapImpl(a, f) { return a.map(f); -}; +} -exports.forEachImpl = function forEachImpl (a,f) { +export function forEachImpl(a, f) { a.forEach(f); -}; +} -exports.filterImpl = function filterImpl (a,p) { +export function filterImpl(a, p) { return a.filter(p); -}; +} -exports.includesImpl = function includesImpl (a,x,mo) { +export function includesImpl(a, x, mo) { return mo === null ? a.includes(x) : a.includes(x,mo); -}; +} -exports.reduceImpl = function reduceImpl (a,f,i) { +export function reduceImpl(a, f, i) { return a.reduce(f,i); -}; -exports.reduce1Impl = function reduce1Impl (a,f) { +} + +export function reduce1Impl(a, f) { return a.reduce(f); -}; -exports.reduceRightImpl = function reduceRightImpl (a,f,i) { +} + +export function reduceRightImpl(a, f, i) { return a.reduceRight(f,i); -}; -exports.reduceRight1Impl = function reduceRight1Impl (a,f) { +} + +export function reduceRight1Impl(a, f) { return a.reduceRight(f); -}; +} -exports.findImpl = function findImpl (a,f) { +export function findImpl(a, f) { return a.find(f); -}; +} -exports.findIndexImpl = function findIndexImpl (a,f) { +export function findIndexImpl(a, f) { var r = a.findIndex(f); return r === -1 ? null : r; -}; -exports.indexOfImpl = function indexOfImpl (a,x,mo) { +} + +export function indexOfImpl(a, x, mo) { var r = mo === null ? a.indexOf(x) : a.indexOf(x,mo); return r === -1 ? null : r; -}; -exports.lastIndexOfImpl = function lastIndexOfImpl (a,x,mo) { +} + +export function lastIndexOfImpl(a, x, mo) { var r = mo === null ? a.lastIndexOf(x) : a.lastIndexOf(x,mo); return r === -1 ? null : r; -}; - - +} -exports.copyWithinImpl = function copyWithinImpl (a,t,s,me) { +export function copyWithinImpl(a, t, s, me) { if (me === null) { a.copyWithin(t,s); } else { a.copyWithin(t,s,me); } -}; - +} -exports.reverseImpl = function reverseImpl (a) { +export function reverseImpl(a) { a.reverse(); -}; - +} -exports.setImpl = function setImpl (a, off, b) { +export function setImpl(a, off, b) { a.set(b,off); -}; - +} -exports.sliceImpl = function sliceImpl (a, s, e) { +export function sliceImpl(a, s, e) { return a.slice(s,e); -}; +} -exports.sortImpl = function sortImpl (a) { +export function sortImpl(a) { a.sort(); -}; - +} -exports.subArrayImpl = function subArrayImpl (a, s, e) { +export function subArrayImpl(a, s, e) { return a.subarray(s, e); -}; - +} -exports.toStringImpl = function toStringImpl (a) { +export function toStringImpl(a) { return a.toString(); -}; +} -exports.joinImpl = function joinImpl (a,s) { +export function joinImpl(a, s) { return a.join(s); -}; +} -exports.unsafeAtImpl = function(a, i) { +export function unsafeAtImpl(a, i) { return a[i]; } -exports.hasIndexImpl = function(a, i) { +export function hasIndexImpl(a, i) { return i in a; } -exports.toArrayImpl = function(a) { +export function toArrayImpl(a) { var l = a.length; var ret = new Array(l); for (var i = 0; i < l; i++) From eee616137f5f8182b4481ca9e9db317d4c325e33 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Mon, 21 Feb 2022 18:31:35 -0600 Subject: [PATCH 2/2] Replace export var with export const --- src/Data/ArrayBuffer/Typed.js | 112 +++++++++++++++++----------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/src/Data/ArrayBuffer/Typed.js b/src/Data/ArrayBuffer/Typed.js index 4463750..683093b 100644 --- a/src/Data/ArrayBuffer/Typed.js +++ b/src/Data/ArrayBuffer/Typed.js @@ -3,162 +3,162 @@ // module Data.ArrayBuffer.Typed export function buffer(v) { - return v.buffer; + return v.buffer; } export function byteOffset(v) { - return v.byteOffset; + return v.byteOffset; } export function byteLength(v) { - return v.byteLength; + return v.byteLength; } -exports.lengthImpl = function lemgthImpl (v) { - return v.length; +exports.lengthImpl = function lemgthImpl(v) { + return v.length; }; // Typed Arrays -function newArray (f) { - return function newArray_ (a,mb,mc) { +function newArray(f) { + return function newArray_(a, mb, mc) { if (mb === null) return new f(a); var l = a.byteLength; var eb = f.BYTES_PER_ELEMENT; - var off = Math.min(l, mb>>>0); + var off = Math.min(l, mb >>> 0); if (mc === null) - return new f(a,off); + return new f(a, off); var len = Math.min((l - off) / eb, mc); - return new f(a,off,len); + return new f(a, off, len); }; } -export var newUint8ClampedArray = newArray(Uint8ClampedArray); -export var newUint32Array = newArray(Uint32Array); -export var newUint16Array = newArray(Uint16Array); -export var newUint8Array = newArray(Uint8Array); -export var newInt32Array = newArray(Int32Array); -export var newInt16Array = newArray(Int16Array); -export var newInt8Array = newArray(Int8Array); -export var newFloat32Array = newArray(Float32Array); -export var newFloat64Array = newArray(Float64Array); +export const newUint8ClampedArray = newArray(Uint8ClampedArray); +export const newUint32Array = newArray(Uint32Array); +export const newUint16Array = newArray(Uint16Array); +export const newUint8Array = newArray(Uint8Array); +export const newInt32Array = newArray(Int32Array); +export const newInt16Array = newArray(Int16Array); +export const newInt8Array = newArray(Int8Array); +export const newFloat32Array = newArray(Float32Array); +export const newFloat64Array = newArray(Float64Array); // ------ export function everyImpl(a, p) { - return a.every(p); + return a.every(p); } export function someImpl(a, p) { - return a.some(p); + return a.some(p); } export function fillImpl(x, s, e, a) { - return a.fill(x,s,e); + return a.fill(x, s, e); } export function mapImpl(a, f) { - return a.map(f); + return a.map(f); } export function forEachImpl(a, f) { - a.forEach(f); + a.forEach(f); } export function filterImpl(a, p) { - return a.filter(p); + return a.filter(p); } export function includesImpl(a, x, mo) { - return mo === null ? a.includes(x) : a.includes(x,mo); + return mo === null ? a.includes(x) : a.includes(x, mo); } export function reduceImpl(a, f, i) { - return a.reduce(f,i); + return a.reduce(f, i); } export function reduce1Impl(a, f) { - return a.reduce(f); + return a.reduce(f); } export function reduceRightImpl(a, f, i) { - return a.reduceRight(f,i); + return a.reduceRight(f, i); } export function reduceRight1Impl(a, f) { - return a.reduceRight(f); + return a.reduceRight(f); } export function findImpl(a, f) { - return a.find(f); + return a.find(f); } export function findIndexImpl(a, f) { - var r = a.findIndex(f); - return r === -1 ? null : r; + var r = a.findIndex(f); + return r === -1 ? null : r; } export function indexOfImpl(a, x, mo) { - var r = mo === null ? a.indexOf(x) : a.indexOf(x,mo); - return r === -1 ? null : r; + var r = mo === null ? a.indexOf(x) : a.indexOf(x, mo); + return r === -1 ? null : r; } export function lastIndexOfImpl(a, x, mo) { - var r = mo === null ? a.lastIndexOf(x) : a.lastIndexOf(x,mo); - return r === -1 ? null : r; + var r = mo === null ? a.lastIndexOf(x) : a.lastIndexOf(x, mo); + return r === -1 ? null : r; } export function copyWithinImpl(a, t, s, me) { - if (me === null) { - a.copyWithin(t,s); - } else { - a.copyWithin(t,s,me); - } + if (me === null) { + a.copyWithin(t, s); + } else { + a.copyWithin(t, s, me); + } } export function reverseImpl(a) { - a.reverse(); + a.reverse(); } export function setImpl(a, off, b) { - a.set(b,off); + a.set(b, off); } export function sliceImpl(a, s, e) { - return a.slice(s,e); + return a.slice(s, e); } export function sortImpl(a) { - a.sort(); + a.sort(); } export function subArrayImpl(a, s, e) { - return a.subarray(s, e); + return a.subarray(s, e); } export function toStringImpl(a) { - return a.toString(); + return a.toString(); } export function joinImpl(a, s) { - return a.join(s); + return a.join(s); } export function unsafeAtImpl(a, i) { - return a[i]; + return a[i]; } export function hasIndexImpl(a, i) { - return i in a; + return i in a; } export function toArrayImpl(a) { - var l = a.length; - var ret = new Array(l); - for (var i = 0; i < l; i++) - ret[i] = a[i]; - return ret; + var l = a.length; + var ret = new Array(l); + for (var i = 0; i < l; i++) + ret[i] = a[i]; + return ret; }