/* * Get the count of follows a user has * * @param {object} state Global state tree * @returns {Integer} Follow count */ const getReaderFollowsCount = ( state ) => Math.max( state.reader.follows.itemsCount, size( filter( state.reader.follows.items, { is_following: true } ) ) )
keyedReducer( 'seed', withoutPersistence( ( state = null, action ) => { switch ( action.type ) { case READER_RECOMMENDED_SITES_RECEIVE: return Math.max( action.payload.offset, state ); } return state; } ) )
describe('max', () => { test('should find max in object', () => { const obj = { a: 1, b: 5, c: 10, d: 0 }; expect(max(obj)).toBe(10); }); });
// q is assumed to be normalized // clamp, to handle numerical problems function clamp( x ) { return Math.min( Math.max( x, -1 ), 1 ); }
function() { var v1 = new THREE.Vector3(); return function ( center, size ) { var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); this.min.copy( center ).sub( halfSize ); this.max.copy( center ).add( halfSize ); return this; }; }()
yup .number() .integer() .when('maxLength', (maxLength, schema) => { if (maxLength) { return schema.max(maxLength, getTrad('error.validation.minSupMax')); } return schema; }) .nullable()
$export($export.S, 'Math', { clamp: function clamp(x, lower, upper) { return Math.min(upper, Math.max(lower, x)); } });
function () { var v1 = new THREE.Vector2(); return function ( point ) { var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); return clampedPoint.sub( point ).length(); }; }()
/** * Adds max float/decimal validator * @param {Object} attribute model attribute * @param {Object} validator yup validator */ const addMaxFloatValidator = ({ max }, validator) => _.isNumber(max) ? validator.max(max) : validator
function() { var v1 = new THREE.Vector3(); return function ( point ) { var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); return clampedPoint.sub( point ).length(); }; }()
function () { var v1 = new THREE.Vector2(); return function ( center, size ) { var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); this.min.copy( center ).sub( halfSize ); this.max.copy( center ).add( halfSize ); return this; }; }()
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) // clamp, to handle numerical problems function clamp( x ) { return Math.min( Math.max( x, -1 ), 1 ); }
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) // clamp, to handle numerical problems function clamp( x ) { return Math.min( Math.max( x, -1 ), 1 ); }
function() { var v1 = new THREE.Vector3(); return function ( center, size ) { var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); this.min.copy( center ).sub( halfSize ); this.max.copy( center ).add( halfSize ); return this; }; }()