jsdataframe.js
function packVector(vector, includeMetadata) {
  includeMetadata = isUndefined(includeMetadata) ? true : includeMetadata;
  var dtype = vector.dtype;
  if (vector.dtype === 'date') {
    vector = vector.toDtype('number');
  }
  var values = (vector.dtype !== 'number') ?
    vector.values.slice() :
    vector.values.map(function(x) {
      return Number.isNaN(x) ? null : x;
    });

  var result = {dtype: dtype, values: values};
  if (includeMetadata) {
    result.version = jd.version;
    result.type = vectorProto.type;
  }
  return result;
}
function packVector(vector, includeMetadata) {
  includeMetadata = isUndefined(includeMetadata) ? true : includeMetadata;
  var dtype = vector.dtype;
  if (vector.dtype === 'date') {
    vector = vector.toDtype('number');
  }
  var values = (vector.dtype !== 'number') ?
    vector.values.slice() :
    vector.values.map(function(x) {
      return Number.isNaN(x) ? null : x;
    });

  var result = {dtype: dtype, values: values};
  if (includeMetadata) {
    result.version = jd.version;
    result.type = vectorProto.type;
  }
  return result;
}
function packVector ( vector , includeMetadata ) { includeMetadata = isUndefined ( includeMetadata ) ? true : includeMetadata ; var dtype = vector . dtype ; if ( vector . dtype === 'date' ) { vector = vector . toDtype ( 'number' ) ; } var values = ( vector . dtype !== 'number' ) ? vector . values . slice ( ) : vector . values . map ( function ( x ) { return Number . isNaN ( x ) ? null : x ; } ) ; var result = { dtype : dtype , values : values } ; if ( includeMetadata ) { result . version = jd . version ; result . type = vectorProto . type ; } return result ; }
Helper for packing the given vector, including metadata by default
Helper for packing the given vector including metadata by default