jsos

college code for operating system fundamentals in js

git clone https://9o.is/git/jsos.git

commit 013fe1ff6ed79bac502da8fe0a2129e9c67313c7
parent 7338721a5608021e9f694ca7bb673c054e7a2cb4
Author: Jul <jul@9o.is>
Date:   Sun, 25 Nov 2012 20:08:56 -0500

Added isString helper function. Mod a couple other helper functions.

Diffstat:
Mscripts/utils.js | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/utils.js b/scripts/utils.js @@ -52,6 +52,7 @@ function isValidHex(str) { * result will be '00a8'. */ function pad(hex, size) { + hex = hex.toString(); while(hex.length < size) hex = '0'+hex; return hex; @@ -62,7 +63,14 @@ function pad(hex, size) { * of 0 to 255. */ function isByte(value) { - return value > -1 && value < 256; + return isInt(value) && value > -1 && value < 256; +} + +/* + * Checks if input is a string type. + */ +function isString(input){ + return typeof(input)=='string'; } /*