{"size": 466, "ext": "js", "max_stars_repo_path": "src/prefix-hex.js", "max_stars_repo_name": "volut/speedomatic", "max_stars_repo_stars_event_min_datetime": "2017-09-17T19:11:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-22T07:06:52.000Z", "max_issues_repo_path": "src/prefix-hex.js", "max_issues_repo_name": "volut/speedomatic", "max_issues_repo_issues_event_min_datetime": "2018-03-08T01:13:28.000Z", "max_issues_repo_issues_event_max_datetime": "2018-03-08T01:13:28.000Z", "max_forks_repo_path": "src/prefix-hex.js", "max_forks_repo_name": "volut/speedomatic", "max_forks_repo_forks_event_min_datetime": "2017-12-01T07:16:13.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T07:06:45.000Z"}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": 6, "avg_line_length": 22.1904761905, "max_line_length": 86, "alphanum_fraction": 0.4978540773}
"use strict";

var BigNumber = require("bignumber.js");

function prefixHex(n) {
  if (n === undefined || n === null || n === "") return n;
  if (n.constructor === Number || BigNumber.isBigNumber(n)) {
    n = n.toString(16);
  }
  if (n.constructor === String && n.slice(0, 2) !== "0x" && n.slice(0, 3) !== "-0x") {
    if (n.slice(0, 1) === "-") {
      n = "-0x" + n.slice(1);
    } else {
      n = "0x" + n;
    }
  }
  return n;
}

module.exports = prefixHex;
