function objectWriteUInt16( buf, value, offset, littleEndian ) { if ( value < 0 ) value = 0xffff + value + 1; for ( var i = 0, j = Math.min( buf.length - offset, 2 ); i < j; i++ ) { buf[ offset + i ] = ( value & ( 0xff << ( 8 * ( littleEndian ? i : 1 - i ) ) ) ) >>> ( ( littleEndian ? i : 1 - i ) * 8 ); } }
onLoadIFrame() { let iframe = document.getElementById(this.id); let doc = iframe.contentDocument; doc.body = this.props.body; let styles = window.getComputedStyle(doc.body); let height = parseInt(styles.height) + parseInt(styles.marginTop) + parseInt(styles.marginBottom); // fix max height iframe.height = Math.min(height, ReplConstants.IFRAME_MAX_HEIGHT) + 'px'; doc.body.style.color = (document.body.className.indexOf('dark-theme') !== -1 ? 'whitesmoke' : 'darkslategrey'); }
const getCpuInfo = () => { const cpus = os.cpus(); const load = os.loadavg(); const cpu = { load1: load[0], load5: load[1], load15: load[2], cores: Array.isArray(cpus) ? os.cpus().length : null, }; cpu.utilization = Math.min(Math.floor(load[0] * 100 / cpu.cores), 100); return cpu; }
$export($export.P + $export.F * _dereq_(34)(ENDS_WITH), 'String', { endsWith: function endsWith(searchString /* , endPosition = @length */) { var that = context(this, searchString, ENDS_WITH); var endPosition = arguments.length > 1 ? arguments[1] : undefined; var len = toLength(that.length); var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len); var search = String(searchString); return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; } });
const buildMaintenanceItems = async statusPageURL => { const maintenances = await new MaintenancesStore().query() maintenances.sort(latestCreatedAtToOldest) const items = [] for (let i = 0; i < Math.min(maintenances.length, maxItems); i++) { items.push(await buildItem(maintenances[i], new MaintenanceUpdatesStore(), statusPageURL)) } return items }
$export($export.S, 'Math', { clamp: function clamp(x, lower, upper) { return Math.min(upper, Math.max(lower, x)); } });
get limit() { let { state, options, choices } = this; let limit = state.limit || this._limit || options.limit || choices.length; return Math.min(limit, this.height); }
const isSafeName = (name, scopes, ecmaVersion, isStrict) => { ecmaVersion = Math.min(6, ecmaVersion); // 6 is the latest version understood by `reservedWords` return ( !someScopeHasVariableName(name, scopes) && !reservedWords.check(name, ecmaVersion, isStrict) && !nameCollidesWithArgumentsSpecial(name, scopes, isStrict) && !isUnresolvedName(name, scopes) ); }
getAlignedTexts(str, space) { const len = str.length; let left; if (len <= space) left = str + r(" ", space - len); else { left = str.slice(0, Math.max(space - 3, 0)); left += r(".", Math.min(3, space)); } return left; }
// q is assumed to be normalized // clamp, to handle numerical problems function clamp( x ) { return Math.min( Math.max( x, -1 ), 1 ); }
getBestAffix(word) { const maxLength = Math.min(word.length - 1, this.affixMaxLength); for (let i = maxLength; i > 0; i -= 1) { const current = word.slice(-i); if (this.affixes[current]) { return current; } } return undefined; }
function latin1Slice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret }
function objectWriteUInt32( buf, value, offset, littleEndian ) { if ( value < 0 ) value = 0xffffffff + value + 1; for ( var i = 0, j = Math.min( buf.length - offset, 4 ); i < j; i++ ) { buf[ offset + i ] = ( value >>> ( ( littleEndian ? i : 3 - i ) * 8 ) ) & 0xff; } }
// 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 ); }