Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
Untitled
a guest
Feb 19th, 2018
69
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
text
0.18 KB
| None
|
0
0
raw
download
clone
embed
print
report
//snaps to a number by granularity
module.exports = function(num, granularity = 1){
if(granularity === 0){
return num;
}
return Math.round(num/granularity)*granularity;
}
Add Comment
Please,
Sign In
to add comment
Public Pastes
🤑 G2A.com Free Gift Card Guide May 2024 FIX 💰
GetText | 16 min ago | 0.38 KB
🤑 G2A.com Free Gift Card Guide May 2024 FIX 🤑
GetText | 19 min ago | 0.39 KB
Untitled
C# | 23 min ago | 0.42 KB
Untitled
C# | 30 min ago | 0.57 KB
"Servo Control" rev_04
Arduino | 32 min ago | 2.91 KB
Control Servos rev_03
Arduino | 35 min ago | 2.91 KB
Untitled
C# | 38 min ago | 0.61 KB
Untitled
C# | 1 hour ago | 0.74 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!