Ignore:
Timestamp:
03/08/14 11:41:10 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Update node modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/node_modules/ya-csv/lib/ya-csv.js

    r484 r489  
    7373         * @return {ReadStream} the readstream instance
    7474         */
    75         self.destoy = function(){
     75        self.destroy = function(){
    7676            readStream.destroy();
    7777            return self;
     
    113113                var isEscape = false;
    114114                if (c === this.escapechar) {
    115                     var nextChar = data.charAt(i + 1);
    116                     if (this._isEscapable(nextChar)) {
    117                         this._addCharacter(nextChar);
    118                         i++;
    119                         isEscape = true;
     115                    // double-quote at the field beginning does not count as an escape string`
     116                    if (c !== this.quotechar || ps.openField || ps.quotedField) {
     117                       var nextChar = data.charAt(i + 1);
     118                       if (this._isEscapable(nextChar)) {
     119                           this._addCharacter(nextChar);
     120                           i++;
     121                           isEscape = true;
     122                        }
    120123                    }
    121124                }
     
    217220    var ps = this.parsingStatus;
    218221    if (this.columnsFromHeader && ps.rows === 0) {
    219         this.setColumnNames(ps.openRecord);
     222        // user has passed columnNames through option
     223        if (this.columnNames.length === 0)
     224          this.setColumnNames(ps.openRecord);
    220225    } else if (this.columnNames != null && this.columnNames.length > 0) {
    221226        var objResult = {};
     
    327332function _setOptions(obj, options) {
    328333    options = options || {};
    329     obj.separator   = options.separator   || ',';
    330     obj.quotechar   = options.quote       || '"';
    331     obj.escapechar  = options.escape      || '"';
    332     obj.commentchar = options.comment     || '';
    333     obj.columnNames = options.columnNames || [];
    334     obj.columnsFromHeader = options.columnsFromHeader || false;
    335     obj.nestedQuotes = options.nestedQuotes || false;
    336 };
     334    obj.separator = (typeof options.separator !== 'undefined') ? options.separator : ',';
     335    obj.quotechar = (typeof options.quote !== 'undefined') ? options.quote : '"';
     336    obj.escapechar = (typeof options.escape !== 'undefined') ? options.escape : '"';
     337    obj.commentchar = (typeof options.comment !== 'undefined') ? options.comment : '';
     338    obj.columnNames = (typeof options.columnNames !== 'undefined') ? options.columnNames : [];
     339    obj.columnsFromHeader = (typeof options.columnsFromHeader !== 'undefined') ? options.columnsFromHeader : false;
     340    obj.nestedQuotes = (typeof options.nestedQuotes !== 'undefined') ? options.nestedQuotes : false;
     341};
Note: See TracChangeset for help on using the changeset viewer.