trait HtmlToJson extends Object
Html-to-Json - Parses HTML strings into objects using flexible, composable filters.
- Annotations
- @RawJSType() @native()
- Version
0.6.0
- See also
https://www.npmjs.com/package/html-to-json
- Alphabetic
- By Inheritance
- HtmlToJson
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
batch[T <: Any](html: String, dictionary: Dictionary[_], callback: Function2[Error, T, Any] = js.native): Promise[T]
Performs many parsing operations against one HTML string.
Performs many parsing operations against one HTML string. This transforms the HTML into a DOM only once instead of for each filter in the dictionary, which can quickly get expensive in terms of processing. This also allows you to break your filters up into more granular components and mix and match them as you please.
The values in the dictionary can be htmlToJson.Parser objects, generated methods from htmlToJson.createMethod, or naked filters that you might normally pass into htmlToJson.parse.
- html
the HTML string
- dictionary
a dictionary containing the elements to be processed
- callback
the optional callback
- returns
a promise
htmlToJson.batch(html, dictionary, [callback]) -> promise
Example: -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
createMethod[T](filter: Array[_], callback: Function2[Error, T, Any] = js.native): Any
Generates a method that wraps the passed filter argument.
Generates a method that wraps the passed filter argument. The generated method takes an HTML string and processes it against that filter.
- filter
the given filter array
htmlToJson.createMethod(filter) -> function (html, [callback])
Example: -
def
createParser[T <: Any](filter: Array[_]): Promise[T]
For the sake of reusability, creates an object with .parse and .request helper methods, which use the passed filter.
For the sake of reusability, creates an object with .parse and .request helper methods, which use the passed filter.
- filter
the given filter array
- returns
a promise
new htmlToJson.Parser(filter)
, htmlToJson.createParser(filter)
Examples: -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
parse[T <: Any](html: String, filter: |[FilterOptions, RawOptions], callback: Function2[Error, T, Any] = js.native): Promise[T]
The parse() method takes a string of HTML, and a filter, and responds with the filtered data.
The parse() method takes a string of HTML, and a filter, and responds with the filtered data. This supports both callbacks and promises.
htmlToJson.parse(html, filter, [callback]) -> promise
Example: -
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
request[T <: Any](request: |[String, RequestOptions], filter: |[FilterOptions, RawOptions], callback: Function2[Error, T, Any] = js.native): Promise[T]
The request() method takes options for a call to the request library and a filter, then returns the filtered response body.
The request() method takes options for a call to the request library and a filter, then returns the filtered response body.
htmlToJson.request(requestOptions, filter, [callback]) -> promise
Example: -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )