Skip to content

Instantly share code, notes, and snippets.

@Ljzn
Created July 27, 2019 09:38
Show Gist options
  • Save Ljzn/c767a0df245ea34777135e9dbc3bdf5b to your computer and use it in GitHub Desktop.
Save Ljzn/c767a0df245ea34777135e9dbc3bdf5b to your computer and use it in GitHub Desktop.
const FundamentalObjects = [
Object,
Function,
Boolean,
Symbol,
Error
]
const NumbersAndDates = [
Number,
BigInt,
Math,
Date
]
const TextProcessing = [
String,
RegExp
]
const IndexedCollections = [
Array,
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array,
BigInt64Array,
BigUint64Array
]
const KeyedCollections = [
Map,
Set,
WeakMap,
WeakSet
]
const StructuredData = [
ArrayBuffer,
SharedArrayBuffer,
Atomics,
DataView,
JSON
]
const ControlAbstractionObjects = [
Promise,
// Generator,
// GeneratorFunction,
// AsyncFunction
]
const Reflection = [
Reflect,
Proxy
]
const Internationalization = [
Intl,
Intl.Collator,
Intl.DateTimeFormat,
Intl.ListFormat,
Intl.NumberFormat,
Intl.PluralRules,
Intl.RelativeTimeFormat,
Intl.Locale
]
const WebAssembly = [
WebAssembly,
WebAssembly.Module,
WebAssembly.Instance,
WebAssembly.Memory,
WebAssembly.Table,
WebAssembly.CompileError,
WebAssembly.LinkError,
WebAssembly.RuntimeError
]
const ObjectsToLearn =
FundamentalObjects
.concat(NumbersAndDates)
.concat(TextProcessing)
.concat(IndexedCollections)
.concat(KeyedCollections)
.concat(StructuredData)
.concat(ControlAbstractionObjects)
.concat(Internationalization)
.concat(WebAssembly)
const listMethodsOf = (object) => {
try {
return Object.getOwnPropertyNames(object.prototype)
.filter(f => !['caller', 'callee', 'arguments'].includes(f))
.filter(f => {
try {
let bool = typeof(object['prototype'][f]) == 'function'
return true
} catch (e) {
return false
}
})
} catch (e) {
return []
}
}
// console.log(listMethodsOf(Map))
let r =
ObjectsToLearn
.filter(o => o.name)
.map(o => '# ' + o.name + '\n' +
listMethodsOf(o)
.map(f => '- [ ] [' + f + '](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/' + o.name + '/' + f + ')')
.join('\n')
)
.join('\n')
console.log(r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment