grawlix.js
function(str, options) {
  // get settings
  var settings;
  if (_.isUndefined(options) && defaultSettings !== null) {
    settings = defaultSettings;
  } else if (!_.isUndefined(options)) {
    settings = util.parseOptions(options, defaultOptions);
  } else {
    settings = util.parseOptions(defaultOptions);
    defaultSettings = settings;
  }
  // return processed string
  return util.replaceMatches(str, settings);
}
function(str, options) {
  // get settings
  var settings;
  if (_.isUndefined(options) && defaultSettings !== null) {
    settings = defaultSettings;
  } else if (!_.isUndefined(options)) {
    settings = util.parseOptions(options, defaultOptions);
  } else {
    settings = util.parseOptions(defaultOptions);
    defaultSettings = settings;
  }
  // return processed string
  return util.replaceMatches(str, settings);
}
function ( str , options ) { // get settings var settings ; if ( _ . isUndefined ( options ) && defaultSettings !== null ) { settings = defaultSettings ; } else if ( ! _ . isUndefined ( options ) ) { settings = util . parseOptions ( options , defaultOptions ) ; } else { settings = util . parseOptions ( defaultOptions ) ; defaultSettings = settings ; } // return processed string return util . replaceMatches ( str , settings ) ; }
Replaces all curse words in the given content string with cartoon-like
grawlixes.
@param  {String}  str               Content string
@param  {Object}  options           Options object. Optional.
@param  {Object}  options.style     Style of grawlix to use for replacements.
Can be either a string, with the name of
the style to use; or an object with a
required `name` property. See readme for
more details and available options.
Defaults to the `ascii` style.
@param  {Boolean} options.randomize Whether or not to replace curses with
randomized or fixed grawlixes. Default is
true.
@param  {Array}   options.allowed   Array of strings, representing
whitelisted words that would otherwise be
replaced. Optional.
@param  {Array}   options.filters   Array of custom filter objects. These can
either reconfigure one of the existing
default filter, or represent an entirely
new filter. See readme for details.
Optional.
@param  {Array}   options.plugins   Array of either plugin factory functions
or GrawlixPlugin objects. See docs for
details. Optional.
@return {String}                    Processed string
Replaces all curse words in the given content string with cartoon - like grawlixes .