0.1.1 • Published 6 years ago

gaspard-collection v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Gaspard-collection

Manipulate collection of DOM elements

Gaspard-collection size Build Status Coverage Status

npm version devDependency Status Commitizen friendly

:fire: Use gaspard's Collection to queries elements and perform actions on each :fire:

Getting started

Installing

npmyarnbower jsDelivr
npm install gaspard-collectionyarn add gaspard-collectionbower install gaspard-collectiongaspard-collection.umd.js

Usage

Include gaspard-collection on your project

// Via ES2015 import statement
import GaspardCollection from 'gaspard-collection'

// or via Commonjs
const GaspardCollection = require('gaspard-collection')
const collection = new GaspardCollection('div.highlight')
collection
  .css('background-color', 'green')
  .find('p:first-child') // returns a new gaspard collection
  .addClass('introduction')
  .fadeIn(400)
  .elements // Array of matched elements
  .forEach(element => {
    console.log('div.highlight first paragraph', element)
  })

Or use gaspard-collection within a <script>

<script src="https://cdn.jsdelivr.net/npm/gaspard@latest/dist/gaspard.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gaspard-collection@latest/dist/gaspard-collection.umd.js"></script>
<script>
const collection = new GaspardCollection('div.highlight')
collection
  .css('background-color', 'green')
</script>

API documentation

Contribute

  • Fork the repository
  • Clone it locally and install dependencies with npm (or yarn)
    npm install
  • Create a new branch
  • Develop your feature/fix with tests running
    npm run test:watch
  • Commit, Push your branch and make a pull request on gaspard repository

Licensing

MIT License Copyright (c) 2017 Luca Perret