summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/math/hexdec.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/math/hexdec.js')
-rw-r--r--node_modules/locutus/php/math/hexdec.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/node_modules/locutus/php/math/hexdec.js b/node_modules/locutus/php/math/hexdec.js
new file mode 100644
index 0000000..50026ac
--- /dev/null
+++ b/node_modules/locutus/php/math/hexdec.js
@@ -0,0 +1,14 @@
+'use strict';
+
+module.exports = function hexdec(hexString) {
+ // discuss at: http://locutus.io/php/hexdec/
+ // original by: Philippe Baumann
+ // example 1: hexdec('that')
+ // returns 1: 10
+ // example 2: hexdec('a0')
+ // returns 2: 160
+
+ hexString = (hexString + '').replace(/[^a-f0-9]/gi, '');
+ return parseInt(hexString, 16);
+};
+//# sourceMappingURL=hexdec.js.map \ No newline at end of file