Mixin: Fn

Fn

Collection of useful extraction functions

Source:

Example

var Fn = require('html-scrapper').Fn;

var schema = {
 items: [{
   $rule: 'ul#items li'
   name:{
     $rule: 'a.title',
     $fn: Fn.text
   },
   price:{
     $rule: 'b.price',
     $fn: Fn.asInt
   },
 }],
};

Methods

(static) asFloat()

get text content and cast it into Float using parseFloat. All coma are deleted in the string.

Source:

(static) asInt()

get text content and cast it into integer using parseInt. All coma are deleted in the string. Useful for parsing Pricing texts

Source:

(static) classes()

get value of 'class' attribute

Source:

(static) data()

get value of JQuery(elem).data().

Source:

get value of 'href' attribute

Source:

(static) src()

get value of 'src' attribute

Source:

(static) text()

get text content

Source: