MCPcopy
hub / github.com/tinyplex/tinybase / getCellOrValueType

Function getCellOrValueType

src/common/cell.ts:37–54  ·  view source on GitHub ↗
(
  cellOrValue: any,
)

Source from the content-addressed store, hash-verified

35 'string' | 'number' | 'boolean' | 'null' | 'object' | 'array';
36
37export const getCellOrValueType = (
38 cellOrValue: any,
39): CellOrValueType | undefined => {
40 if (isNull(cellOrValue)) {
41 return NULL;
42 }
43 if (isArray(cellOrValue)) {
44 return ARRAY;
45 }
46 if (isObject(cellOrValue)) {
47 return OBJECT;
48 }
49 const type = getTypeOf(cellOrValue);
50 return isTypeStringOrBoolean(type) ||
51 (type == NUMBER && isFiniteNumber(cellOrValue as any))
52 ? (type as CellOrValueType)
53 : undefined;
54};
55
56export const isCellOrValueOrUndefined = (cellOrValue: any): boolean =>
57 isUndefined(cellOrValue) || !isUndefined(getCellOrValueType(cellOrValue));

Callers 7

writeGroupRowFunction · 0.90
getValidatedCellFunction · 0.90
getValidatedValueFunction · 0.90
EditableThingFunction · 0.90
EditableThingFunction · 0.90
isCellOrValueOrUndefinedFunction · 0.70

Calls 5

isNullFunction · 0.90
isArrayFunction · 0.90
isObjectFunction · 0.90
getTypeOfFunction · 0.90
isTypeStringOrBooleanFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…