MCPcopy
hub / github.com/mongodb/node-mongodb-native / getBoolean

Function getBoolean

src/connection_string.ts:176–186  ·  view source on GitHub ↗
(name: string, value: unknown)

Source from the content-addressed store, hash-verified

174 check('tlsInsecure', 'tlsAllowInvalidHostnames');
175}
176function getBoolean(name: string, value: unknown): boolean {
177 if (typeof value === 'boolean') return value;
178 switch (value) {
179 case 'true':
180 return true;
181 case 'false':
182 return false;
183 default:
184 throw new MongoParseError(`${name} must be either "true" or "false"`);
185 }
186}
187
188function getIntFromOptions(name: string, value: unknown): number {
189 const parsedInt = parseInteger(value);

Callers 2

setOptionFunction · 0.85
transformFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected