JSSoup is a BeautifulSoup style HTML parser library.
npm install jssoupJSSoup
=============================
I'm a fan of Python library BeautifulSoup. It's feature-rich and very easy to use. But when I am working on a small react-native project, and I tried to find a HTML parser library
like BeautifulSoup, I failed.
So I want to write a HTML parser library which can be so easy to use just like BeautifulSoup in Javascript.
JSSoup uses tautologistics/node-htmlparser as HTML dom parser,
and creates a series of BeautifulSoup like API on top of it.
JSSoup supports both node and react-native.



find_all() in BeautifulSoup is replaced as findAll().
$ npm install jssoup
`How to use JSSoup
$3
`javascript
//react-native
import JSSoup from 'jssoup';
// nodejs
var JSSoup = require('jssoup').default;
`
$3
`javascript
var soup = new JSSoup('hello');
`
> The text element only contains whitespace will be ignored by default. To disable this feature, set second parameter
of JSSoup to false. This parameter is "ignoreWhitespace" and will be passed into htmlparser.
`javascript
var soup = new JSSoup('hello', false);
`$3
`javascript
var soup = new JSSoup('hello');
var tag = soup.find('head');
tag.name
// 'head'
tag.name = 'span'
console.log(tag)
//hello
`
$3
`javascript
var soup = new JSSoup('hello ');
var tag = soup.nextElement;
tag.attrs
// {id: 'hi', class: 'banner'}
tag.attrs.id = 'test';
console.log(tag)
// hello
`$3
#### .previousElement, .nextElement
`javascript
var data =
var soup = new JSSoup(data);
var div = soup.nextElement;
var b = div.nextElement.nextElement;
// b.string: '2'
var a = b.previousElement;
// a.string: '1'
`
#### .previousSibling, .nextSibling
`javascript
var soup = new JSSoup(data);
var div = soup.nextElement;
var a = div.nextElement;
var b = a.nextSibling;
var c = b.nextSibling;
c.nextSibling == undefined;
`
#### .previousSiblings, .nextSiblings
`javascript
var soup = new JSSoup(data);
var a = soup.find("a");
a.nextSiblings
// [2, 3 ]
var c = soup.find("c");
c.previousSiblings
// [1, 2]
`
#### .contents
`javascript
div.contents
// [1, 2, 3 ]
`
#### .descendants
`javascript
div.descendants
// [1, 1, 2, 2, 3 , 3]
`
#### .parent
`javascript
div.parent == soup
`
$3
#### .extract()
`javascript
b.extract();
div.contents
// [1, 3 ]
`
#### .append()
`javascript
b.extract();
div.append(b)
div.contents
// [1, 3 , 2]
`
#### .insert(position, new Element)
`javascript
d.prettify('', '')
// 4
div.insert(1, d)
div.contents
// [1, 4 , 2, 3 ]
`
#### .replaceWith(new Element)
`javascript
d.prettify('', '')
// 4
b.replaceWith(d)
div.contents
// [1, 4 , 3 ]c.string.replaceWith('new')
div.contents
// [1, 4 , new ]
`$3
#### .findAll()
`javascript
var data =
var soup = new JSSoup(data);
soup.findAll('a')
// [hello]
soup.findAll('div', 'h1')
// []
`
#### .find()
`javascript
var data = hello
world
var soup = new JSSoup(data);
soup.find('p')
// hello
`
#### .findNextSibling()
`javascript
var data = hello
world
var soup = new JSSoup(data);
var span = soup.find('span');
span.findNextSibling('p')
// hello
`
#### .findNextSiblings()
`javascript
var data = hello
world
var soup = new JSSoup(data);
var span = soup.find('span');
span.findNextSiblings('p')
// hello
// world
`
#### .findPreviousSibling()
`javascript
var data = hello
world
var soup = new JSSoup(data);
var span = soup.find('span');
span.findPreviousSibling('p')
// world
`
#### .findPreviousSiblings()
`javascript
var data = hello
world
var soup = new JSSoup(data);
var span = soup.find('span');
span.findPreviousSiblings('p')
// hello
// world
`
$3
#### .prettify()
`javascript
var soup = new JSSoup('hello');
soup.prettify()
//
//
// hello
//
//
`
#### .getText(), .text
`javascript
div.text
// '123'
div.getText('|')
// '1|2|3'
`
#### .string
`javascript
b.string == '2';
var soup = new JSSoup('hello');
soup.string == 'hello';
`Run Test
`
npm test
``