Skip to content

Commit

Permalink
Allow bundling for browser
Browse files Browse the repository at this point in the history
See #12. We've refactored the module a bit more so it can now be bundled with webpack, at least that's what we hope, lol.
  • Loading branch information
sebamarynissen committed Dec 7, 2022
1 parent d58c2a6 commit e2d5f81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/dbpf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const Stream = require('./stream');
const crc32 = require('./crc');
const { cClass, FileType } = require('./enums');
const { hex, tgi } = require('./util');
const inspect = require('./inspect.js');

// # DBPF()
// A class that represents a DBPF file. A DBPF file is basically just a custom
Expand Down Expand Up @@ -823,7 +824,7 @@ class Entry {
// ## [util.inspect.custom](depth, opts)
// If we console.log an entry in node we want to convert the TGI to their
// hex equivalents so that it's easier to debug.
[util.inspect.custom](depth, opts) {
[inspect](depth, opts) {
return 'DBPF Entry '+util.inspect({
type: hex(this.type),
group: hex(this.group),
Expand Down
8 changes: 3 additions & 5 deletions lib/inspect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// # inspect.js
// Exports the custom inspect symbol so that we can customize loggin in
// Node.js. We centralize this here so that we can mock this out in the
// browser bundle.
const util = require('util');
module.exports = util.inspect.custom;
// Exports the custom inspect symbol so that we can customize logging in
// Node.js.
module.exports = Symbol.for('nodejs.util.inspect.custom');

0 comments on commit e2d5f81

Please sign in to comment.