redis-json
Advanced tools
Comparing version 6.0.2 to 6.0.3
@@ -56,3 +56,3 @@ import { promisify } from 'util'; | ||
const numKey = Number(key); | ||
return isNaN(numKey) ? decodeKey(key) : numKey; | ||
return isNaN(numKey) || isHex(key) ? decodeKey(key) : numKey; | ||
} | ||
@@ -90,2 +90,10 @@ /** | ||
})(); | ||
/** | ||
* Checks the key is hex string or not. | ||
* | ||
* @param key | ||
*/ | ||
function isHex(key) { | ||
return key ? Boolean(key.match(/^0x[0-9a-f]+$/i)) : false; | ||
} | ||
@@ -92,0 +100,0 @@ var TYPE; |
@@ -58,3 +58,3 @@ 'use strict'; | ||
const numKey = Number(key); | ||
return isNaN(numKey) ? decodeKey(key) : numKey; | ||
return isNaN(numKey) || isHex(key) ? decodeKey(key) : numKey; | ||
} | ||
@@ -92,2 +92,10 @@ /** | ||
})(); | ||
/** | ||
* Checks the key is hex string or not. | ||
* | ||
* @param key | ||
*/ | ||
function isHex(key) { | ||
return key ? Boolean(key.match(/^0x[0-9a-f]+$/i)) : false; | ||
} | ||
@@ -94,0 +102,0 @@ var TYPE; |
{ | ||
"name": "redis-json", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"description": "A wrapper library to store JSON Objects in redis-hashsets and retrieve it back as JSON objects", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
81763
1657