lib/index.js
/*
	* params: options.obj, options.currentLocation

	* options.obj: obj is object you are flattening. When calling this function, you only need to provide obj as an argument. 
	* options.loc: Only used when the function recurses for maintaining the current path.

	* Remodels dates from strings that are modeled with isDate: true in orderIndependentCollections

  * Returns an array or object whose stringified dates have been converted back to real dates
	*/


Remodels dates from strings that are modeled with isDate: true in orderIndependentCollections

Returns an array or object whose stringified dates have been converted back to real dates
Remodels dates from strings that are modeled with isDate : true in orderIndependentCollections Returns an array or object whose stringified dates have been converted back to real dates
remodelDates(options) {
		var obj = options.obj
		var currentLocation = options.currentLocation
		var collectionOptions = this.options.orderIndependentCollections[currentLocation]
		if (Array.isArray(obj)) {
	    obj = obj.map(o => {
	      return this.remodelDates({
	      	obj: o, 
	      	currentLocation: currentLocation
	      })
	    })
		} else if (typeof obj === 'object' && obj !== null) {
		  Object.keys(obj).forEach(k => {
		    obj[k] = this.remodelDates({
		    	obj: obj[k], 
		    	currentLocation: `${currentLocation ? currentLocation + '.' : ''}${k}`})
		  })
		} else if ( collectionOptions && collectionOptions.isDate ) {
			if( Date.parse((obj)) ){
				obj = moment(obj).toDate()
			} else {
				console.log(`"${obj}" is not a valid date, and cannot be parsed.`)
			}
    } 
		return obj
	}
remodelDates ( options ) { var obj = options . obj var currentLocation = options . currentLocation var collectionOptions = this . options . orderIndependentCollections [ currentLocation ] if ( Array . isArray ( obj ) ) { obj = obj . map ( o => { return this . remodelDates ( { obj : o , currentLocation : currentLocation } ) } ) } else if ( typeof obj === 'object' && obj !== null ) { Object . keys ( obj ) . forEach ( k => { obj [ k ] = this . remodelDates ( { obj : obj [ k ] , currentLocation : ` ${ currentLocation ? currentLocation + '.' : '' } ${ k } ` } ) } ) } else if ( collectionOptions && collectionOptions . isDate ) { if ( Date . parse ( ( obj ) ) ) { obj = moment ( obj ) . toDate ( ) } else { console . log ( ` ${ obj } ` ) } } return obj }
params: options.obj, options.currentLocation
 options.obj: obj is object you are flattening.
params : options . obj options . currentLocation options . obj : obj is object you are flattening .