open-index/open-npm huggingface dataset:
npm package: @locuschain/lib
Description: --- This is a library that includes functions necessary for applying the `Locus Chain` to your service. The following features are included:
Author: bloomtechnology
Latest version: 0.1.23

# locuschain-lib
---
This is a library that includes functions necessary for applying the `Locus Chain` to your service. The following features are included:

- Generate or load keys.
- Convert to data types used in Locus Chain.
- Validate transactions.
- Encode data.

## Installation

```shell
npm i locuschain-lib
```

## Usage

LocusLib.`function`(`params`)

- **function:** Function
- **params:** Parameter

```typescript
import { LocusLib } from 'locuschain-lib';
const result = await LocusLib.GetLibraryVersions()
console.log(result)
```

All functions are asynchronous. Use await before them or use then to receive the result.  

You can find the list of functions and detailed descriptions in the official Locus Chain documentation.
npm package: @locustjs/enum
Description: This library provides utilities to define enumeration objects similar to enums in other languages such as C# or Java
Author: Iron Code
Latest version: 3.0.0

# About
This library provides utilities to define C# enum like objects.

# Install
```
npm i @locustjs/enum
```

Current version:
```
3.0.0
```

# Usage

CommonJs
```javascript
var someFn = require('@locustjs/enum').someFn;
```

ES6
```javascript
import { someFn } from '@locustjs/enum'
```

example:

```javascript
import { Enum } from '@locustjs/enum';

const Color = Enum.define({ red: 0, green: 1, blue: 2}, 'Color');

console.log(Color.name);    // Color
console.log(Color.green);   // 1
console.log(Color['green']);  // 1
console.log(Color[1]);    // green

console.log(Color.isValid(1));  // true
console.log(Color.isValid(4));  // false
console.log(Color.isValid('green'));  // true
console.log(Color.isValid('Green'));  // false

console.log(Color.equals(Color.red, 0));  // true
console.log(Color.equals(Color.red, '0'));  // true
console.log(Color.equals(Color.red, 'red'));  // true

console.log(Color.getString(Color.red));  // 'red'
console.log(Color.getString('red'));    // 'red'
console.log(Color.getString('0'));    // 'red'
console.log(Color.getString('Yellow')); // undefined
console.log(Color.getString(5));      // undefined
console.log(Color.getString('Yellow', 'green'));  // 'green'
console.log(Color.getString(5, 'green')); // 'green'
console.log(Color.getString(5, 'Yellow'));  // 'red'

console.log(Color.getNumber(Color.red));  // 0
console.log(Color.getNumber('red'));  // 0
console.log(Color.getNumber(0));    // 0
console.log(Color.getNumber('0'));  // 0
console.log(Color.getNumber(5));  // undefined
console.log(Color.getNumber(5, 'green')); // 1
console.log(Color.getNumber(5, 'Yellow'));  // 0

console.log(Color.getNames());  // ['red', 'green', 'blue']
console.log(Color.getValues()); // [0, 1, 2]
console.log(Color.toArray()); // [{ name: 'red', value: 0 }, { name: 'green', value: 1 }, { name: 'blue', value: 2 }]

console.log('Testing enum value equality ...');

// 1. using Enum.equals
console.log(Enum.equals(Color, 1, 'green'));   // true
console.log(Enum.equals(Color, '1', Color.green)); // true
console.log(Enum.equals(Color, 1, 'Green'));   // false
console.log(Enum.equals(Color, 'green', Color.red)); // false

// 2. using equals() in enum type
console.log(Color.equals(1, 'green'));   // true
console.log(Color.equals('1', Color.green)); // true
console.log(Color.equals(1, 'Green'));   // false
console.log(Color.equals('green', Color.red)); // false
```
npm package: @locustjs/extensions-options
Description: This library provides a helper ExtensionsOptionsHelper class that is used in other locustjs-extensions libraries
Author: Iron Code
Latest version: 2.2.2

# About
This library provides a helper `ExtensionHelper` class that is used in other `@locustjs/extensions-...` libraries.

## Options
`ExtensionHelper` constructor has two parameters:

```javascript
ExtensionHelper(options, logger)
```

### constructor parameters

| Parameter | Type | Required |
|-----------|------|----------|
| `options` | `object`, `string`, `array` | yes |
| `logger` | `object` | no |

Structure of `options` as an object is as follows:
```json
{
    "include": [...],
    "exclude": [...]
}
```

`include` specifies list of function names that are going to be extended on a target object. The default value is `*`. It says all functions should be extended.

`exclude` specifies list of function names that should be skipped or ignored and should be extended on the target obejct.

If a `string` or `array` is passed as `options` parameter to `ExtensionHelper` constructor, it is used as a value for `includes` property.

### methods

| method | description |
|-----------|----------------|
| `configure(options)` | gets an `options` argument in the form of `object`, `string` or `array`, validate it and returns an options object |
| `shouldExtend(fnName)` | Based on an options passed to current `ExtensionHelper` instance, checks whether given `fnName` should be extended or not and returns `true` or `false`. |
| `extend(obj, fnName, fn)` | Checks whether `fnName` function could be extended or not and if so, extends `fn` function with the name `fnName` on given `obj` object. |

## Example
```javascript
const eh = new ExtensionHelper('min, max')

eh.extend(Array, 'min', function () {
    ...
})
```
npm package: @locustjs/htmlencode
Description: This library provides htmlencode/htmldecode functions
Author: Iron Code
Latest version: 1.0.1

# locustjs-htmlencode
This library provides htmlencode/htmldecode functions.

# Install
```
npm i @locustjs/htmlencode
```

# Import

CommonJs
```javascript
var { htmlEncode } = require('@locustjs/htmlencode');
```

ES6
```javascript
import { htmlEncode } from '@locustjs/htmlencode'
```

# Usage

Example 1: htmlEncode
```javascript
import { htmlEncode } from '@locustjs/htmlencode'

const str = '<p>Plan & Business = $</p>';

console.log(htmlEncode(str));  // &lt;p&gt;Plan &amp; Business &equals; &dollar;&lt;&sol;p&gt;
```

Example 2: htmlEncode + custom ignore character list
```javascript
import { htmlEncode } from '@locustjs/htmlencode'

const str = '<p>Plan & Business = $</p>';

console.log(htmlEncode(str, ['/', '=', '$']));  // &lt;p&gt;Plan &amp; Business = $&lt;/p&gt;
```

Example 3: htmlDecode
```javascript
import { htmlDecode } from '@locustjs/htmlencode'

const str = '&lt;p&gt;Plan &amp; Business&lt;&sol;p&gt;';

console.log(htmlDecode(str));  // <p>Plan & Business</p>
```
npm package: @locustjs/mime
Description: This library provides classes and a helper to work with MIME.
Author: Iron Code
Latest version: 2.0.2

# @locustjs/mime
This utility library provides a handy Mime object that helps in finding mime of a file extension.

## Installation

NPM
```
npm i @locustjs/cache
```

## Usage
Example:

```javascript
	import Mime from '@locustjs/mime'

	console.log(Mime.getMimeType('.jpg'));	// "image/jpeg"
	console.log(Mime.getMimeType('.json'));	// "application/json"
	
	console.log(Mime.getExtension("myphoto.jpg"));	// ".jpg"
	console.log(Mime.getExtensions("image/jpeg"));	// ["jpeg", "jpg", "jpe"]
	console.log(Mime.getFullMime('.json'));
	/*
	{
		charSet: "UTF-8",
		compressible: true,
		extensions: "json, map",
		id: 137,
		source: "iana",
		value: "application/json",
	}
*/
```

## Classes

- `MimeProviderBase`: base abstract class of mime providers
- `MimeProviderDefault`: default implementation of MimeProviderBase.

### Properties
- `MimeTypes`: returns list of all mime types.
- `Mimes`: returns list of all mimes.

### Methods
- `getExtension (filenameOrExtension)`: returns extension of a file (withought dot character).
- `getFullMime (filenameOrExtension)`: returns full mime inforation for the given filename/extension.
- `getMimeType (filenameOrExtension)`: returns mime type of the given filename/extension.
- `getExtensions(mime)`: returns file extension of the given mime.

## Change default mime provider
Using `setMimeProvider()` function we can change mime provider object in `Mime` variable.

```javascript
import Mime, { MimeProviderBase, setMimeProvider} from '@locustjs/mime'

class MyMimeProvider extends MimeProviderBase {
	...
}

setMimeProvider(new MyMimeProvider())

console.log(Mime.getMimeType('.jpg'))
```
npm package: @locustjs/pagination
Description: This library provides utilities regarding paging and pagination for data grids
Author: Iron Code
Latest version: 2.0.1

# @locustjs/pagination
This library provides utilities regarding paging and pagination for data grids.

# Install
```
npm i @locustjs/pagination
```

The library contains a `pagingCalc` function that helps calculating paging based on a given recordcount, pagesize and current page.

Example:
```javascript
import { pagingCalc } from 'locustjs-pagination';

const pageSize = 8;
const recordCount = 456;
const currentPage = 20;
const visiblePages = 6;

const paging = pagingCalc(currentPage, recordCount, pageSize, visiblePages);

console.log(paging);
/*
  result:
  {
    fromPage: 19
    fromRow: 153
    page: 20
    pageCount: 57
    pageSize: 8
    recordCount: 456
    toPage: 24
    toRow: 160
    visiblePages: 6
  }
*/
```
npm package: @locustjs/querystring
Description: This library provides querystring utilities.
Author: Iron Code
Latest version: 2.0.1

# locustjs-querystring
This library provides querystring utilities.

# Installation

```
npm i @locustjs/querystring
```

## functions
`parseQuery`: Parses strings in querystring format and returns a json object.

Example 1: basic example
```javascript
import { parseQuery } from 'locustjs-querystring';

var result = parseQuery('name=John%20Doe&age=23&city=UK&agree=true');

console.log(result);

/*
  {
    age: "23",
    agree: "true",
    city: "UK",
    name: "John Doe",
  }
*/
```

Example 2: enabling automatic-conversion
```javascript
import { parseQuery } from 'locustjs-querystring';

var result = parseQuery('name=John%20Doe&age=23&city=UK&agree=true', true);

console.log(result);

/*
  {
    age: 23,
    agree: true,
    city: "UK",
    name: "John Doe",
  }
*/
```
`createQuery`: converts a javascript object into querystring.

Example 1: basic example
```javascript
import { createQuery } from 'locustjs-querystring';

var result = createQuery({ name: 'John Doe', age: 23, city: 'UK', agree: true });

console.log(result);

/*
  name=John%20Doe&age=23&city=UK&agree=true
*/
```

Example 2: using ignore props
```javascript
import { createQuery } from 'locustjs-querystring';

var result = createQuery({ name: 'John Doe', age: 23, city: 'UK', agree: true }, 'age,city');

console.log(result);

/*
  name=John%20Doe&agree=true
*/
```

## Helpers

`QueryHelper`: A helper object with two methods, `parse()` and `stringify()` that are maped to `parseQuery` and `createQuery` methods. This helper is exported as default object from library.

Example:
```javascript
import QueryHelper from 'locustjs-querystring'

console.log(QueryHelper.parse('name=John%20Doe&agree=true'));  // { name: 'John Doe', agree: 'true' }
console.log(QueryHelper.stringify({ name: 'John Doe', age: 23 })); // name=John%20Doe&age=23

```