Permalink
9e7643b Sep 27, 2014
@stephenmathieson @zzmp
93 lines (58 sloc) 1.56 KB

Obfuscator Documentation

obfuscator(options, cb)

Parameters

  • options Object The options
  • cb Function Callback: function (err, obfuscated)

Obfuscate and concatenate a NodeJS "package" because corporate says so.

obfuscator.options(files, root, entry, [strings])

Parameters

  • files Array The files contained in the package
  • root String The root of the package
  • entry String The entry point
  • [strings] Boolean Shall strings be obfuscated

Returns

Object

Create an options object for the obfuscator

Aliases (for back-compat):

  • Options
  • ObfuscatorOptions

Examples:

var opts = new obfuscator.Options(
  // files
  [ './myfile.js', './mydir/thing.js'],
  // root
  './',
  // entry
  'myfile.js',
  // strings
  true)

var opts = obfuscator.options({...})

obfuscator.utils.hex(str)

Parameters

  • str String

Returns

String

Convert (or obfuscate) a string to its escaped hexidecimal representation. For example, hex('a') will return '\x63'.

obfuscator.utils.strings(js)

Parameters

  • js String

Returns

String

Mangle simple strings contained in some js

Strings will be mangled by replacing each contained character with its escaped hexidecimal representation. For example, "a" will render to "\x63".

Strings which contain non-alphanumeric characters other than .-_/ will be ignored.

Strings not wrapped in double quotes will be ignored.

Example:

utils.strings('var foo = "foo"';);
//=> 'var foo = "\x66\x6f\x6f";'