Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NameSummary
isFChecks if argument is a function.
isAChecks if argument is an array.
isS

Checks if argument is a string.

isOChecks if argument is an object.
containsChecks if an array contains a value.
areFunctionsChecks if given strings are names of functions on an API and whether the API has functions that are not listed.
areFunctionsNonStrictChecks if given strings are names of functions on an API. (Doesn't care about unlisted functions.)
windowSizeReturns inner dimensions of the window minus given values.
isMobileReturns true if the device viewing the GUI is a mobile device.
isChromeReturns true if the browser being used is Chrome.
isSafariReturns true if the browser being used is Safari.
isFirefoxReturns true if the browser being used is Firefox.
debugOnReturns true if the debug flag is turned on in query params.
debugConditionally writes a debug message to the console.
findSearches through an array of objects looking for the object with a specific property name and property value and returns its index.
inArrayFinds an item's index in the array.
removeFromArrayRemoves the first occurrence of the specified item from the array.
isEmptyObjectReturns true if the object is empty (has no non-default properties).
capReturns the given string with only the first letter capitalized.
noPxReturn the argument without the 'px' suffix.
noPxStyle

Return the element's style property without the 'px' suffix.

endsWithChecks if the given string ends with a given suffix.
parseBitRateReturns a Number version of the given string bit rate.

...

Example UsageArgumentsReturn Values
fs.isF(f);f - the variable to check if it is a function

f if typeof is 'function'

null if f is not a function

...

Example UsageArgumentsReturn Values
fs.isA(a);a - the variable to check if it is an array

a if isArray (ECMA5) returns true

null if a is not an array

...

Example UsageArgumentsReturn Values
fs.isS(s);s - the variable to check if it is a string

 s if typeof is 'string'

null if s is not a string

...

Example UsageArgumentsReturn Values
fs.isO(o);o - the variable to check if it is an object

o if typeof is 'object' and the constructor is Object

null if o is not an object

...

Example UsageArgumentsReturn Values
fs.contains(ax);

a - the array to search

x - the item to look for

the index of x if it is in a (the index may be 0 – not truthy!)

false if a isn't an array

-1 if x isn't in the array

...

Example UsageArgumentsReturn Values
fs.areFunctions(api, fnNames);

api: the factory API object to check

fnNames: an array of strings of function names that should be on the API

true if

  • fnNames given are names of functions on api 
  • api only contains the functions in fnNames

false if

  • fnNames isn't an array
  • if there are names in fnNames that api doesn't have
  • api has functions not accounted for in fnNames

 

...

Example UsageArgumentsReturn Values
fs.areFunctionsNonStrict(api, fnNames);

api: the factory API object to check

fnNames: an array of strings of function names that should be on the API

true if

  • fnNames given are names of functions on api 

false if

  • fnNames isn't an array
  • if there are names in fnNames that api doesn't have

...

Example UsageArgumentsDefault ParamsReturn Value
fs.windowSize(offH, offW);

offH - number value to be subtracted from the browser window height

offW - number value to be subtracted from the browser window width

offH: 0 (if offH is falsy)

offV: 0 (if offW is falsy)

an object with members:

  • height: window inner height minus offH (if given)
  • width: window inner width minus offW (if given)

...

Example UsageArgumentsReturn Values
fs.isMobile();none

true if the device viewing the GUI is a mobile device

false otherwise

...

Example UsageArgumentsReturn Values
fs.isChrome();none

true if the user is viewing the GUI in Google Chrome

false otherwise

...

Example UsageArgumentsReturn Values
fs.isSafari();none

true if the user is viewing the GUI in Safari

false otherwise

...

Example UsageArgumentsReturn Values
fs.isFirefox();none

true if the user is viewing the GUI in Mozilla Firefox

false otherwise

...

Example UsageArgumentsReturn Values
fs.debugOn(tag);tag: string of which debug flag you are looking for

true if debug flag is turned on for tag

undefined otherwise

debug

Conditionally logs a debug message to the console. This function checks to see if the given tag is in the set of active debug flags, via a call to debugOn(). If the flag is active, the remaining arguments are passed to $log.debug() to write a debug message to the console. If the flag is not active, nothing is logged.

Example UsageArgumentsReturn Values
fs.debug(tag, arg1, arg2, ...);

tag: debug flag to test for

arg1, arg2, ... : arguments passed to $log.debug()

none

 

find

Searches through an array of objects looking for the object with a specific property name (tag) and property value (key) and returns its index.

Example UsageArgumentsDefault ParamsReturn Values
fs.find(key, array, tag);

key: property value you are searching for

array: array of objects to search through

tag: property name you are searching for

tag: 'id'

the index of the object in the array, if found (the index may be 0 – not truthy!)

-1 if it wasn't found

...

Example UsageArgumentsReturn Values
fs.inArray(item, array);

item: the item to search for in the array

array: the array to search

the index of the item in the array, if found (the index may be 0 – not truthy!)

-1 if it wasn't found

...

Example UsageArgumentsReturn Values
fs.removeFromArray(item, array);

item: the item to remove from the array

array: the array to remove from

true if the removal was made

false otherwise

...

Example UsageArgumentsReturn Values
fs.isEmptyObject(obj);obj: the object to check to see if it is empty

true if it is empty

false otherwise

...

Example UsageArgumentsReturn Value
fs.cap(s);s: the string to properly capitalizes properly capitalized

...

Example UsageArgumentsReturn Values
fs.noPx(num);num: string number with a 'px' you want to be turned into a number valuethe number from the pixel string

...

Example UsageArgumentsReturn Values
 fs.noPxStyle(elem, prop);

 elem: the d3 selection of an element

prop: the style property you want the number of

the number value of the style property

...

Example UsageArgumentsReturn Values
fs.endsWith(str, suffix);

str: the string you want to check

suffix: the suffix you want to look for

true if the str ends with suffix

false otherwise

...

Example UsageArgumentsReturn Values
fs.parseBitRate(str);str: the string that you want the bit rate fromthe number value of the bit rate

...