purgejs

1.0.3 • Public • Published

This package removes a significant portion of the default functionality for prototypes in Javascript. It exists as a teaching tool so that students can reimplement these methods themselves.

Code to use is

const purge = require("purgejs")

It should run immediatelys as an IIFE.

Have fun.

String methods removed
String.prototype.at
String.prototype.charAt
String.prototype.charCodeAt
String.prototype.codePointAt
String.prototype.concat
String.prototype.endsWith
String.prototype.fromCharCode
String.prototype.includes
String.prototype.indexOf
String.prototype.lastIndexOf
String.prototype.localeCompare
String.prototype.match
String.prototype.matchAll
String.prototype.normalize
String.prototype.padEnd
String.prototype.padStart
String.prototype.raw
String.prototype.repeat
String.prototype.replace
String.prototype.replaceAll
String.prototype.search
String.prototype.slice
String.prototype.split
String.prototype.startsWith
String.prototype.substring
String.prototype.toLocaleLowerCase
String.prototype.toLocaleUpperCase
String.prototype.toLowerCase
String.prototype.toString
String.prototype.toUpperCase
String.prototype.trim
String.prototype.trimEnd
String.prototype.trimStart
String.prototype.valueOf

Math methods removed
Math.abs
Math.ceil
Math.cbrt
Math.floor
Math.fround
Math.max
Math.min
Math.pow
Math.round
Math.sign
Math.trunc
Math.exp
Math.expm1
Math.hypot
Math.sqrt

More Math methods removed (trig)
Math.sin
Math.cos
Math.tan
Math.acos
Math.acosh
Math.asin
Math.asinh
Math.tan
Math.tanh
Math.atan2

Place holders for extra Math functionality
Math.degToRad      degrees to radians
Math.radToDeg      radians to degrees
Math.rangeRandom      random integer between two bounds including both upper and lower numbers

Array methods removed
Array.prototype.at
Array.prototype.concat
Array.prototype.copyWithin
Array.prototype.entries
Array.prototype.every
Array.prototype.fill
Array.prototype.find
Array.prototype.findIndex
Array.prototype.findLast
Array.prototype.findLastIndex
Array.prototype.flat
Array.prototype.flatMap
Array.prototype.forEach
Array.from
Array.prototype.includes
Array.prototype.indexOf
Array.isArray
Array.prototype.join
Array.prototype.keys
Array.prototype.lastIndexOf
Array.prototype.map
Array.of
Array.prototype.pop
Array.prototype.push
Array.prototype.reduce
Array.prototype.reduceRight
Array.prototype.reverse
Array.prototype.shift
Array.prototype.slice
Array.prototype.some
Array.prototype.sort
Array.prototype.splice
Array.prototype.toLocaleString
Array.prototype.toString
Array.prototype.unshift
Array.prototype.value

Set methods removed
Set.prototype.add
Set.prototype.clear
Set.prototype.delete
Set.prototype.has

Package Sidebar

Install

npm i purgejs

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

9.13 kB

Total Files

3

Last publish

Collaborators

  • otwalrus