# basejs3

> a wrapper function package

Latest version **2.0.2** (published 2018-09-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install basejs3
pnpm add basejs3
yarn add basejs3
bun add basejs3
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2018-09-28 |
| First published | 2018-09-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rongxin |
| Maintainers | rongxin666 |
| Keywords | base |

## Links

- npm: https://www.npmjs.com/package/basejs3
- Repository: http://git.imweb.io/2018Nowitzki/adam
- npm.io page: https://npm.io/package/basejs3

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2018-09-28
- 2.0.1 — 2018-09-28
- 2.0.0 — 2018-09-25

## README

# Basejs

- a wrapper function package（自己写的封装一些实用函数的包）
- npm-url：[npm](https://www.npmjs.com/package/basejs3)
- git-url：[github](http://git.imweb.io/2018Nowitzki/adam.git)
<br>
<br>

## Installation

You can install with npm:

```
$ npm install basejs3
```
<br>

## Usage

```
import Basedam from 'basejs3'
```
<br>

## Function
### query(name, querystring)
- Function for gets the value of the specified name in the specified querystring
```
Base.query('hello', '?hello=test') //return 'test'
```
<br>

### serialize(data)
- Function for turn the object into a url string
```
Base.serialize({hello: 'js',hi:"test"}) //return 'hello=js&hi=test'
```
<br>

### $(selector)
- Function for simulating jQuery
```
Base.$(selector) //return {DOM|undefined}
```
<br>

### On(element,type,handler)
- Function for addEventListener 
```
Base.On(element,type,function())) //to make most of Browsers conpatible in Event binding
```
<br>
### removeNode(node)
- Function for Deleting DOM node
```
Base.removeNode(node) //return {DOM}
```
<br>

### insertAfter(node)
- Function for inserting the node node after the target node
```
Base.insertAfter(node, target) 
```
<br>

### addClass(node, className)
- Function for add class name
```
Base.addClass(node, className) 
```
<br>

### removeClass(node, className)
- Function for remove class name
```
Base.removeClass(node, className) 
```
<br>

### getAbsoluteUrl(url)
- Function for get absolute url
```
Base.getAbsoluteUrl('/f3-t1') //return 'http://git.imweb.io/f3-t1'
```
<br>

### debounce(callback, time)
- Function for avoiding shake
- example:
```
 test('Normal', (done) => {
    var total = 0
    const debounce = Base.createDebounce(() => {
      total += 1
      expect(total).toBe(1)
      done()
    }, 300)
    for (let i = 0; i < 10; i++) {
      debounce()
    }
    expect(total).toBe(0)
    debounce()
    expect(total).toBe(0)
  })
```
<br>

### removeItemByIndex(index, arr)
- Function for remove item by index
```
Base.removeItemByIndex(1, [1, 2, 3]) //return [1, 3]
```
<br>

### HtmlEncode(str)
- Function for filter Html Tag
```
Base.HtmlEncode(<a></a>)//return "&lt;a&gt;a&lt;/a&gt;"
```
<br>

### fliter(str)
- Function for filter appointed Tag and attributes
```
Base.fliter(`<script>alert</script><a href="a.com" onclick="alert(1)">test</a>`)//return `<a href="a.com" >test</a>`
```
<br>

---
_Source: https://npm.io/package/basejs3 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
