Docs: adding API reference documentation support for the packages libraries. (#21931)

* trying out api-extractor.

* works with our setup of build.

* wip.

* changed the packages so it works better with the api-extractor.

* Changes to make the api-extractor to work.

* cleaned up the api-extractor config files.

* added some more documentation.

* added tsdoc-metadata to gitignore.

* removed the generated docs (will do that in another PR).

* added execute permission to script for generating dosc.

* added so we will push generated docs to branch.

* will clean packages_api on abort.

* Fixed failing tests.

* fixed formatting issue with typedoc comment.

* temporarily disabled tslint rules about namespace until https://github.com/microsoft/rushstack/issues/1029 is resolved

* temporary enabled bable namespaces.

* updated build script.

* updated script.

* updated script with some colors.

* changed to camelCase.

* removed spacing.

* Starting to add documentation guidelines.

* added examples headline.

* added parameters and return values.

* Fixed merge error.

* changed so we use the eslint ignore syntax.

* changed to correct eslint ingnore comment.

* fixed some spelling errors reported by codespell.

* added script to generate docs in current folder.

* lerna bootstrap.

* removed file that should be ignored.

* updated locKFILE.

* referenced the code comments guidelines.

* updated packages.

* updated deps.
This commit is contained in:
Marcus Andersson
2020-02-25 13:59:11 +01:00
committed by GitHub
parent 002d2119fd
commit e2038e0614
39 changed files with 910 additions and 400 deletions
@@ -6,20 +6,12 @@ import { DisplayProcessor } from '../types';
* This abstraction will present the contents of a DataFrame as if
* it were a well typed javascript object Vector.
*
* NOTE: The contents of the object returned from `view.get(index)`
* are optimized for use in a loop. All calls return the same object
* but the index has changed.
* @remarks
* The {@link DataFrameView.get} is optimized for use in a loop and will return same object.
* See function for more details.
*
* For example, the three objects:
* const first = view.get(0);
* const second = view.get(1);
* const third = view.get(2);
* will point to the contents at index 2
*
* If you need three different objects, consider something like:
* const first = { ... view.get(0) };
* const second = { ... view.get(1) };
* const third = { ... view.get(2) };
* @typeParam T - Type of object stored in the DataFrame.
* @beta
*/
export class DataFrameView<T = any> implements Vector<T> {
private index = 0;
@@ -56,6 +48,10 @@ export class DataFrameView<T = any> implements Vector<T> {
return this.data.length;
}
/**
* Helper function to return the {@link DisplayProcessor} for a given field column.
* @param colIndex - the field column index for the data frame.
*/
getFieldDisplayProcessor(colIndex: number): DisplayProcessor | null {
if (!this.dataFrame || !this.dataFrame.fields) {
return null;
@@ -70,6 +66,25 @@ export class DataFrameView<T = any> implements Vector<T> {
return field.display;
}
/**
* The contents of the object returned from this function
* are optimized for use in a loop. All calls return the same object
* but the index has changed.
*
* @example
* ```typescript
* // `first`, `second` and `third` will all point to the same contents at index 2:
* const first = view.get(0);
* const second = view.get(1);
* const third = view.get(2);
*
* // If you need three different objects, consider something like:
* const first = { ...view.get(0) };
* const second = { ...view.get(1) };
* const third = { ...view.get(2) };
* ```
* @param idx - The index of the object you currently are inspecting
*/
get(idx: number) {
this.index = idx;
return this.obj;