Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

math-sign-x

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-sign-x

Shim for Math.sign.

  • 4.0.18
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
928
decreased by-78.56%
Maintainers
1
Weekly downloads
 
Created
Source

Travis status Dependency status devDependency status npm version

math-sign-x

Shim for Math.sign.

math-sign-x.sign2016number

This method returns the sign of a number, indicating whether the number is positive, negative or zero. (ES2016)

Kind: static property of math-sign-x
Returns: number - A number representing the sign of the given argument. If the argument is a positive number, negative number, positive zero or negative zero, the function will return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned.

ParamTypeDescription
x*A number.

Example

import {sign2016} from 'math-sign-x';

console.log(sign2016(3)); //  1
console.log(sign2016(-3)); // -1
console.log(sign2016('-3')); // -1
console.log(sign2016(0)); //  0
console.log(sign2016(-0)); // -0
console.log(sign2016(NaN)); // NaN
console.log(sign2016('foo')); // NaN
console.log(sign2016()); // NaN

math-sign-xnumber

This method returns the sign of a number, indicating whether the number is positive, negative or zero. (ES2018)

Kind: static property of math-sign-x
Returns: number - A number representing the sign of the given argument. If the argument is a positive number, negative number, positive zero or negative zero, the function will return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned.

ParamTypeDescription
x*A number.

Example

import mathSign from 'math-sign-x';

console.log(mathSign(3)); //  1
console.log(mathSign(-3)); // -1
console.log(mathSign('-3')); // -1
console.log(mathSign(0)); //  0
console.log(mathSign(-0)); // -0
console.log(mathSign(NaN)); // NaN
console.log(mathSign('foo')); // NaN
console.log(mathSign()); // NaN

Keywords

FAQs

Package last updated on 19 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc