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

Method toBool

src/utils.ts:350–359  ·  view source on GitHub ↗
(v: unknown)

Source from the content-addressed store, hash-verified

348 */
349 // eslint-disable-next-line @typescript-eslint/no-explicit-any
350 static toBool(v: unknown): boolean {
351 if (typeof v === 'boolean') {
352 return v;
353 }
354 if (typeof v === 'string') {
355 v = v.toLowerCase();
356 return !(v === '' || v === 'no' || v === 'false' || v === '0');
357 }
358 return Boolean(v);
359 }
360
361 /**
362 * Convert a string value to a number, handling null and empty strings.

Callers 3

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

Calls

no outgoing calls

Tested by

no test coverage detected