Vector: remove toJSON() from interface (#19254)

This commit is contained in:
Ryan McKinley 2019-09-20 08:22:33 -07:00 committed by GitHub
parent 19f3ec4891
commit 6787e7b5ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 11 deletions

View File

@ -82,7 +82,7 @@ describe('FieldCache', () => {
it('should get the first field with a duplicate name', () => { it('should get the first field with a duplicate name', () => {
const field = ext.getFieldByName('value'); const field = ext.getFieldByName('value');
expect(field!.name).toEqual('value'); expect(field!.name).toEqual('value');
expect(field!.values.toJSON()).toEqual([1, 2, 3]); expect(field!.values.toArray()).toEqual([1, 2, 3]);
}); });
it('should return index of the field', () => { it('should return index of the field', () => {

View File

@ -189,14 +189,14 @@ describe('sorted DataFrame', () => {
it('Should sort numbers', () => { it('Should sort numbers', () => {
const sorted = sortDataFrame(frame, 0, true); const sorted = sortDataFrame(frame, 0, true);
expect(sorted.length).toEqual(3); expect(sorted.length).toEqual(3);
expect(sorted.fields[0].values.toJSON()).toEqual([3, 2, 1]); expect(sorted.fields[0].values.toArray()).toEqual([3, 2, 1]);
expect(sorted.fields[1].values.toJSON()).toEqual(['c', 'b', 'a']); expect(sorted.fields[1].values.toArray()).toEqual(['c', 'b', 'a']);
}); });
it('Should sort strings', () => { it('Should sort strings', () => {
const sorted = sortDataFrame(frame, 1, true); const sorted = sortDataFrame(frame, 1, true);
expect(sorted.length).toEqual(3); expect(sorted.length).toEqual(3);
expect(sorted.fields[0].values.toJSON()).toEqual([3, 2, 1]); expect(sorted.fields[0].values.toArray()).toEqual([3, 2, 1]);
expect(sorted.fields[1].values.toJSON()).toEqual(['c', 'b', 'a']); expect(sorted.fields[1].values.toArray()).toEqual(['c', 'b', 'a']);
}); });
}); });

View File

@ -401,7 +401,7 @@ export function toDataFrameDTO(data: DataFrame): DataFrameDTO {
name: f.name, name: f.name,
type: f.type, type: f.type,
config: f.config, config: f.config,
values: f.values.toJSON(), values: f.values.toArray(),
}; };
}); });

View File

@ -12,3 +12,4 @@ export * from './displayValue';
export * from './graph'; export * from './graph';
export * from './ScopedVars'; export * from './ScopedVars';
export * from './transformations'; export * from './transformations';
export * from './vector';

View File

@ -10,11 +10,6 @@ export interface Vector<T = any> {
* Get the resutls as an array. * Get the resutls as an array.
*/ */
toArray(): T[]; toArray(): T[];
/**
* Return the values as a simple array for json serialization
*/
toJSON(): any; // same results as toArray()
} }
/** /**