I was looking through Mozilla’s JS in JS code and came across the snarf function. It’s not defined in the javascript, it seems, just in the C version here. It isn’t very well-commented, though. I Google searched this to no avail.
Is this a standard part of JavaScript? (My guess is no.) Is it some kind of extension? What is it supposed to do?
No, it is not standard. It is the part of Mozilla’s Narcissus (JS in JS interpreter implemented on top of SpiderMonkey).
snarf(filename)grabs the content of the file and returns it as a string for further processing (e.g., evaluation).