Deprecated as this is now natively available in all modern browsers and Node.js versions.
ES2015
Math.sign()
ponyfill
$ npm install --save math-sign
var mathSign = require('math-sign');
mathSign(5);
//=> 1
mathSign(-2);
//=> -1
MIT © Sindre Sorhus