Namespace: Macros

Macros

Author:
  • jgjake2

Members

staticMacros.ARGUMENTS

1 Overload Get the arguments of a function, slicing with the given number "a" to optional argument "b"
Properties:
Name Type Description
ARGUMENTS boolean 1 Argument(s) Slice.call(arguments,a)
ARGUMENTS boolean 2 Argument(s) Slice.call(arguments,a,b)
Example
ARGUMENTS(1) //result: Slice.call(arguments,1)
ARGUMENTS(1,3) //result: Slice.call(arguments,1,3)

staticMacros.EXISTS

0 Overloads Check if variable exists in the current scope
Properties:
Name Type Description
EXISTS boolean 1 Argument(s) _undefined!=typeof a
Example
EXISTS(obj) //result: _undefined!=typeof obj

staticMacros.HASPROP

3 Overload Check if object a has all the given properties using the in operator
Properties:
Name Type Description
HASPROP boolean 1 Argument b in a
HASPROP boolean 2 Arguments b in a&&c in a
HASPROP boolean 3 Arguments b in a&&c in a&&d in a
HASPROP boolean 4 Arguments b in a&&c in a&&d in a&&e in a
Example
HASPROP(obj,"foo") //result: "foo" in obj
HASPROP(obj,"foo","bar") //result: "foo" in obj&&"bar" in obj
HASPROP(obj,"foo","bar","taco") //result: "foo" in obj&&"bar" in obj&&"taco" in obj
HASPROP(obj,"foo","bar","taco","bell") //result: "foo" in obj&&"bar" in obj&&"taco" in obj&&"bell" in obj

staticMacros.HASPROPTREE

2 Overload Check if object a has property b, and a[b] has property c, etc... using in
Properties:
Name Type Description
HASPROPTREE boolean 2 Arguments b in a&&c in a[b]
HASPROPTREE boolean 3 Arguments b in a&&c in a[b]&&d in a[b][c]
HASPROPTREE boolean 4 Arguments b in a&&c in a[b]&&d in a[b][c]&&e in a[b][c][d]
Example
HASPROPTREE(obj,"foo","bar") //result: "foo" in obj&&"bar" in obj["foo"]
HASPROPTREE(obj,"foo","bar","taco") //result: "foo" in obj&&"bar" in obj["foo"]&&"taco" in obj["foo"]["bar"]
HASPROPTREE(obj,"foo","bar","taco","bell") //result: "foo" in obj&&"bar" in obj["foo"]&&"taco" in obj["foo"]["bar"]&&"bell" in obj["foo"]["bar"]["taco"]

staticMacros.IFEXISTS

0 Overloads If variable exists, produce b, otherwise produce c
Properties:
Name Type Description
IFEXISTS boolean 1 Argument(s) _undefined!=typeof a?b:c
Example
IFEXISTS(obj,true,false) //result: _undefined!=typeof obj?true:false

staticMacros.IFHASPROP

3 Overload If object a has all the given properties using the in operator, then...
Properties:
Name Type Description
IFHASPROP boolean 1 Argument b in a?c:d
IFHASPROP boolean 2 Arguments b in a&&c in a?d:e
IFHASPROP boolean 3 Arguments b in a&&c in a&&d in a?e:f
IFHASPROP boolean 4 Arguments b in a&&c in a&&d in a&&e in a?f:g
Example
IFHASPROP(obj,"foo",true,false) //result: "foo" in obj?true:false
IFHASPROP(obj,"foo","bar",true,false) //result: "foo" in obj&&"bar" in obj?true:false
IFHASPROP(obj,"foo","bar","taco",true,false) //result: "foo" in obj&&"bar" in obj&&"taco" in obj?true:false
IFHASPROP(obj,"foo","bar","taco","bell",true,false) //result: "foo" in obj&&"bar" in obj&&"taco" in obj&&"bell" in obj?true:false

staticMacros.ISBOOLEAN

0 Overloads Check if "a" is a boolean
Properties:
Name Type Description
ISBOOLEAN boolean 1 Argument(s) "boolean"==typeof a
Example
ISBOOLEAN(foo) //result: "boolean"==typeof foo

staticMacros.ISFUNCTION

0 Overloads Check if "a" is a function
Properties:
Name Type Description
ISFUNCTION boolean 1 Argument(s) "function"==typeof a
Example
ISFUNCTION(foo) //result: "function"==typeof foo

staticMacros.ISOBJECT

0 Overloads Check if "a" is an object
Properties:
Name Type Description
ISOBJECT boolean 1 Argument(s) "object"==typeof a
Example
ISOBJECT(foo) //result: "object"==typeof foo

staticMacros.ISSTRING

0 Overloads Check if "a" is a string
Properties:
Name Type Description
ISSTRING boolean 1 Argument(s) "string"==typeof a
Example
ISSTRING(foo) //result: "string"==typeof foo

staticMacros.NOTEXISTS

0 Overloads Check if variable does not exist in the current scope
Properties:
Name Type Description
NOTEXISTS boolean 1 Argument(s) _undefined==typeof a
Example
NOTEXISTS(obj) //result: _undefined==typeof obj

staticMacros.PROPDEFINED

3 Overload Check if object a has all the given properties using the typeof operator
Properties:
Name Type Description
PROPDEFINED boolean 1 Argument _undefined!=typeof a[b]
PROPDEFINED boolean 2 Arguments _undefined!=typeof a[b]&&_undefined!=typeof a[c]
PROPDEFINED boolean 3 Arguments _undefined!=typeof a[b]&&_undefined!=typeof a[c]&&_undefined!=typeof a[d]
PROPDEFINED boolean 4 Arguments _undefined!=typeof a[b]&&_undefined!=typeof a[c]&&_undefined!=typeof a[d]&&_undefined!=typeof a[e]
Example
PROPDEFINED(obj,"foo") //result: _undefined!=typeof obj["foo"]
PROPDEFINED(obj,"foo","bar") //result: _undefined!=typeof obj["foo"]&&_undefined!=typeof obj["bar"]
PROPDEFINED(obj,"foo","bar","taco") //result: _undefined!=typeof obj["foo"]&&_undefined!=typeof obj["bar"]&&_undefined!=typeof obj["taco"]
PROPDEFINED(obj,"foo","bar","taco","bell") //result: _undefined!=typeof obj["foo"]&&_undefined!=typeof obj["bar"]&&_undefined!=typeof obj["taco"]&&_undefined!=typeof obj["bell"]

staticMacros.PROPTREEDEFINED

2 Overload Check if object a has property b, and a[b] has property c, etc... using typeof
Properties:
Name Type Description
PROPTREEDEFINED boolean 2 Arguments _undefined!=typeof a[b]&&_undefined!=typeof a[b][c]
PROPTREEDEFINED boolean 3 Arguments _undefined!=typeof a[b]&&_undefined!=typeof a[b][c]&&_undefined!=typeof a[b][c][d]
PROPTREEDEFINED boolean 4 Arguments _undefined!=typeof a[b]&&_undefined!=typeof a[b][c]&&_undefined!=typeof a[b][c][d]&&_undefined!=typeof a[b][c][d][e]
Example
PROPTREEDEFINED(obj,"foo","bar") //result: _undefined!=typeof obj["foo"]&&_undefined!=typeof obj["foo"]["bar"]
PROPTREEDEFINED(obj,"foo","bar","taco") //result: _undefined!=typeof obj["foo"]&&_undefined!=typeof obj["foo"]["bar"]&&_undefined!=typeof obj["foo"]["bar"]["taco"]
PROPTREEDEFINED(obj,"foo","bar","taco","bell") //result: _undefined!=typeof obj["foo"]&&_undefined!=typeof obj["foo"]["bar"]&&_undefined!=typeof obj["foo"]["bar"]["taco"]&&_undefined!=typeof obj["foo"]["bar"]["taco"]["bell"]