js-sniper
Version:
A lightweight JavaScript library that lets you code smarter and build faster
101 lines (65 loc) • 3.95 kB
Markdown
# SniperJs: The Lightweight and Powerful JavaScript Utility Library
## About
SniperJs is a lightweight, easy-to-use JavaScript library designed to simplify and supercharge your web development projects. Whether you’re building websites for learning, personal, or commercial purposes, SniperJs empowers you with versatile tools that save time and effort.
## Features
- Lightweight and fast.
- Ready-to-use utility functions for common JavaScript tasks.
- Free to use for all purpose.
## Getting Started
### Full documentation
[SniperJs Docs](https://sniperjs.gitbook.io/docs)
### Installation
Simply include the library in your project by adding the following `<script>` tag to your HTML file:
```html
<script src="https://cdn.jsdelivr.net/npm/js-sniper/dist/sniper.min.js"></script>
```
Alternatively, download the compiled version from our releases page.
### Usage Example
```javascript
// Example: Using SniperJs to manipulate a DOM element
$('#myElement').addClass('highlight');
```
### Regular JavaScript
```javascript
document.getElementsByClassName("button")[0].classList.add("active");
```
## Why Choose SniperJs Over jQuery?
### Seamless DOM Integration
jQuery is object-based, meaning you often have to wait for its `$(document).ready()` function to ensure your code runs after the DOM is fully loaded. SniperJs eliminates this hassle! SniperJs is integrated directly with DOM elements, so your JavaScript code fires as soon as the corresponding DOM elements are ready, providing a smooth and frustration-free development experience.
### Lightweight and Fast
jQuery has evolved over the years but has grown heavier, containing features you might never use. This added weight can slow down your website, especially in performance-critical applications. SniperJs, on the other hand, is built with simplicity in mind. It's lightweight, making it faster to load and execute. Focused on only what you need, no bloatware.
### Flexibility: Combining SniperJs with Regular JavaScript
jQuery locks you into its syntax. You can’t freely mix jQuery methods with native JavaScript functions. SniperJs breaks this barrier. You can combine SniperJs methods with native JavaScript seamlessly. This hybrid approach gives you unmatched flexibility.
Example:
```javascript
// SniperJs with regular JavaScript
$('.button').addEventListener('click', (e) => {
console.log('Button clicked!');
});
$('.container').addClass('active').firstElementChild;
// Regular JavaScript method
$('input').value;
```
### Intuitive and Cleaner Syntax
SniperJs adopts a syntax inspired by jQuery but simplifies it further to improve readability and usability. You’ll spend less time writing code and more time building features.
Example of SniperJs:
```javascript
$('main > div*').classList.add('active'); // Add 'active' class to all matched elements
```
```javascript
// SniperJs method
$('input').val();
```
### A Fresh Approach to Modern Web Development
jQuery was revolutionary in its time, but it was built for an era before modern JavaScript frameworks and tools. SniperJs is designed with today’s developer in mind. It integrates effortlessly into modern projects. You won’t need extra functions or polyfills to handle outdated browser quirks.
## Documentation
Comprehensive documentation is available at [SniperJs Docs](https://sniperjs.gitbook.io/docs).
## License
This library is proprietary and source-available under specific terms:
- Free for personal, commercial, and educational use.
- Modification, redistribution, or reverse-engineering is prohibited.
- For more details, refer to the license header in the code.
## Contributing
Currently, the library is not open to contributions as the source code remains closed to protect intellectual property. Stay tuned for updates in the future.
## Support
For questions, issues, or feedback, please contact us at [support@jubbytech.com](mailto:support@jubbytech.com).