open-index/open-npm huggingface dataset:
npm package: @sharyn/util.between
Description: **`between`** tests if a numeral value is between two bounds.
Latest version: 1.0.2

# 🌹 between

**`between`** tests if a numeral value is between two bounds.

So instead of writing this:

```js
const x = 50
if (x >= 10 && x <= 100)
```

You can now use:

```js
if (between(x, 10, 100))
```

The bounds are compared inclusively by default. For an exclusive comparison, use the last parameter, which can be `exclude`, `exclude-lower`, or `exclude-upper`.

```js
import between from '@sharyn/util/between'
// or import { between } from '@sharyn/util'

const x = 50
between(x, 10, 100) // true

between(10, 10, 100) // true
between(100, 10, 100) // true

between(10, 10, 100, 'exclude-lower') // false
between(100, 10, 100, 'exclude-upper') // false

between(10, 10, 100, 'exclude') // false
between(100, 10, 100, 'exclude') // false
```
npm package: @sharyn/util.css
Description: **`css`** is a template string tag that does almost nothing. It's a normal template string, but your code editor or its plugins might support syntax highlighting for HTML when they are marked with a `css` tag. The only thing it does is to `.trim()` your s
Latest version: 1.0.0

## 🌹 css

**`css`** is a template string tag that does almost nothing. It's a normal template string, but your code editor or its plugins might support syntax highlighting for HTML when they are marked with a `css` tag. The only thing it does is to `.trim()` your string so that you can put your template string on multiple lines without getting unwanted whitespace.

**`css`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.cycle
Description: **`cycle`** returns the next value of a set of values, and defaults to the first one.
Latest version: 1.0.2

# 🌹 cycle

**`cycle`** returns the next value of a set of values, and defaults to the first one.

```js
import cycle from '@sharyn/util/cycle'
// or import { cycle } from '@sharyn/util'

cycle(current, 'a', 'b', 'c') // if current === 'a', returns 'b'
cycle(current, 'a', 'b', 'c') // if current === 'b', returns 'c'
cycle(current, 'a', 'b', 'c') // if current === 'c', returns 'a'
cycle(current, 'a', 'b', 'c') // if current === 'x', returns 'a'
```

Deep equality is supported:

```js
cycle({ a: 2 }, { a: 1 }, { a: 2 }, { a: 3 }) // { a: 3 }
```

**`cycle`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.defined
Description: **`defined`** returns `true` if the passed value is not `undefined`.
Latest version: 1.0.1

# 🌹 defined

**`defined`** returns `true` if the passed value is not `undefined`.

```js
import defined from '@sharyn/util/defined'
// or import { defined } from '@sharyn/util'

defined(undefined) // false
defined(void 0)    // false

defined('abc') // true
defined('')    // true
defined(0)     // true
defined(null)  // true
defined([])    // true
defined({})    // true
defined(NaN)   // true
```

**`defined`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.either
Description: **`either`** returns `true` if the first argument equals any of the other arguments.
Latest version: 1.0.1

# 🌹 either

**`either`** returns `true` if the first argument equals any of the other arguments.

Basically, you can replace this:

```js
if (something === 'foo' || something === 'bar' || something === 'baz')
// or
if (['foo', 'bar', 'baz'].includes(something))
```

By this:

```js
import either from '@sharyn/util/either'
// or import { either } from '@sharyn/util'

if (either(something, 'foo', 'bar', 'baz'))
```

`either` uses deep equality so you can test objects as well:

```js
either(obj, { a: 1 }, { a: 2 })
```

**`either`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.exists
Description: **`exists`** returns `true` if its argument is not `null` or `undefined`.
Latest version: 1.0.1

## 🌹 exists

**`exists`** returns `true` if its argument is not `null` or `undefined`.

```js
import exists from '@sharyn/util/exists'
// or import { exists } from '@sharyn/util'

exists('a')  // true
exists('')   // true
exists(0)    // true
exists(NaN)  // true

exists(null)      // false
exists(undefined) // false
exists(void 0)    // false
```

**`exists`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.global
Description: **`global`** is a set of functions to create and access global variables. Note that you cannot import the whole module as `global` since this is a reserved keyword. Simply import the functions directly or import it as some other name like `glob`. For conv
Latest version: 1.0.2

## 🌹 global

**`global`** is a set of functions to create and access global variables. Note that you cannot import the whole module as `global` since this is a reserved keyword. Simply import the functions directly or import it as some other name like `glob`. For convenience, these functions are both availble from the `@sharyn/util/global` module, and from the `@sharyn/util` module directly.

The global variables are stored in a simple object (`{}`):

```js
import { getGlobal, setGlobal, getAllGlobal, deleteGlobal, clearGlobal } from '@sharyn/util'
// or import { getGlobal, setGlobal, getAllGlobal, deleteGlobal, clearGlobal } from '@sharyn/util/global'

getAllGlobal() // {}

setGlobal('a', 1)
setGlobal('b', 2)

getAllGlobal() // { a: 1, b: 2 }

getGlobal('a') // 1

deleteGlobal('b')

getAllGlobal() // { a: 1 }

clearGlobal()

getAllGlobal() // {}
```

Of course global variables are a last resort, and more contained solutions are usually preferred, but in some situations it can be useful.

You can for instance set a Redux store as global in the file it is created:

```js
const store = createStore(...)
setGlobal('store', store)
```

And use it anywhere in your application, outside of React components for instance.

```js
getGlobal('store').getState()
```

**`global`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.html
Description: **`html`** is a template string tag that does almost nothing. It's a normal template string, but your code editor or its [plugins](https://marketplace.visualstudio.com/items?itemName=bierner.lit-html) might support syntax highlighting for HTML when they a
Latest version: 1.0.2

## 🌹 html

**`html`** is a template string tag that does almost nothing. It's a normal template string, but your code editor or its [plugins](https://marketplace.visualstudio.com/items?itemName=bierner.lit-html) might support syntax highlighting for HTML when they are marked with an `html` tag. The only thing it does is to `.trim()` your string so that you can put your template string on multiple lines without getting unwanted whitespace before the doctype or after the final `html` tag.

```js
import html from '@sharyn/util/html'
// or import { html } from '@sharyn/util'

const createHtml = ({ title }: { title: string }) =>
  html`
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <title>${title}</title>
      </head>
      <body>
        <h1>${title}</h1>
      </body>
    </html>
  ` // This HTML code has syntax highlighting
```

**`html`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.ifs
Description: `ifs` is a function that does an `if` / `else if` / `else` chain. Since it doesn't have the rigid structure of `if` and `else` statements, you can inline if anywhere in your code, including in JSX code. It's just an expression.
Latest version: 1.0.2

# 🌹 ifs

`ifs` is a function that does an `if` / `else if` / `else` chain. Since it doesn't have the rigid structure of `if` and `else` statements, you can inline if anywhere in your code, including in JSX code. It's just an expression.

It is similar to using chained ternaries except that you can omit the default case, and you might prefer that formatting to chained ternaries.

If the conditions in your cases are always comparing the same value with strict equality, use [`swit`](https://github.com/sharynjs/sharyn-util/blob/master/swit.md) instead.

```js
import ifs from '@sharyn/util/ifs'
// or import { ifs } from '@sharyn/util'

ifs(
  [value < 10, 'green'],
  [value < 100, 'yellow'],
  [value < 1000, 'orange'],
  [value < 10000, 'red'],
  'black',
)
```

Use `true` as the condition to provide a default case.

## ⚠️ Warning ⚠️

Since the array we are using inside `ifs` is being **declared** there, everything inside it will be **evaluated**. This means that the following will print all 3 `console.log`s:

```js
ifs(
  [value < 10, console.log('green')],
  [value < 100, console.log('yellow')],
  [value < 1000, console.log('orange')],
)
```

If your cases have side-effects like this, you should wrap them in a `() =>` function:

```js
ifs(
  [value < 10, () => console.log('green')],
  [value < 100, () => console.log('yellow')],
  [value < 1000, () => console.log('orange')],
)
```

Same thing with React components:

```js
ifs(
  [value < 10, () => <Green />],
  [value < 100, () => <Yellow />],
  [value < 1000, () => <Orange />],
)
```

You should only omit the function when your cases are simple primitive values.

And if your conditions are complex, you should also wrap them in functions:

```js
ifs(
  [() => superHeavy(), () => <Green />],
  [() => megaHeavy(), () => <Yellow />],
  [() => ultraHeavy(), () => <Orange />],
)
```

### Default case

The default case is the last argument that is *not an array*. If you want it to return an array, please wrap it in a `() =>` function.

**`ifs`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.inlinethrow
Description: **`inlineThrow`** is a function that `throw`s its argument. Unlike a regular `throw`, it's an expression and can be used anywhere.
Latest version: 1.0.1

## 🌹 inlineThrow

**`inlineThrow`** is a function that `throw`s its argument. Unlike a regular `throw`, it's an expression and can be used anywhere.

```js
const number = isNan(string) ? inlineThrow(Error('Not a number')) : parseInt(string)
```

**`inlineThrow`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.invoke
Description: **`invoke`** lets you run some imperative code anywhere, which can be useful in declarative contexts.
Latest version: 1.0.2

## 🌹 invoke

**`invoke`** lets you run some imperative code anywhere, which can be useful in declarative contexts.

It is the equivalent of a self-calling function.

For instance, let's say you have the following React component:

```jsx
const Cmp = ({ something }) => (
  <div data-something={something}></div>
)
```

If you want to execute some imperative code inside it you can do it with **`invoke`**:

```jsx
const Cmp = ({ something }) => (
  <div data-something={invoke(() => {
    console.log(something)
    doWhatever()
    return something
  })}></div>
)
```

### Multiple functions

You can pass multiple functions to **`invoke`**. Their results get returned as an array.

```js
invoke(() => 1, () => 2) // [1, 2]
```

You may want to use **`invoke`** if you want to execute multple functions inline without having to introduce a `{}` scope:

```jsx
const Cmp = () => (
  <input onChange={e => invoke(() => handleChange(e), () => updateSomething())} />
)
```

Now, whether this is a good practice or not is an other story, but at least you can.

**`invoke`** is part of [`@sharyn/util`](https://github.com/sharynjs/sharyn-util/blob/master/README.md)
npm package: @sharyn/util.toggle
Description: <!-- This file is auto-generated, don't modify it. Modify the JSDoc instead. -->
Latest version: 1.0.6

<!-- This file is auto-generated, don't modify it. Modify the JSDoc instead. -->

# 🌹 toggle

**`toggle`**: Toggles between two values, and defaults to the first one.

## Installation

```sh
npm i @sharyn/util.toggle
# or
yarn add @sharyn/util.toggle
```

You can alternatively install the [**@sharyn/util**](https://github.com/sharynjs/sharyn/blob/master/packages/util/README.md#readme) package, or the entire [**sharyn**](https://github.com/sharynjs/sharyn#getting-started) library.

## Arguments

**currentValue (any)**: The current value.

**firstValue (any)**: The first value.

**secondValue (any)**: The second value.

## Returns

**any**: The other option.

## Example

```js
toggle(current, 'a', 'b') // if current === 'a', returns 'b'
toggle(current, 'a', 'b') // if current === 'b', returns 'a'
toggle(current, 'a', 'b') // if current === 'x', returns 'a'
```

Deep equality is supported:

```js
cycle({ a: 1 }, { a: 1 }, { a: 2 }) // { a: 2 }
```

## Imports

Depending on the package you are using, you can `import` or `require` `toggle` in the following ways:

```js
// If you installed @sharyn/util.toggle
import toggle from '@sharyn/util.toggle' // smaller size, better for client bundles

// If you installed @sharyn/util
import toggle from '@sharyn/util/toggle' // smaller size, better for client bundles
import { toggle } from '@sharyn/util' // more convenient in Node environments

// If you installed sharyn
import toggle from 'sharyn/util/toggle' // smaller size, better for client bundles
import { toggle } from 'sharyn/util' // more convenient in Node environments
```

<hr />

<p align="center">
  This package is part of <a href="https://github.com/sharynjs/sharyn"><b>Sharyn</b></a>, a collection of utilities and helpers.
</p>
npm package: @sharyn/util.trycatch
Description: <!-- This file is auto-generated, don't modify it. Modify the JSDoc instead. -->
Latest version: 1.0.7

<!-- This file is auto-generated, don't modify it. Modify the JSDoc instead. -->

# 🌹 tryCatch

**`tryCatch`**: An inline `try` / `catch` / `finally` function, which returns the result of the `try` or `catch` case.

## Installation

```sh
npm i @sharyn/util.trycatch
# or
yarn add @sharyn/util.trycatch
```

You can alternatively install the [**@sharyn/util**](https://github.com/sharynjs/sharyn/blob/master/packages/util/README.md#readme) package, or the entire [**sharyn**](https://github.com/sharynjs/sharyn#getting-started) library.

## Arguments

**tryFn (function)**: The `try` instructions in a function.

**\[catchFn\] (function)**: The `catch` instructions in a function. Called with the error.

**\[finallyFn\] (function)**: The `finally` instructions in a function.

## Returns

**any**: What your `tryFn` or `catchFn` functions return.

## Example

```js
tryCatch(() => success()) // some result
tryCatch(() => failure()) // undefined
tryCatch(() => failure(), err => err) // the error
tryCatch(() => failure(), () => {}) // undefined
tryCatch(() => whatever(), () => {}, () => cleanup())
```

Is is particularly useful to avoid this pattern of assigning a variable inside the `try` block:

```js
let result
try {
  result = somethingRisky()
} catch (e) {
  handleError(e)
}
```

Which can be replaced by one line:

```js
const result = tryCatch(() => somethingRisky(), e => handleError(e))
```

Please note that `tryCatch` may affect the linting or type-checking of that code compared to using a real `try` / `catch` block.

## Imports

Depending on the package you are using, you can `import` or `require` `tryCatch` in the following ways:

```js
// If you installed @sharyn/util.trycatch
import tryCatch from '@sharyn/util.trycatch' // smaller size, better for client bundles

// If you installed @sharyn/util
import tryCatch from '@sharyn/util/tryCatch' // smaller size, better for client bundles
import { tryCatch } from '@sharyn/util' // more convenient in Node environments

// If you installed sharyn
import tryCatch from 'sharyn/util/tryCatch' // smaller size, better for client bundles
import { tryCatch } from 'sharyn/util' // more convenient in Node environments
```

<hr />

<p align="center">
  This package is part of <a href="https://github.com/sharynjs/sharyn"><b>Sharyn</b></a>, a collection of utilities and helpers.
</p>
npm package: @sharyn/util.wait
Description: <!-- This file is auto-generated, don't modify it. Modify the JSDoc instead. -->
Latest version: 1.0.7

<!-- This file is auto-generated, don't modify it. Modify the JSDoc instead. -->

# 🌹 wait

**`wait`**: A `Promise`-based delay.

## Installation

```sh
npm i @sharyn/util.wait
# or
yarn add @sharyn/util.wait
```

You can alternatively install the [**@sharyn/util**](https://github.com/sharynjs/sharyn/blob/master/packages/util/README.md#readme) package, or the entire [**sharyn**](https://github.com/sharynjs/sharyn#getting-started) library.

## Arguments

**\[milliseconds=1000\] (number)**: The duration of the wait.

## Returns

**Promise**

## Example

```js
const main = async () => {
  console.log('Legen - wait for it...')
  await wait(3000)
  console.log('...dary!')
}

main()
```

## Imports

Depending on the package you are using, you can `import` or `require` `wait` in the following ways:

```js
// If you installed @sharyn/util.wait
import wait from '@sharyn/util.wait' // smaller size, better for client bundles

// If you installed @sharyn/util
import wait from '@sharyn/util/wait' // smaller size, better for client bundles
import { wait } from '@sharyn/util' // more convenient in Node environments

// If you installed sharyn
import wait from 'sharyn/util/wait' // smaller size, better for client bundles
import { wait } from 'sharyn/util' // more convenient in Node environments
```

<hr />

<p align="center">
  This package is part of <a href="https://github.com/sharynjs/sharyn"><b>Sharyn</b></a>, a collection of utilities and helpers.
</p>
npm package: @sharyn/webpack-config
Description: [![npm](https://img.shields.io/npm/v/@sharyn/webpack-config.svg)](https://www.npmjs.com/package/@sharyn/webpack-config)
Latest version: 2.4.7

# 🌹 @sharyn/webpack-config

[![npm](https://img.shields.io/npm/v/@sharyn/webpack-config.svg)](https://www.npmjs.com/package/@sharyn/webpack-config)

## 🌹 Install

```bash
npx install-peerdeps -d -Y @sharyn/webpack-config
```

## 🌹 Usage

If you are using `@sharyn/cli`, the config file will be used automatically.

If not, create a `webpack.config.js` at the root of your project containing:

```js
module.exports = require('@sharyn/webpack-config')
```
npm package: @shashank.koppunoori-gokwik/payment-sdk
Description: Platform-agnostic payment components
Author: Shashank Koppunoori
Latest version: 1.2.1

# Payment SDK

Platform-agnostic payment components built with Svelte.

## Installation

```bash
npm install @shashank.koppunoori-gokwik/payment-sdk

How to use it in HTML Page - 

```html
<script type="module">
    import PaymentSDK from './build/sdk.esm.js';
    PaymentSDK.init();
    
    function checkPaymentPageLoaded() {
        // Correct element name and selector syntax
        const element = document.querySelector('payment-widget');
        if (element) {
            console.log('Payment widget loaded');
        } else {
            console.log('Payment widget not found');
        }
    }
    
    document.addEventListener('DOMContentLoaded', checkPaymentPageLoaded);
</script>
```
npm package: @shashank.map/tiny
Description: Removes all spaces from a string
Latest version: 3.0.0

# tiny
![npm](https://img.shields.io/npm/v/tiny?label=tiny&style=plastic)

It is a tiny example package
# install

npm install @shashank.map/tiny

# usage

```javascript

import tiny from '@shashank.map/tiny';


tiny("So much space!");
//=> "Somuchspace!"

tiny(1337);
//=> Uncaught TypeError: Tiny wants a string!
//    at tiny (<anonymous>:2:41)
//    at <anonymous>:1:1
```
npm package: @shashankrai/echo-chat-react-widget
Description: A drop-in React chat widget for Echo - an embeddable AI chat assistant for your website
Author: Shashank Rai
Latest version: 1.0.4

# @shashankrai/echo-chat-react-widget

An embeddable React chat widget for the ECHO Platform. Easily add an AI-powered chat assistant to your website using your unique API Key.

## Features

- 🚀 Drop-in React component - minimal setup required
- 💬 AI-powered chat interface
- 🎨 Customizable and responsive design
- 🔒 Secure API key authentication
- ⚡ Lightweight and performant

## Installation

```bash
npm install @shashankrai/echo-chat-react-widget
```

Or using yarn:
```bash
yarn add @shashankrai/echo-chat-react-widget
```

Or using pnpm:
```bash
pnpm add @shashankrai/echo-chat-react-widget
```

## Usage

Wrap your application (or a specific page) in the `<EchoProvider>`, and place the `<ChatWidget>` component anywhere in the React tree. The widget automatically handles rendering the floating button and the chat UI.

```tsx
import { EchoProvider, ChatWidget } from '@shashankrai/echo-chat-react-widget';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <EchoProvider apiKey="YOUR_LIVE_OR_TEST_API_KEY">
          {children}
          {/* Renders the floating chat bubble */}
          <ChatWidget />
        </EchoProvider>
      </body>
    </html>
  );
}
```

### API Key Configuration

The `apiKey` passed to the provider securely identifies your company and dynamically scopes all AI queries strictly to your company's knowledge base. 

- Use your **Live API Key** for production environments
- Use your **Test API Key** for development and testing

## Props

### EchoProvider

| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `apiKey` | `string` | Yes | Your Echo API key (Live or Test) |
| `children` | `ReactNode` | Yes | Your application content |

### ChatWidget

The `ChatWidget` component doesn't require any props. Simply place it inside your `EchoProvider`.

## Requirements

- React 18.0.0 or higher
- React DOM 18.0.0 or higher

## License

MIT

## Support

For issues, questions, or contributions, please visit our [GitHub repository](https://github.com/shashankrai/echo).
npm package: @shashanktiwary/react-dnd-touch-backend
Description: Touch backend for react-dnd
Author: Long Ho
Latest version: 0.3.13

<img src="https://avatars2.githubusercontent.com/u/6412038?v=3&s=200" alt="react logo" title="react" align="right" width="64" height="64" />

# react-dnd-touch-backend

[![npm version](https://badge.fury.io/js/react-dnd-touch-backend.svg)](http://badge.fury.io/js/react-dnd-touch-backend)
[![Dependency Status](https://david-dm.org/yahoo/react-dnd-touch-backend.svg)](https://david-dm.org/yahoo/react-dnd-touch-backend)
[![devDependency Status](https://david-dm.org/yahoo/react-dnd-touch-backend/dev-status.svg)](https://david-dm.org/yahoo/react-dnd-touch-backend#info=devDependencies)
![gzip size](http://img.badgesize.io/https://npmcdn.com/react-dnd-touch-backend?compression=gzip)

Touch Backend for [react-dnd](https://github.com/gaearon/react-dnd)

## Usage
Follow [react-dnd docs](http://gaearon.github.io/react-dnd/) to setup your app. Then swap out `HTML5Backend` for `TouchBackend` as such:

```js
import { default as TouchBackend } from 'react-dnd-touch-backend';
import { DragDropContext } from 'react-dnd';

var YourApp = React.createClass(
  /* ... */

);

module.exports = DragDropContext(TouchBackend)(YourApp);
```
## Tips
### Drag Preview
Since native Drag-n-Drop is not currently supported in touch devices. A custom [DragPreview](https://gaearon.github.io/react-dnd/docs-drag-layer.html) is required. Check out the [example](https://github.com/yahoo/react-dnd-touch-backend/blob/master/examples/js/ItemPreview.jsx) for a sample implementation.

We might try to build it directly in the Backend itself in the future to compensate for this limitation.

### Mouse events support*
You can enable capturing mouse events by configuring your TouchBackend as follows:
```js
DragDropContext(TouchBackend({ enableMouseEvents: true }));
```
**NOTE*: This is buggy due to the difference in `touchstart/touchend` event propagation compared to `mousedown/mouseup/click`. I highly recommend that you use [react-dnd-html5-backend](https://github.com/gaearon/react-dnd-html5-backend) instead for a more performant native HTML5 drag capability.**

## Examples
The `examples` folder has a sample integration. In order to build it, run:
```bash
npm i && npm run dev
```
Then navigate to `localhost:7789` or `(IP Address):7789` in your mobile browser to access the example.
Code licensed under the MIT license. See LICENSE file for terms.
npm package: @shasharoman/amp
Description: a message protocol
Author: shasharoman@gmail.com
Latest version: 1.1.1

AMP
===

AMP is for encode message to buffer and decode buffer to message.

Examples
--------

### json mode

``` {.javascript}
const amp = require('amp');

let parser = new amp.Parser({
    mode: 'json'
});
let bufferMsgs = parser.encode({
    msg: 'msgA'
}, {
    msg: 'msgB' 
});
let msgs = parser.decode(bufferMsgs);

console.log(msgs); // [{msg:'msgA'}, {msg: 'msgB'}]
```

### string mode

``` {.javascript}
const amp = require('amp');

let parser = new amp.Parser({
    mode: 'string'
});
let bufferMsgs = parser.encode('msgA', 'msgB');
let msgs = parser.decode(bufferMsgs);

console.log(msgs); // ['msgA', 'msgB']
```

### buffer mode

``` {.javascript}
const amp = require('amp');

let parser = new amp.Parser({
    mode: 'buffer'
});
let bufferMsgs = parser.encode(Buffer.from('msgA'), Buffer('msgB'));
let msgs = parser.decode(bufferMsgs);

console.log(msgs); // [<Buffer...>, <Buffer...>]
```

### stream with parser

``` {.javascript}
const amp = require('amp');

let inner = new amp.Parser({
    mode: 'json'
});
let parser = new amp.ChunkParser(inner);

let msgs = ['string', ['array'], {
    json: true
}];

parser.on('msg', msg => {
    console.log(msg); // 'string' ['array'] {json: true}
});
msgs.forEach(item => {
    parser.write(inner.encode(item));
});
```
npm package: @shasharoman/log
Description: log
Author: shasharoman@gmail.com
Latest version: 1.1.0

LOG
===

LOG is logger with simplest features.

Examples
--------

### file log

``` {.javascript}
const log = require('log');

let logger = new log.Logger('label', [
    new log.ConsoleTransport('DEBUG'),
    new log.FileTransport('INFO', './log')
]);

logger.debug('debug');
logger.info('info');
logger.warn('wran');
logger.error('error');
```

`./log` file's content:

``` {.text}
2019-10-05 23:00:00 [INFO] [label] info
2019-10-05 23:00:00 [WARN] [label] wran
2019-10-05 23:00:00 [ERROR] [label] error
```
npm package: @shasharoman/sok
Description: socket wrapper
Author: shasharoman@gmail.com
Latest version: 1.1.1

SOK
===

SOK is a wrapper of unix socket with some common pattern.

Examples
--------

### Pub-Sub

``` {.javascript}
const sok = require('sok');

let pub = new sok.pubsub.Pub('./pub.sock');
let sub = new sok.pubsub.Sub('./pub.sock');

sub.subscribe(msg => {
    console.log(msg); // msg1 {msg: 'msg2'}
});
sub.on('connect', () => {
    pub.publish('msg1');
    pub.publish({
        msg: 'msg2'
    });
});
```

> pub-sub use amp(json mode) to encode & decode

### Req-Res

``` {.javascript}
const sok = require('sok');

let res = new sok.reqres.Res((...args) => {
    console.log(...args); // string ['array']
    return {
        code: 0,
        msg: 'ok'
    };
});
res.listen('./rpc.sock');

let req = new sok.reqres.Req('./rpc.sock');
req.on('connect', () => {
    req.send('string', ['array'], (err, res) => {
        console.log(err, res); // null {code: 0, msg: 'ok'}
    });
});
```

> req-res use amp(json mode) to encode & decode
npm package: @shasharoman/sql
Description: sql tools
Author: shasharoman@gmail.com
Latest version: 1.1.2

SQL
===

SQL is a simple tool for building sql statement.

Examples
--------

### insert

``` {.javascript}
const sql = require('sql');

let [s, r] = sql.mysql.insert('table', {
    foo: 'foo',
    bar: 'bar'
});

// s: insert into `table`(`foo`, `bar`) values(:foo, :bar)
// r: { foo: 'foo', bar: 'bar' }
```

### delete

``` {.javascript}
const sql = require('sql')

let [s, r] = sql.mysql.delete('table', {
    foo: 'foo',
    bar: 'bar'
});

// s: delete from `table` where `foo` = :w_foo and `bar` = :w_bar 
// r: { w_foo: 'foo', w_bar: 'bar' }
```

### update

``` {.javascript}
const sql = require('sql');

let [s, r] = sql.mysql.update('table', {
    foo: 'foo'
}, {
    bar: 'bar'
});

// s: update `table` set `foo` = :s_foo where `bar` = :w_bar
// r: { s_foo: 'foo', w_bar: 'bar' }
```

### select

``` {.javascript}
const sql = require('sql');

let [s, r] = sql.mysql.select('table', {
    foo: 'foo',
    bar: 'bar',
    limit: [0, 10],
    order: ['id', 'desc']
});

// s: select * from `table` where `foo` = :w_foo and `bar` = :w_bar order by `id` desc limit 0, 10
// r: { w_foo: 'foo', w_bar: 'bar' }
```
npm package: @shashi-kumar/super-test-package
Description: Cross Platform Package of Core Features of the Raven SDK.
Author: Supragya Chauhan
Latest version: 1.0.16

# README #

This README would normally document whatever steps are necessary to get your application up and running.

### What is this repository for? ###

* Quick summary
* Version
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)

### How do I get set up? ###

* Summary of set up
* Configuration
* Dependencies
* Database configuration
* How to run tests
* Deployment instructions

### Contribution guidelines ###

* Writing tests
* Code review
* Other guidelines

### Who do I talk to? ###

* Repo owner or admin
* Other community or team contact