MCPcopy Create free account
hub / github.com/Maccoder3/MAC-MD / protoType

Function protoType

lib/simple.js:1738–1813  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1736}
1737
1738export function protoType() {
1739 Buffer.prototype.toArrayBuffer = function toArrayBufferV2() {
1740 const ab = new ArrayBuffer(this.length)
1741 const view = new Uint8Array(ab)
1742 for (let i = 0; i < this.length; ++i) {
1743 view[i] = this[i]
1744 }
1745 return ab
1746 }
1747 /**
1748 * @returns {ArrayBuffer}
1749 */
1750 Buffer.prototype.toArrayBufferV2 = function toArrayBuffer() {
1751 return this.buffer.slice(this.byteOffset, this.byteOffset + this.byteLength)
1752 }
1753 /**
1754 * @returns {Buffer}
1755 */
1756 ArrayBuffer.prototype.toBuffer = function toBuffer() {
1757 return Buffer.from(new Uint8Array(this))
1758 }
1759 // /**
1760 // * @returns {String}
1761 // */
1762 // Buffer.prototype.toUtilFormat = ArrayBuffer.prototype.toUtilFormat = Object.prototype.toUtilFormat = Array.prototype.toUtilFormat = function toUtilFormat() {
1763 // return util.format(this)
1764 // }
1765 Uint8Array.prototype.getFileType =
1766 ArrayBuffer.prototype.getFileType =
1767 Buffer.prototype.getFileType =
1768 async function getFileType() {
1769 return await fileTypeFromBuffer(this)
1770 }
1771 /**
1772 * @returns {Boolean}
1773 */
1774 String.prototype.isNumber = Number.prototype.isNumber = isNumber
1775 /**
1776 *
1777 * @returns {String}
1778 */
1779 String.prototype.capitalize = function capitalize() {
1780 return this.charAt(0).toUpperCase() + this.slice(1, this.length)
1781 }
1782 /**
1783 * @returns {String}
1784 */
1785 String.prototype.capitalizeV2 = function capitalizeV2() {
1786 const str = this.split(' ')
1787 return str.map(v => v.capitalize()).join(' ')
1788 }
1789 String.prototype.decodeJid = function decodeJid() {
1790 if (/:\d+@/gi.test(this)) {
1791 const decode = jidDecode(this) || {}
1792 return ((decode.user && decode.server && decode.user + '@' + decode.server) || this).trim()
1793 } else return this.trim()
1794 }
1795 /**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected