MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / validateNumericParam

Function validateNumericParam

Maths/Area.js:165–171  ·  view source on GitHub ↗
(param, paramName = 'param')

Source from the content-addressed store, hash-verified

163}
164
165const validateNumericParam = (param, paramName = 'param') => {
166 if (typeof param !== 'number') {
167 throw new TypeError('The ' + paramName + ' should be type Number')
168 } else if (param < 0) {
169 throw new Error('The ' + paramName + ' only accepts non-negative values')
170 }
171}
172
173export {
174 surfaceAreaCube,

Callers 10

surfaceAreaCubeFunction · 0.85
surfaceAreaSphereFunction · 0.85
areaRectangleFunction · 0.85
areaSquareFunction · 0.85
areaTriangleFunction · 0.85
areaParallelogramFunction · 0.85
areaTrapeziumFunction · 0.85
areaCircleFunction · 0.85
areaRhombusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected