Skip to content

Instantly share code, notes, and snippets.

View BufferWithPointer.ts
export class BufferWithPointer {
public pointer = 0
constructor(private buf: Buffer) {}
private len = this.buf.length
/**
* Sets the buffer pointer, the address at which next parse will begin.
* @throws {RangeError} if this will put pointer outside of `0..=len` range.
* @param {number} addr What index to go to
* @returns {number} the previous pointer, before setting
@qm3ster
qm3ster / index.js
Created Sep 19, 2017
requirebin sketch
View index.js
const pug = require('pug')
const hljs = require('highlight.js')
const beautify = require('js-beautify')
const includes = {}
Object.assign(includes, {
$pug: str => pug.render(str, includes),
$highlight: lang =>
lang === 'auto'
? str => hljs.highlightAuto(str).value
You can’t perform that action at this time.