demo___customer_pitch-c4152739-a50b-4b5b-9d4d-0561461666d9.zip-extract/_dependencies/npm/lodash-4.17.20/_createRound.js

Path
demo___customer_pitch-c4152739-a50b-4b5b-9d4d-0561461666d9.zip-extract/_dependencies/npm/lodash-4.17.20/_createRound.js
Status
scanned
Type
file
Name
_createRound.js
Extension
.js
Programming language
JavaScript
Mime type
text/plain
File type
ASCII text
Tag

      
    
Rootfs path

      
    
Size
1193 (1.2 KB)
MD5
5355f2a83b38ab9c5b2e19d53dd3fd36
SHA1
f4640823857ab5cc4a35b87df0b475c215e8147a
SHA256
09b84d1712b210ec6408eebb5d2f3a72f728c5e9ce7c9f86f621ad81a5d02bd1
SHA512

      
    
SHA1_git
88be5df396b61c2911732fea60d865cccf994b7a
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
_createRound.js | 1.2 KB |

var root = require('./_root'), toInteger = require('./toInteger'), toNumber = require('./toNumber'), toString = require('./toString'); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsFinite = root.isFinite, nativeMin = Math.min; /** * Creates a function like `_.round`. * * @private * @param {string} methodName The name of the `Math` method to use when rounding. * @returns {Function} Returns the new round function. */ function createRound(methodName) { var func = Math[methodName]; return function(number, precision) { number = toNumber(number); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); if (precision && nativeIsFinite(number)) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. var pair = (toString(number) + 'e').split('e'), value = func(pair[0] + 'e' + (+pair[1] + precision)); pair = (toString(value) + 'e').split('e'); return +(pair[0] + 'e' + (+pair[1] - precision)); } return func(number); }; } module.exports = createRound;
URL Start line End line
https://mdn.io/round#Examples 24 24
Package URL License Primary language
pkg:npm/acme-demo-app@1.0.0 JavaScript
pkg:npm/lodash@4.17.20 mit JavaScript