open-index/open-npm huggingface dataset:
npm package: @holyhigh/cache.js
Description: A lightweight cache interface for all data-getters
Author: holyhigh
Latest version: 0.4.0

# Cache.js
用于浏览器端的轻量级缓存接口，可为所有getter赋予缓存能力，能够显著改善远程数据的响应速度并大幅提升用户体验
## 有什么用？
基于B/S结构的web应用有大量需要远程加载的数据，无论是PC或App或其他平台都会频繁的看到转圈/长条/骨架等各式各样的loading提示。
一旦这些效果反复出现时就会严重影响用户体验。 

Cache.js虽然为解决这些问题而设计，但与[cache-interface](https://w3c.github.io/ServiceWorker/#cache-interface)并不相同，它目前还在草案阶段并且具有仅对request/response、仅工作在HTTPS下等限制，而Cache.js可对**任何Data-Getter**赋能。

## 使用场景
1. 对MIS类纯web应用中的配置/字典信息、（低频变动的）组织机构、人员信息等进行持久化缓存，并增加 ***刷新缓存*** 功能实现主动数据更新
2. 基于App/桌面/TV的混合应用，可实现全数据缓存，并在网络检测后主动更新点击数据
3. 对任何request数据或基于(request/大量)数据进行计算后的数据进行缓存，以解决网络波动、长时计算带来的UI卡顿

## 基本特性
- 可使用高阶函数方式实现 **非侵入** 的缓存扩展
- 支持持久化开关，可自动检测持久化数据并反序列化到内存
- 可通过指定key进行缓存更新
- 可一次性删除所有缓存，实现强制刷新

> 持久化使用`localStorage`接口，这限制了可缓存数据总容量。可以点击这里[检测不同浏览器](https://arty.name/localstorage.html)的实际限制

## 安装

```
npm i @holyhigh/cache.js
```

## 用法
```js
/********** 接口文件 **********/
import {cacheable} from '@holyhigh/cache.js'
//1. 接口文件中定义的方法
function getAllUsers(){
    return new Promise((res,rej)=>{
        setTimeout(()=>res('ok'),1000)
    });
}
//2. 扩展缓存能力
let getUsersCache = cacheable(getAllUsers,{key:'all_users'})
//3. 导出接口
export {getUsersCache}
```

```js
/********** 业务文件 **********/
const users = await getUsersCache()
```

## API
```ts
import Cache,{cacheable} from '@holyhigh/cache.js'
//包装getter并返回包装后的异步函数
//key支持函数或字符串，使用函数可实现同一接口不同参数进行不同缓存；相同key对应的缓存数据会被覆盖;校验器用于检测是否对rs进行缓存，默认 !isNil
const cacheGetter = cacheable(getter:Function, key: ((params: any[]) => string|Promise<string>) | string, options?:{validator?:(rs: any) => boolean}): (...params: any[]) => Promise<any>

//开启持久化，默认false
Cache.persistence = true;
//设置全局缓存key前缀，默认'cache.js_'
Cache.keyPreffix = 'MyCache_'
//设置全局校验器，默认(rs) => !isNil(rs),
Cache.validator = isString

//更新指定key缓存数据
Cache.put(key: string, data: any)

//删除指定key缓存数据
Cache.del(key: string | RegExp)

//检测指定key缓存数据
Cache.has(key: string)

//获取指定key缓存数据
Cache.get(key: string)

//获取所有缓存数据map
Cache.getAll()

//删除所有缓存数据
Cache.delAll()

//cacheable别名
Cache.add
```

## demo
见test/index.spec.ts
npm package: @holyhigh/func.browser.js
Description: An extension toolkit of func.js with validator,converter,detecter and so on
Author: holyhigh
Latest version: 0.3.1

# func.browser.js

专用于浏览器的常用函数包，可独立或作为 func.js 的扩展使用

## 特性

- 数据验证
  > 身份证/手机/邮件/中文/IP/数字...
- 显示转换
  > 中文金额/颜色转换/实体转义...
- 特性检测
  > 平台类型(ipad,iphone,android)/是否开启全屏/有效分辨率...

## 安装使用

### NPM

```js
npm i @holyhigh/func.browser.js
```

## API

见 src

## demo

见 test/index.spec.ts
npm package: @holyhigh/func.js
Description: A modular&consistent pure function toolkit for javascript
Author: holyhigh
Latest version: 2.4.2

# Pure Function, More Attention
![npm](https://img.shields.io/npm/v/@holyhigh/func.js?style=plastic)
![NPM](https://img.shields.io/npm/l/@holyhigh/func.js)

```ts
//object
_.each<string, string>({ 1: 'a', 2: 'b', 3: 'c' }, (v,k)=>{})
//dom list
_.each<HTMLElement>(document.body.children, (el)=>{})
//array
_.each([1, 2, 3], num=>{})
//set
_.each(new Set([1, 2, 3]), num=>{})
```
> English | [中文](./README_ZH.md)

## Func.js
Func.js is a TS library of pure functions, providing developers with a more convenient, comprehensive, and diversified declarative programming experience.

- [📑 Documentation](https://holyhigh2.github.io/func.js/)
- [⚡ Play on StackBlitz](https://stackblitz.com/edit/func-js?file=index.ts)

## Features
- Unified interface for collections and other modules
- **200+** Pure functions
- Lazy evaluation
- Tree APIs
- Full dateTime/number formatter
- [and more...](https://holyhigh2.github.io/func.js/api/readme/)

## Quick start
1. install
```sh
npm i @holyhigh/func.js
```
2. import
```ts
import _ from '@holyhigh/func.js'
//or
import {each} from '@holyhigh/func.js'
//or
import {each,map} from '@holyhigh/func.js/collection'
//or
import _ from 'https://cdn.skypack.dev/@holyhigh/func.js'
```

## Development
1. use `test` to do jest 
2. use `build` to rollup func.js
3. use `doc` to gen tsdoc
npm package: @holyhigh/juth2-client.js
Description: A Juth2 client for javascript
Author: holyhigh
Latest version: 0.6.0

# Juth2-client.js

## 介绍
Juth2-client.js 是一个基于javascript的Juth2客户端实现。基于HTTP Header进行鉴权信息传输，实现了JWT处理、鉴权状态保持、接口封装等特性，包括
- 使用sessionStorage进行状态保持，并支持多页签共享，但不会像cookie样出现[CSRF](https://www.jianshu.com/p/2bd833de3adb)
- 与axios保持一致的请求接口 get/post/request
- 内置signIn/signOut/refreshToken(deamon模式自动)等接口 
- JWT Claims完整度处理，确保残缺信息无法通过Juth2-Server


## Juth2
Juth2是一整套跨域鉴权解决方案。基于JWT + OAuth2.0标准，由Java + Javascript实现(目前)。提供可配置鉴权/授权参数、透明中间层、对应(OAuth2.0)标准API，实现安装即用的前/后台套件。  
更多信息可以 [点此查看](https://www.jianshu.com/p/385e88e32a59)

## 安装
1. NPM
```
npm i @holyhigh/juth2-client.js
```

## 使用
1. NPM导入
```
import j2c from '@holyhigh/juth2-client.js';
```
2. 初始化Juth2-client
```
j2c.init({
    clientId: cid,//服务端生成的客户Id
    scope: 'a b',//授权范围
    origin: 'http://yy.yy.yy',//自己的服务器域名
    domain: 'http://xxx.xxx.xx',//验证服务器域名
    secret: 'juth2',//密钥，用于请求签名
    credentials: false,//是否启用credentials
    daemon: false, // 守护模式，开启后会自动在token过期前请求刷新token。注意，必须拥有刷新token权限，否则服务端会报错
    log:false//是否开启日志
}).then(signedIn => {//j2c内部实现了
    console.log('signedIn=>', signedIn)
});
```
3. 发起登录请求(password授权模式，使用HS256加密)
```
try {
    const rs = await j2c.signIn(username, password);
    //如果不使用juth2-client提供的get/post/request方法，比如外部axios
    //请务必获取rs中的headers数据的Authorization并设置到外部axios中
} catch (e) {
    console.error(e);
}
```
4. 登陆后可以访问其他服务
```
juth2.get('/r/show/me/the/money').then(rs => {
    console.log(rs);
});
```
npm package: @holymarcell/css-scf-border
Description: A custom beveled border implemented with the CSS Paint worklet api.
Author: HolyMarcell
Latest version: 0.1.9

# @holymarcell/css-scf-border

A custom beveled border implemented with the CSS Paint worklet api.

## demo

See: https://holymarcell.github.io/css-scf-border/

## usage:

Simple: (Not currently supported with Firefox)

```
if ('paintWorklet' in CSS) {
  CSS.paintWorklet.addModule('"https://unpkg.com/@holymarcell/css-scf-border@0.1.1/src/scfBorder.js');
}
```

In React (with snowpack): Copy the source over to your workdir and use this in your index.tsx

The Polyfill makes this css feature work in firefox.
```
import 'css-paint-polyfill';
CSS.paintWorklet.addModule(new URL('./scfBorder.js', import.meta.url));

```
npm package: @holymoly/state
Description: A simple state model with transition control
Author: holymoly
Latest version: 1.0.2

# state
A simple state model with transition control

## Example
```
const State = require('@holymoly/state');

// states allowed
var stateModel = [
  'idle',
  'created',
  'running',
  'completed',
  'hold',
  'aborted',
  'error'
];

//transitions allowed
var transitionModel = {
  'allowedTransitions': {
    'transitions': [{
      'actualState': 'idle',
      'newState': 'created'
    }, {
      'actualState': 'idle',
      'newState': 'aborted'
    }, {
      actualState: 'created',
      'newState': 'running'
    }, {
      'actualState': 'created',
      'newState': 'aborted'
    }, {
      'actualState': 'running',
      'newState': 'completed'
    }, {
      'actualState': 'running',
      'newState': 'hold'
    }, {
      'actualState': 'running',
      'newState': 'aborted'
    }, {
      'actualState': 'hold',
      'newState': 'running'
    }, {
      'actualState': 'error',
      'newState': '*'
    }, {
      'actualState': '*',
      'newState': 'error'
    }]
  }
};

// create new instance
var taskState = new State(stateModel, 'idle', transitionModel);

// state change is monitored by stateChange event
taskState.on('stateChange', function(data) {
  console.log(data);
})

// errors are raising error event
taskState.on('error', function(data) {
  console.log(data);
})

//set to create
taskState.setStateValue('created');
console.log(taskState.getStateValue());

// state idleasdfasdf is not defined
taskState.setStateValue('idleasdfasdf');
console.log(taskState.getStateValue());

// create to idl is not allowed
taskState.setStateValue('idle');
console.log(taskState.getStateValue());

// set to error
taskState.setStateValue('error');
console.log(taskState.getStateValue());

// error to running allowed wit wild card
taskState.setStateValue('running');
console.log(taskState.getStateValue());

// set to idle is not allowed
taskState.setStateValue('idle');
console.log(taskState.getStateValue());

// set to aborted
taskState.setStateValue('aborted');
console.log(taskState.getStateValue());
```
npm package: @holymos/eslint-config
Description: ESLint configuration.
Latest version: 1.2.0

# ESLint config

## Whats included?

- Standard config base;
- React plugin;
- React Hooks plugin;
- JSX a11y plugin;
- Eslint Plugin Import Helper;
- Prettier;
- Prettier Plugin Tailwind CSS (Using the CLI Tool)

## Setup

### Using the CLI Tool

```
npx @holymos/eslint-config init
```

### React (with Next.js)

Install dependencies:

```
npm i -D @holymos/eslint-config
```

Inside `eslint config file`

```
{
  "extends": [
    "next/core-web-vitals",
    "@holymos/eslint-config/next"
  ]
}
```

### React (without Next.js)

Install dependencies:

```
npm i -D @holymos/eslint-config
```

Inside `eslint config file`

```
{
  "extends": "@holymos/eslint-config/react"
}
```

### Node.js

Install dependencies:

```
npm i -D @holymos/eslint-config
```

Inside `eslint config file`

```
{
  "extends": "@holymos/eslint-config/node"
}
```
npm package: @holyswap/core
Description: Core contracts for the HolySwap protocol
Latest version: 1.0.0-pandora.1

# Advanced Sample Hardhat Project

This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the ecosystem.

The project comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. It also comes with a variety of other tools, preconfigured to work with the project code.

Try running some of the following tasks:

```shell
npx hardhat accounts
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
npx hardhat help
REPORT_GAS=true npx hardhat test
npx hardhat coverage
npx hardhat run scripts/deploy.js
node scripts/deploy.js
npx eslint '**/*.js'
npx eslint '**/*.js' --fix
npx prettier '**/*.{json,sol,md}' --check
npx prettier '**/*.{json,sol,md}' --write
npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fix
```

# Etherscan verification

To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.

In this project, copy the .env.template file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:

```shell
hardhat run --network ropsten scripts/deploy.js
```

Then, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command:

```shell
npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"
```
npm package: @holyswap/hardhat-framework
Description: Common test utilities for hardhat development
Author: Caspian Tech, Zephyr.
Latest version: 1.0.2

# hardhat-framework
 
This package helps configuring a repo for hardhat development. This is very opinionated :)

### How to include this?
All the packages needed are included in this package, so all you need to add in your repo's `package.json` is:

```
    "scripts": {
        "test": "hardhat test",
        "format": "prettier --write contracts/**/*.sol *.js *.json test/**/*.js",
        "pretty-quick": "pretty-quick",
        "coverage": "hardhat coverage"
    },
    "devDependencies": {
        "@holyswap/hardhat-framework": "holyswap/hardhat-framework"
    }
```

### Setting up your .env
You can include your environment variables in a `.env` file in the root of your repo. Alternatively you can set an actual environment variable called `DOTENV_PATH` to point to a central `.env` file to be used. This way you can use the same environment settings accross multiple projects.

Some useful settings:
```
ALCHEMY_API_KEY=
COINMARKETCAP_API_KEY=
HARDHAT_NETWORK=hardhat
HARDHAT_MAX_MEMORY=4096
HARDHAT_SHOW_STACK_TRACES=true
HARDHAT_VERBOSE=true
```

### Use default settings for configuration
Many settings are pre-defined in hardhat-framework. The following changes import all those settings as well as allow you to make any changes/additions to them in a central settings.js file.

To use the defaults defined in hardhat-framework, change or create the following files:

**hardhat.config.js**
```
module.exports = require("@holyswap/hardhat-framework").config.hardhat(require("./settings").hardhat)
```

**.prettierrc.js**
```
module.exports = require("@holyswap/hardhat-framework").config.prettier(require("./settings").prettier)
```

**.solcover.js**
```
module.exports = require("@holyswap/hardhat-framework").config.solcover(require("./settings").solcover)
```

And add a `settings.js` file:
```
module.exports = {
    hardhat: { },
    solcover: { },
    prettier: { }
}
```

TODO:

- Manage deployments
- Github hooks
- Getting husky to work properly (pre-commit in package.json)
- Integrate Certora
- Integrate Slither
npm package: @holyswap/holy-solidity
Description: HolySolidity
Latest version: 1.0.12

# HolySolidity

[![Coverage Status](https://coveralls.io/repos/github/Holy-Knights-NFT/HolySolidity/badge.svg?branch=master)](https://coveralls.io/github/Holy-Knights-NFT/HolySolidity?branch=master)

HolySolidity is a collection of general purpose Solidity contracts that have been reasonably optimized, reviewed and tested. Still, they come with no guarantees and are provided as-is.

## HolyMath Library

Once we can move to Solidity 0.8.0 we won't need this anymore, but until then, this library helps protect against over and under flows. Also contains some support for uint128.

There is no div function because never solidity versions will revert on a division by 0.

HolyMath128 does not contain a `mul` function on purpose. To avoid overflows during calculations, it's encouraged to convert to uint256 first.

## HolyOwnable

This is a combination of the well known Ownable and Claimable patterns. It's streamlined to reduce the amount of functions exposed for gas savings.

## HolyERC20

This is not a full ERC20 implementation, as it's missing totalSupply. It's optimized for minimal gas usage while remaining easy to read.

## HolyFactory

Simple universal factory to create minimal proxies from masterContracts.

## HolyBatchable

Extension to be added to any contract to allow calling multiple functions on the contract in a batch (a single EOA call). 
The EIP 2612 permit proxy function is included because it's common to approve spending before calling other functions on a contract.

## HolyRebase

The Rebase struct and RebaseLibary make it easy to track amounts and shares in a single storage slot. This will limit amounts and shares to 128 bits,
but if used for token balances, this should be enough for pretty much all tokens that have real use.

## Licence

MIT
npm package: @holyswap/sdk
Description: 🛠 An SDK for building applications on top of HolySwap.
Latest version: 1.0.2-pandora.2

# HolySwap SDK

In-depth documentation on this SDK is available at [uniswap.org](https://uniswap.org/docs/v2/SDK/getting-started/).

This modifies uniswap-sdk's UniswapV2Factory address.

## Running tests

To run the tests, follow these steps. You must have at least node v10 and [yarn](https://yarnpkg.com/) installed.

First clone the repository:

```sh
git clone https://github.com/Holy-Knights-NFT/holyswap-sdk.git
```

Move into the holyswap-sdk working directory

```sh
cd holyswap-sdk/
```

Install dependencies

```sh
yarn install
```

Run tests

```sh
yarn test
```

You should see output like the following:

```sh
yarn run v1.22.4
$ tsdx test
 PASS  test/constants.test.ts
 PASS  test/pair.test.ts
 PASS  test/fraction.test.ts
 PASS  test/miscellaneous.test.ts
 PASS  test/entities.test.ts
 PASS  test/trade.test.ts

Test Suites: 1 skipped, 6 passed, 6 of 7 total
Tests:       3 skipped, 82 passed, 85 total
Snapshots:   0 total
Time:        5.091s
Ran all test suites.
✨  Done in 6.61s.
```

### Network

* FANTOM_TESTNET
* MATIC_TESTNET
* BSC_TESTNET
* AVALANCHE_TESTNET
* HECO_TESTNET
* OKEX_TESTNET
* COINEX_TESTNET
npm package: @holytiny/wxmp-engine.io-client
Description: Client for the realtime Engine
Author: Holytiny
Latest version: 1.1.2


# @holytiny/wxmp-engine.io-client

[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)

&emsp;&emsp;这个项目是微信小程序环境下使用[Engine.IO](http://github.com/socketio/engine.io)的客户端,
从[Engine.IO-client](https://github.com/socketio/engine.io-client) fork而来，
是[Socket.IO](http://github.com/socketio/socket.io)在微信小程序环境下[wxmp-socket.io-client](https://github.com/holytiny/feathersjs-wxmp-socket.io-client#readme)客户端的传输层。
不建议单独使用这个软件包。
请参考[wxmp-socket.io-client](https://github.com/holytiny/feathersjs-wxmp-socket.io-client#readme)项目。

## 协议

[MIT](/LICENSE)
npm package: @holytiny/wxmp-engine.io-parser
Description: Parser for the client for the realtime Engine
Author: Holytiny
Latest version: 1.1.2


# @holytiny/wxmp-engine.io-parser

[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)

&emsp;&emsp;这个项目是微信小程序环境下使用[Engine.IO](http://github.com/socketio/engine.io)的[客户端](https://github.com/holytiny/feathersjs-wxmp-socket.io-client/tree/master/packages/wxmp-engine.io-client)的依赖包,
从[Engine.IO-parser](https://github.com/socketio/engine.io-parser) fork而来，
是[Socket.IO](http://github.com/socketio/socket.io)在微信小程序环境下[wxmp-socket.io-client](https://github.com/holytiny/feathersjs-wxmp-socket.io-client#readme)客户端的传输层的数据解析支持。
Fork的原因，是微信小程序环境不支持标准的Web `btoa()`和`atob()`函数。
不建议单独使用这个软件包。
请参考[wxmp-socket.io-client](https://github.com/holytiny/feathersjs-wxmp-socket.io-client#readme)项目。

## 协议

[MIT](/LICENSE)
npm package: @homaiohq/td-rcm
Description: **T**ransfert des **d**éclarations de **r**evenus de **c**apitaux **m**obiliers par procédé informatique
Author: Homaio
Latest version: 0.3.5

# TD/RCM ifu generator

**T**ransfert des **d**éclarations de **r**evenus de **c**apitaux **m**obiliers par procédé informatique

[![npm](https://img.shields.io/npm/dt/@homaiohq/td-rcm.svg)](https://www.npmjs.com/package/@homaiohq/td-rcm) [![npm](https://img.shields.io/npm/v/@homaiohq/td-rcm.svg)](https://www.npmjs.com/package/@homaiohq/td-rcm) [![license](https://img.shields.io/github/license/@homaiohq/node-td-rcm.svg)](https://github.com/@homaiohq/node-td-rcm/blob/master/LICENSE.md)

## Install

```JavaScript
npm i @homaiohq/td-rcm
```

## Usage

```js

import {
  IndicativeArea,
  IssuerAddress,
  D0Issuer,
  RecipientAddress,
  R1Recipient,
  TaxCredit,
  FixedIncomeProducts,
  CrowdfundingProducts,
  IncomeSubjectToIncomeTax,
  R2Amount,
  RCM
} from '@homaiohq/td-rcm';

const indicativeArea = new IndicativeArea({
  year: '2016',
  siret: '12345678912345',
  type: 1
});

/*
  Article déclarant D0
 */
const issuerAddress = new IssuerAddress({
  zipCode: '75009',
  streetNumber: '42',
  streetName: 'Rue des loutres',
  officeDistributor: 'Paris',
  issuanceDate: '20161224'
});

const d0 = new D0Issuer(indicativeArea.issuer({socialReason: 'Loutre SAS'}), issuerAddress);
/* */

/*
  Article Bénéficiaire R1
 */
const r1 = new R1Recipient({
  recipientIndicativeArea: indicativeArea.recipient({ recipientCode: 'B' }),
  recipientType: 2,
  recipient: {
    familyname: 'Henry',
    firstnames: 'Mattéo',
    sex: 2
  },
  birth: {
    year: 1980,
    month: 5,
    day: 22,
    departementCode: '69',
    city: 'Lyon'
  },
  recipientAddress: new RecipientAddress({
    zipCode: '75009',
    officeDistributor: 'Paris'
  })
})
/* */

/*
  Article Montant R2
 */
const taxCredit = new TaxCredit({AD: 9});
const fixedIncomeProducts = new FixedIncomeProducts({AR: 38});
const crowdfundingProducts = new CrowdfundingProducts({KR: 78, KS: 2});
const incomeSubjectToIncomeTax = new IncomeSubjectToIncomeTax({BU: 38});
const saleOfSecurities = new SaleOfSecurities({AN: 666, AK: 999});


const r2 = new R2Amount({
  amountIndicativeArea: indicativeArea.amountR2(),
  taxCredit,
  incomeSubjectToIncomeTax,
  fixedIncomeProducts,
  crowdfundingProducts
  saleOfSecurities,
  // ...
});
/* */

const rcm = new RCM(d0, {
  fullname: 'Robert Patron',
  phone: '0123456789',
  email: 'robert@patron.com'
});

rcm.addRecipient(r1, r2);

try {
  const ex = rcm.export(true);
}
catch (e) {
  console.log(e)
}

```

## Implemented items

We only implemented what we needed:

R3, R4 are not implemented

Don't hesitate to pull-request new block ;)
npm package: @homamo/meadow-utils
Description: Simple and helpful utilities for working on Meadow projects
Author: Samuel Goudie
Latest version: 1.10.0

# Meadow Utils

Helpful utilties for [Homamo](https://homamo.co) Meadow projects.

- checkUserHasAnyRole
- checkUserHasBetaAccess
- checkUserHasOneOfRoles
- checkUserHasRecordAccess
- checkUserHasRole
- checkUserNotificationsEnabled
- checkUserHasProgress

- convertDecimalToPercent
- convertPercentToDecimal
- convertToPence
- convertToPounds

- formatAddress
- formatBytes
- formatCurrency
- formatDateTime
- formatKebabText
- formatNumberFromPx
- formatOrdinalNumber
- formatPercentage
- formatSnakeAsText
- formatUserName

- getDateFromMonthAndYear
- getMonthList
- getMonthSelectOptions
- getRandomArrayValue
- getRandomInt
- getYearList
- getYearSelectOptions

- capitalize
- cleanUserObject
- checkFileIsCsv
- checkIsSameId
- checkValidEmail
- constructCloudinaryUrl
- keepParams
- pluralize
- round
- safeUserProfileField
- saveFile
- scrollToTop,

- isDevEnv
- isProdEnv
npm package: @homarr/gridstack
Description: TypeScript/JS lib for dashboard layout and creation, responsive, mobile support, no external dependencies, with many wrappers (React, Angular, Vue, Ember, knockout...)
Author: Alain Dumesny
Latest version: 1.12.0

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Gridstack for Homarr](#gridstack-for-homarr)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Gridstack for Homarr

This is a fork of [gridstack.js](https://github.com/gridstack/gridstack.js) that is modified to work with react. It is used in the homarr project.
npm package: @home-app/api.module
Description: This module makes http requests and log every step of it into the store.   It has several statuses: Pending, Success, Error, Cancel. All of it except Pending has some data (result or errors).     Also each unique request has an id that also stored in the 
Author: Homeapp
Latest version: 2.1.2

# Description
This module makes http requests and log every step of it into the store.  
It has several statuses: Pending, Success, Error, Cancel. All of it except Pending has some data (result or errors).    
Also each unique request has an id that also stored in the store (as a key of data).    
A data structure is following:  
```json
{
  "pathToApiData": {
    "rId0": {
      "status": "PENDING"
    },
    "rId1": {
      "status": "SUCCESS",
      "data": "raw response data"
    },
    "rId2": {
      "status": "ERROR",
      "data": "raw error data"
    },
    "rId3": {
      "status": "CANCEL",
      "data": "raw cancel data"
    }
  }
} 
```

# First of all

For correct work of the module it have to be done:  
- include the `redux-module-creator` into package.json dependencies (https://www.npmjs.com/package/redux-module-creator)    
- link the store according RMC documentation  

# Next step - integrating into the store:

## Reducer
You should to import the module into a reducer where you wanna store api data:    
```javascript
import { apiModule } from '@home-app/api.module';
```  

And integrate it into reducers tree:    
```javascript
function someReducer(state = initialState, action) {
  return {
    modulePath: apiModule.integrator('modulePath')(state, action),
  };
}
```

## Middleware
Also, you need to inject the middleware into the store handling cycle  
```javascript
import { middleware } from '@home-app/api.module';
```

Apply the middleware normally.  

# API reference

### .fetch(url \[, options\]\[, adapters\])  
- url: string  
- options: object  
-- method: method of the request  
-- body: data of the request  
-- headers: object with headers    
- adapters: function or array of functions 

Returns request id that is a unique string for each unique request (two equal requests will get same id).  

### .getPromise(requestId)
Returns a promise for an active request.  

### .cancelRequest(requestId)
Cancel an active request.  

### .actions.clear(requestId)
Dispatch an action that makes a reducer to clear all data for a specified request id.
npm package: @home-app/image.component
Description: An image component that load an appropriate sized image by itself.
Author: Homeapp
Latest version: 3.3.0

# Image

An image component that load an appropriate sized image by itself.  

**This component works with googleCloud images only!**

## How to use

### Install:

```
yarn add @home-app/image.component
```

### Import:
```javascript
import Image from "@home-app/image.component";
```

### Use:
```javascript
const baseURL = 'http://...';

const TABLET_WIDTH = 768;
const DESKTOP_WIDTH = 1024;
const LARGE_DESKTOP = 1440;
// it`s an object that contains mapping a screen width onto the image dimensions
const mediaDimensions = {
  [TABLET_WIDTH]: 500, // it means that for a media 'max-width: 767px' will be loaded an image with width=500px and proportionally resized height
  [DESKTOP_WIDTH]: {width: 900, height: 400}, // the image will be resized and cropped
  [LARGE_DESKTOP]: {height: 400}, // width will be proportionally resized to the specified height  
};

// ... some code

<Image src={baseURL} alt='' dimensions={mediaDimensions} />
```

### NB:
- For that will not be caught by media queries the `baseUrl` will be used. So, it means if an 200px width is used as a base, it will be dramatically blurred on a 1500px screen... **It is strongly recommended to use high resolution images for a base.**
npm package: @home-app/input.component
Description: Input Component
Author: Homeapp
Latest version: 0.1.0
Deprecated: wrong name

# Homeless INPUT

Extended input component.
Supports additional types:

- mask
- number

## How to install

```
yarn add @home-app/input.component

```

## How to use

### Masked input
```
import React from 'react';
import Input from '@home-app/input.component'

class Example extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value: '',
    };
  }

  handleChange = value => {
    this.setState({
      value,
    });
  };

  render() {
    return <Input onChange={this.handleChange} value={this.state.value}  mask="+7 (999) 999-99-99" type="mask" />;
  }
}

```

### Money input
```
import React from 'react';
import Input from '@home-app/input.component'

class Example extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value: '0',
    };
  }

  handleChange = value => {
    this.setState({
      value,
    });
  };

  render() {
    return <Input onChange={this.handleChange} value={this.state.value} type="money" />;
  }
}

```

## API

### common props:

- string: type = type of input;
- string(success|error): status = type of icon;
- function: onChange(value: string, event: Event, additionalParams: object): handler;
- boolean: isLine = type of view (line or outline);
- string: defaultValue = default value

### specific props:

**Money:**


look [react-currency-input](https://www.npmjs.com/package/react-currency-input)

**Mask:**

look [react-input-mask](https://www.npmjs.com/package/react-input-mask)
npm package: @home-app/redux-modal.module
Description: Modal
Author: Homeapp
Latest version: 1.0.0

# Homeless Modal

Universal Modal that uses redux state

## How to use

1. Install module:

```
yarn add @home-app/redux-modal.module
```

1. Add redux state:

```
import { reducer as modalReducer } from '@home-app/redux-modal.module';

rootReducer = combineReducers({
  potato: potatoReducer,
  tomato: tomatoReducer,
  ...
  modal: modalReducer,
})
```

2. Create modal config

```
export const modalIds = {
  EXAMPLE_MODAL: 'EXAMPLE_MODAL',
};

const modalConfig = {
  [modalIds.EXAMPLE_MODAL]: props => <ExampleModal {...props} />,
};

```

3. Create ModalComponent and put it somewhere inside react root element

```

import { modalFactory } from '@home-app/redux-modal.module';

const Modal = modalFactory({
  reduxName: 'modal', // name of reducer from step 1 (default modal)
  config: modalConfig, // modal config from step 2
  appElement: '#root', // selector of react root element 
  classNamePrefix: 'redux-modal', // css classNames prefix (default redux-modal)
});


export default RootComponent = props => <div>
  <OtherStuff />
  <Modal />
</div>

```

4. Connect action creators to component from step 3 

```
import { actions } from '@home-app/redux-modal.module';

...

const mapDispatchToProps = dispatch => ({
  openModal: (id, params) => dispatch(actions.modalOpen(id, params),
});

export default connect(null, mapDispatchToProps)(RootComponent));

```

5. Add openHandlers wherever you want

```
...
<input
  type="button"
  onClick={() => this.props.openModal(modalIds.EXAMPLE_MODAL)}
  value="PUSH ME"
/>

```
second argument for openModal() will be passed to modal component as props
npm package: @home-automation/home-automation-main
Description: Home Automation nodes for Node-RED.
Author: Nejc Okorn
Latest version: 1.2.2

# home-automation-node-red

Home Automation nodes for Node-RED that talk to the Home Automation Agent over HTTP.  
This contrib is designed to be used with the [Home Automation Agent](https://github.com/nejcokorn/home-automation-agent)

## Requirements

- Node-RED >= 2.0.0

## Install

Install via the Node-RED palette manager or npm:

```bash
npm install node-red-contrib-home-automation
```

## New Release

Create a tag (optional but recommended)
```bash
git tag v1.2.1
git push origin v1.2.1
```

Publish new version to npm and node-red
```bash
# Login
npm adduser
# Publish
npm publish --access public
```

## Nodes

- **ha-agent**: Configure the Home Automation Agent connection.
- **ha-ping**: Check connectivity to the agent/device.
- **ha-discover**: Discover devices on the CAN bus.
- **ha-get-port**: Read a digital output/input port state.
- **ha-set-port**: Set a digital output port state (with optional delay).
- **ha-list-delays**: List active delays on a device.
- **ha-delete-delay-id**: Clear a delay by delay ID.
- **ha-delete-delay-port**: Clear delays by port.
- **ha-set-config-action**: Build an action entry for device configuration.
- **ha-set-config**: Send configuration (actions + input settings) to a device.
- **ha-get-config**: Fetch a device configuration.
- **ha-save-eeprom**: Save the current configuration to device EEPROM.

## Basic usage

1. Add **ha-agent** and configure the agent URL/canbus.
2. Use **ha-discover** or **ha-ping** to validate connectivity.
3. Use **ha-set-config-action** to build actions, then feed into **ha-set-config**.
4. Use **ha-save-eeprom** to persist configuration on the device.

## Example flow

This module expects a Home Automation Agent compatible with the REST endpoints used by the nodes.
If you want a concrete flow example, share your agent base URL and a device ID and I can add one.

## License

MIT