lib/model.js
function createModifierFunction (modifier) {
  return function (obj, field, value) {
    var fieldParts = typeof field === 'string' ? field.split('.') : field;

    if (fieldParts.length === 1) {
      lastStepModifierFunctions[modifier](obj, field, value);
    } else {
      if (obj[fieldParts[0]] === undefined) {
        if (modifier === '$unset') { return; }   // Bad looking specific fix, needs to be generalized modifiers that behave like $unset are implemented
        obj[fieldParts[0]] = {};
      }
      modifierFunctions[modifier](obj[fieldParts[0]], fieldParts.slice(1), value);
    }
  };
}
function createModifierFunction (modifier) {
  return function (obj, field, value) {
    var fieldParts = typeof field === 'string' ? field.split('.') : field;

    if (fieldParts.length === 1) {
      lastStepModifierFunctions[modifier](obj, field, value);
    } else {
      if (obj[fieldParts[0]] === undefined) {
        if (modifier === '$unset') { return; }   // Bad looking specific fix, needs to be generalized modifiers that behave like $unset are implemented
        obj[fieldParts[0]] = {};
      }
      modifierFunctions[modifier](obj[fieldParts[0]], fieldParts.slice(1), value);
    }
  };
}
function createModifierFunction ( modifier ) { return function ( obj , field , value ) { var fieldParts = typeof field === 'string' ? field . split ( '.' ) : field ; if ( fieldParts . length === 1 ) { lastStepModifierFunctions [ modifier ] ( obj , field , value ) ; } else { if ( obj [ fieldParts [ 0 ] ] === undefined ) { if ( modifier === '$unset' ) { return ; } // Bad looking specific fix, needs to be generalized modifiers that behave like $unset are implemented obj [ fieldParts [ 0 ] ] = { } ; } modifierFunctions [ modifier ] ( obj [ fieldParts [ 0 ] ] , fieldParts . slice ( 1 ) , value ) ; } } ; }
Given its name, create the complete modifier function
Given its name create the complete modifier function