infamous
Version:
A CSS3D/WebGL UI library.
13 lines (11 loc) • 403 B
JavaScript
import XYZNumberValues from './XYZNumberValues'
import Class from 'lowclass'
export default
Class( 'XYZNonNegativeValues' ).extends( XYZNumberValues, ({ Super }) => ({
checkValue(prop, value) {
if (!Super(this).checkValue(prop, value)) return false
if (value < 0)
throw new Error(`Expected ${prop} not to be negative. Received: ${value}`)
return true
},
}))