MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / toNumber

Method toNumber

src/utils.ts:372–374  ·  view source on GitHub ↗

* Convert a string value to a number, handling null and empty strings. * * @param value string or null value to convert * @returns number value, or undefined for null/empty strings * * @example * Utils.toNumber('42'); // 42 * Utils.toNumber(''); // undefined * Utils.toNum

(value: null | string)

Source from the content-addressed store, hash-verified

370 * Utils.toNumber(null); // undefined
371 */
372 static toNumber(value: null | string): number {
373 return (value === null || value.length === 0) ? undefined : Number(value);
374 }
375
376 /**
377 * Parse a height value with units into numeric value and unit string.

Callers 4

constructorMethod · 0.80
getCellHeightMethod · 0.80
_readAttrMethod · 0.80
utils-spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected