Namespace pjs.formatters
- Defined in:
- pjscrape.js
Formatter namespace. You can add new formatters here; new formatter classes
should have the properties start, end
, and
delimiter
, and the method format(item)
. You might
save some time by inheriting from formatters.raw or formatters.json.
// create a new formatter pjs.formatters.pipe = function() { var f = new pjs.formatters.raw(); f.delimiter = '|'; return f; }; // tell pjscrape to use your formatter pjs.config({ format: 'pipe' });
Static Fields
Field | |
---|---|
pjs.formatters.csv
:{Formatter}
CSV formatter - takes arrays or objects, fields defined by
config.csvFields or auto-generated based on first item
|
|
pjs.formatters.json
:{Formatter}
Format output as a JSON array
|
|
pjs.formatters.raw
:{Formatter}
Raw formatter - just uses toString()
|
Static Field Details
pjs.formatters.csv
:{Formatter}
CSV formatter - takes arrays or objects, fields defined by
config.csvFields or auto-generated based on first item
pjs.formatters.json
:{Formatter}
Format output as a JSON array
pjs.formatters.raw
:{Formatter}
Raw formatter - just uses toString()
©2011 Nick Rabinowitz
Documentation generated by JsDoc Toolkit 2.3.2 on Mon Oct 24 2011 12:16:49 GMT-0700 (PDT)
Documentation generated by JsDoc Toolkit 2.3.2 on Mon Oct 24 2011 12:16:49 GMT-0700 (PDT)