yahtnif / ixi

structure selection parser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ixi

npm Build Status LICENSE

structure selection parser.

Fork x-ray-select, with:

  • built-in filters: trim, reverse, slice, lowercase, uppercase, date
  • trim string by default
  • fix $root in array structure

Install

yarn add ixi
# or
npm install ixi

Usage

const X = require('ixi')

const html = `<div>
  <h1>ixi</h1>
  <ul>
    <li>one</li>
    <li>two</li>
    <li>three</li>
  </ul>
</div>`

const x = X(html)

console.log(x('h1')) // 'ixi'

console.log(x(['li'])) // ['one', 'two', 'three']

console.log(
  x({
    title: 'h1',
    items: ['li']
  })
)
// {
//   title: 'ixi',
//   items: ['one', 'two', 'three']
// }

console.log(
  x({
    $root: '.main',
    title: 'h1',
    items: ['li']
  })
)
// {
//   title: 'ixi',
//   items: ['one', 'two']
// }

License

Anti 996

About

structure selection parser.

License:Other


Languages

Language:JavaScript 100.0%