index.js
function setDefaultOptions (options) {
  const defaultOptions = {
    src: '**/*.php',
    globOpts: {},
    destFile: 'translations.pot',
    commentKeyword: 'translators:',
    headers: {
      'X-Poedit-Basepath': '..',
      'X-Poedit-SourceCharset': 'UTF-8',
      'X-Poedit-SearchPath-0': '.',
      'X-Poedit-SearchPathExcluded-0': '*.js'
    },
    defaultHeaders: true,
    noFilePaths: false,
    writeFile: true,
    gettextFunctions: [
      { name: '__' },
      { name: '_e' },
      { name: '_ex', context: 2 },
      { name: '_n', plural: 2 },
      { name: '_n_noop', plural: 2 },
      { name: '_nx', plural: 2, context: 4 },
      { name: '_nx_noop', plural: 2, context: 3 },
      { name: '_x', context: 2 },
      { name: 'esc_attr__' },
      { name: 'esc_attr_e' },
      { name: 'esc_attr_x', context: 2 },
      { name: 'esc_html__' },
      { name: 'esc_html_e' },
      { name: 'esc_html_x', context: 2 }
    ]
  };

  if (options.headers === false) {
    options.defaultHeaders = false;
  }

  options = Object.assign({}, defaultOptions, options);

  if (!options.package) {
    options.package = options.domain || 'unnamed project';
  }

  const functionCalls = {
    valid: [],
    contextPosition: {},
    pluralPosition: {}
  };

  options.gettextFunctions.forEach(function (methodObject) {
    functionCalls.valid.push(methodObject.name);

    if (methodObject.plural) {
      functionCalls.pluralPosition[ methodObject.name ] = methodObject.plural;
    }
    if (methodObject.context) {
      functionCalls.contextPosition[ methodObject.name ] = methodObject.context;
    }
  });

  options.functionCalls = functionCalls;

  return options;
}
function setDefaultOptions (options) {
  const defaultOptions = {
    src: '**/*.php',
    globOpts: {},
    destFile: 'translations.pot',
    commentKeyword: 'translators:',
    headers: {
      'X-Poedit-Basepath': '..',
      'X-Poedit-SourceCharset': 'UTF-8',
      'X-Poedit-SearchPath-0': '.',
      'X-Poedit-SearchPathExcluded-0': '*.js'
    },
    defaultHeaders: true,
    noFilePaths: false,
    writeFile: true,
    gettextFunctions: [
      { name: '__' },
      { name: '_e' },
      { name: '_ex', context: 2 },
      { name: '_n', plural: 2 },
      { name: '_n_noop', plural: 2 },
      { name: '_nx', plural: 2, context: 4 },
      { name: '_nx_noop', plural: 2, context: 3 },
      { name: '_x', context: 2 },
      { name: 'esc_attr__' },
      { name: 'esc_attr_e' },
      { name: 'esc_attr_x', context: 2 },
      { name: 'esc_html__' },
      { name: 'esc_html_e' },
      { name: 'esc_html_x', context: 2 }
    ]
  };

  if (options.headers === false) {
    options.defaultHeaders = false;
  }

  options = Object.assign({}, defaultOptions, options);

  if (!options.package) {
    options.package = options.domain || 'unnamed project';
  }

  const functionCalls = {
    valid: [],
    contextPosition: {},
    pluralPosition: {}
  };

  options.gettextFunctions.forEach(function (methodObject) {
    functionCalls.valid.push(methodObject.name);

    if (methodObject.plural) {
      functionCalls.pluralPosition[ methodObject.name ] = methodObject.plural;
    }
    if (methodObject.context) {
      functionCalls.contextPosition[ methodObject.name ] = methodObject.context;
    }
  });

  options.functionCalls = functionCalls;

  return options;
}
function setDefaultOptions ( options ) { const defaultOptions = { src : '**/*.php' , globOpts : { } , destFile : 'translations.pot' , commentKeyword : 'translators:' , headers : { 'X-Poedit-Basepath' : '..' , 'X-Poedit-SourceCharset' : 'UTF-8' , 'X-Poedit-SearchPath-0' : '.' , 'X-Poedit-SearchPathExcluded-0' : '*.js' } , defaultHeaders : true , noFilePaths : false , writeFile : true , gettextFunctions : [ { name : '__' } , { name : '_e' } , { name : '_ex' , context : 2 } , { name : '_n' , plural : 2 } , { name : '_n_noop' , plural : 2 } , { name : '_nx' , plural : 2 , context : 4 } , { name : '_nx_noop' , plural : 2 , context : 3 } , { name : '_x' , context : 2 } , { name : 'esc_attr__' } , { name : 'esc_attr_e' } , { name : 'esc_attr_x' , context : 2 } , { name : 'esc_html__' } , { name : 'esc_html_e' } , { name : 'esc_html_x' , context : 2 } ] } ; if ( options . headers === false ) { options . defaultHeaders = false ; } options = Object . assign ( { } , defaultOptions , options ) ; if ( ! options . package ) { options . package = options . domain || 'unnamed project' ; } const functionCalls = { valid : [ ] , contextPosition : { } , pluralPosition : { } } ; options . gettextFunctions . forEach ( function ( methodObject ) { functionCalls . valid . push ( methodObject . name ) ; if ( methodObject . plural ) { functionCalls . pluralPosition [ methodObject . name ] = methodObject . plural ; } if ( methodObject . context ) { functionCalls . contextPosition [ methodObject . name ] = methodObject . context ; } } ) ; options . functionCalls = functionCalls ; return options ; }
Set default options

@param {object} options

@return {object}
Set default options