index.js
function (porcelainStatus) {
  var PORCELAIN_PROPERTY_REGEXES = {
    // Leading non-whitespace that is not a question mark
    staged: /^[^\?\s]/,
    // Trailing non-whitespace
    unstaged: /\S$/,
    // Any "A" or "??"
    added: /A|\?\?/,
    // Any "M"
    modified: /M/,
    // Any "D"
    deleted: /D/,
    // Any "R"
    renamed: /R/
  }

  return porcelainStatus.replace(/\s+$/, '').split('\0').map(function(line) {
    var status = line.substring(0, 2)
    var properties = []
    for (var property in PORCELAIN_PROPERTY_REGEXES) {
      if (PORCELAIN_PROPERTY_REGEXES[property].test(status)) properties.push(property)
    }

    return {
      path: line.slice(3),
      properties: properties
    }
  })
}
function (porcelainStatus) {
  var PORCELAIN_PROPERTY_REGEXES = {
    // Leading non-whitespace that is not a question mark
    staged: /^[^\?\s]/,
    // Trailing non-whitespace
    unstaged: /\S$/,
    // Any "A" or "??"
    added: /A|\?\?/,
    // Any "M"
    modified: /M/,
    // Any "D"
    deleted: /D/,
    // Any "R"
    renamed: /R/
  }

  return porcelainStatus.replace(/\s+$/, '').split('\0').map(function(line) {
    var status = line.substring(0, 2)
    var properties = []
    for (var property in PORCELAIN_PROPERTY_REGEXES) {
      if (PORCELAIN_PROPERTY_REGEXES[property].test(status)) properties.push(property)
    }

    return {
      path: line.slice(3),
      properties: properties
    }
  })
}
function ( porcelainStatus ) { var PORCELAIN_PROPERTY_REGEXES = { // Leading non-whitespace that is not a question mark staged : / ^[^\?\s] / , // Trailing non-whitespace unstaged : / \S$ / , // Any "A" or "??" added : / A|\?\? / , // Any "M" modified : / M / , // Any "D" deleted : / D / , // Any "R" renamed : / R / } return porcelainStatus . replace ( / \s+$ / , '' ) . split ( '\0' ) . map ( function ( line ) { var status = line . substring ( 0 , 2 ) var properties = [ ] for ( var property in PORCELAIN_PROPERTY_REGEXES ) { if ( PORCELAIN_PROPERTY_REGEXES [ property ] . test ( status ) ) properties . push ( property ) } return { path : line . slice ( 3 ) , properties : properties } } ) }
Helper function to format git statuses
Helper function to format git statuses