The only reason you are able to call
Function.snapshotFunction is because
Function is itself a function, as are
String, this would no longer work. You added a method to all functions and called it on the function instance
Function. So if you tried using
this, it would reference the built-in
Function function. So yes, this should either be a free-standing function, or, if you wanted to make it a method (e.g.
getPrimitive.snapshot(["testPrimitive", testPrimitive])), then remove the first parameter of the function, and replace all references to it in the function with
this. Speaking of
this, I can't think of all the use cases for your function involving
this, but with code like this, it's pretty likely
this will cause something to break. I found an example here.
IMO, the [string, value, string, value, ...] thing is bad API de