apache-arrow
Version:
Apache Arrow columnar in-memory format
23 lines (22 loc) • 700 B
TypeScript
import { DataType } from '../type.js';
/**
* Dynamically compile the null values into an `isValid()` function whose
* implementation is a switch statement. Microbenchmarks in v8 indicate
* this approach is 25% faster than using an ES6 Map.
*
* @example
* console.log(createIsValidFunction([null, 'N/A', NaN]));
* `function (x) {
* if (x !== x) return false;
* switch (x) {
* case null:
* case "N/A":
* return false;
* }
* return true;
* }`
*
* @ignore
* @param nullValues
*/
export declare function createIsValidFunction<T extends DataType = any, TNull = any>(nullValues?: ReadonlyArray<TNull>): (value: T['TValue'] | TNull) => boolean;