open-index/open-npm huggingface dataset:
npm package: @luckybytes/utils
Description: 通用工具库
Author: @luckybytes
Latest version: 0.0.1

# @luckybytes/utils

通用工具库

- [tryCatch](./src/tryCatch/index.md) &mdash; 安全执行给定函数，返回结果，同时捕获抛出的错误
- [asyncTryCatch](./src/asyncTryCatch/index.md) &mdash; 安全执行给定异步函数，返回结果，同时捕获抛出的错误
npm package: @luckycatfactory/esbuild-graphql-loader
Description: An esbuild plugin that allows for the importing of GraphQL files
Author: Louis Cruz
Latest version: 3.8.1

# `esbuild-graphql-loader`

[![npm version](https://badge.fury.io/js/%40luckycatfactory%2Fesbuild-graphql-loader.svg)](https://badge.fury.io/js/%40luckycatfactory%2Fesbuild-graphql-loader)

This is a zero-dependency [esbuild](https://github.com/evanw/esbuild) plugin that allows for the importing of GraphQL files.

## Usage

To install this package:

```sh
npm install --save @luckycatfactory/esbuild-graphql-loader esbuild graphql-tag graphql
```

```sh
yarn add @luckycatfactory/esbuild-graphql-loader esbuild graphql-tag graphql
```

Then, use the plugin like so:

```ts
import { build } from 'esbuild';
import graphqlLoaderPlugin from '@luckycatfactory/esbuild-graphql-loader';

build({
  ...otherOptions,
  plugins: [graphqlLoaderPlugin()],
}).catch(() => {
  process.exit(1);
});
```

With this in place, you should now be able to import GraphQL like so:

```ts
import schema from './schema.graphql';

// Do whatever with the schema DocumentNode...
```

Also, all operations are named exports, so you can do things like this:

```ts
import {
  QueryA,
  QueryB,
  MutationA,
  SubscriptionA,
} from './my-operations.graphql';

// Do whatever with those operations...
```

### GraphQL File Imports

You can import files from within GraphQL files by using imports in comments like so:

```gql
#import ./user.graphql

type Post {
  author: User!
  name: String!
}
```

Valid import comments are prefixed either with `#import ` or `# import ` and have a suffix of a path relative from the GraphQL file's path.

### Recommendations

#### Optimize Your DocumentNodes

You can shave a bit off your bundle size by optimizing your `DocumentNode` instances with tools like [@graphql-tools/optimize](https://www.graphql-tools.com/docs/api/modules/optimize) through the [mapDocumentNode configuration option](https://github.com/luckycatfactory/esbuild-graphql-loader#mapdocumentnode).

## Configuration

Some configuration options are available at plugin instantiation.

### `filterRegex`

This is the regex used to determine the files that are matches as GraphQL files.
By default, this regex is `/\.graphql$/`.
Here is how you can override that value:

```ts
import { build } from 'esbuild';
import graphqlLoaderPlugin from '@luckycatfactory/esbuild-graphql-loader';

build({
  ...otherOptions,
  plugins: [graphqlLoaderPlugin({ filterRegex: /\.gql$/ })],
}).catch(() => {
  process.exit(1);
});
```

### `mapDocumentNode`

This is an optional function that you can supply to map all `DocumentNode` instances before they're resolved.
An example of this would be:

```ts
import { build } from 'esbuild';
import graphqlLoaderPlugin from '@luckycatfactory/esbuild-graphql-loader';
import { optimizeDocumentNode } from '@graphql-tools/optimize';

build({
  ...otherOptions,
  plugins: [
    graphqlLoaderPlugin({
      mapDocumentNode: (documentNode: DocumentNode) =>
        optimizeDocumentNode(documentNode),
    }),
  ],
}).catch(() => {
  process.exit(1);
});
```
npm package: @luckycatfactory/react-pool-time
Description: The React implementations of a declarative relative time management system meant to make applications more performant, accurate, and intentional in their time updates.
Author: Louis Cruz
Latest version: 1.0.1

[![codecov](https://codecov.io/gh/louisscruz/react-pool-time/branch/master/graph/badge.svg?token=YlOca0sPpR)](https://codecov.io/gh/louisscruz/react-pool-time)
[![npm version](https://badge.fury.io/js/%40luckycatfactory%2Freact-pool-time.svg)](https://badge.fury.io/js/%40luckycatfactory%2Freact-pool-time)

# `react-pool-time`

This is the React implementation of Pool Time.

## Installation

### `npm`

```sh
npm install @luckycatfactory/pool-time-core @luckycatfactory/react-pool-time --save
```

### `yarn`

```sh
yarn add @luckycatfactory/pool-time-core @luckycatfactory/react-pool-time
```

## Usage

### Initialize the Provider

```jsx
import PoolTime from '@luckycatfactory/pool-time-core';
import {
  createPoolTimeProvider,
  useRelativeTime,
  ONE_SECOND,
  FIVE_SECONDS,
  TEN_SECONDS,
  THIRTY_SECONDS,
  ONE_MINUTE,
  FIVE_MINUTES,
  ETERNITY
} from '@luckycatfactory/react-pool-time';

// Step One: Initialize a PoolTime instance with your configuration.
const poolTime = new PoolTime({
  configuration: {
    accuracies: [
      {
        upTo: FIVE_SECONDS,
        within: ONE_SECOND,
      },
      {
        upTo: THIRTY_SECONDS,
        within: FIVE_SECONDS,
      },
      {
        upTo: ONE_MINUTE,
        within: TEN_SECONDS,
      },
      {
        upTo: FIVE_MINUTES,
        within: THIRTY_SECONDS,
      },
      {
        upTo: ETERNITY,
        within: ONE_MINUTE,
      },
    ]
  }
});

// Step Two: Initialize react-pool-time with your configuration.
const PoolTimeProvider = createPoolTimeProvider(configuration);

export default PoolTimeProvider;
```

### Use the useRelativeTime Hook

```jsx
import React from 'react';
import { useRelativeTime } from '@luckycatfactory/react-pool-time';

import PoolTimeProvider from './PoolTimeProvider';

const RelativeTime = React.memo(({ time }) => {
  const {
    /* difference, // If you'd prefer to get the raw difference, use this. */
    /* time, // If you just need the time, use this. */
    getRoundedDifference
  } = useRelativeTime(time);

  const timeAgo = useMemo(() => {
    const elapsedTime = getRoundedDifference();
    return `${elapsedTime}ms ago`;
  }, [getRoundedDifference]);

  return (
    <div>
      {timeAgo}
    </div>
  );
});

const now = Date.now();

const times = [
  now - 1000,
  now - 2000,
  now - 3000,
  now - 5000,
];

const App = React.memo(() => (
  <PoolTimeProvider>
    {times.map(time => <RelativeTime key={time} time={time} />)}
  </PoolTimeProvider>
));

export default App;
```
npm package: @luckycatfactory/redux-performance-middleware
Description: A simple middleware that allows you to measure performance of your reducers
Author: Louis Cruz
Latest version: 1.0.2

[![codecov](https://codecov.io/gh/luckycatfactory/redux-performance-middleware/branch/master/graph/badge.svg)](https://codecov.io/gh/luckycatfactory/redux-performance-middleware)
[![npm version](https://badge.fury.io/js/%40luckycatfactory%2Fredux-performance-middleware.svg)](https://badge.fury.io/js/%40luckycatfactory%2Fredux-performance-middleware)

# `redux-performance-middleware`

This package supplies a lightweight middleware that gives you observability of your Redux reducer's performance.

## Example

You can see an example of this middleware in use [here](https://codesandbox.io/s/redux-performance-middleware-example-03zkr?file=/src/index.js).

## Installation

With `yarn`:

```sh
yarn add @luckycatfactory/redux-performance-middleware
```

With `npm`:

```sh
npm install @luckycatfactory/redux-performance-middleware --save
```

## Usage

It's easy to use the middleware.
All you have to do is pass a callback on initialization:

```js
import reduxPerformanceMiddleware from '@luckycatfactory/redux-performance-middleware';

const logActionPerformance = ({ action, elapsedTime }) => {
  // Maybe you just want a warning in the console.
  if (elapsedTime > 10) {
    customLogger('Warning: slow reducer action observed for the following action:', action);
  }
  // Or maybe you want to use distribution metrics of some kind to get a larger
  // picture of your Redux performance.
  customDistributionMetric({
    metric: 'redux_performance',
    tags: [`action_type:${action.type}`],
    value: elapsedTime,
  });
}

const middleware = reduxPerformanceMiddleware(logActionPerformance);

const store = createStore(myReducer, applyMiddleware(middleware));
```

If you want to only use the middleware in development, you should do the following to prevent the package from being included in your bundle:

```js
import reduxPerformanceMiddleware from '@luckycatfactory/redux-performance-middleware';

const middleware = [/* other middleware */];

if (process.env.NODE_ENV === 'development') {
  const logActionPerformance = ({ action, elapsedTime }) => {
    //...
  };

  const performanceMiddleware = reduxPerformanceMiddleware(logActionPerformance);

  middleware.push(performanceMiddleware);
}

const store = createStore(myReducer, applyMiddleware(...middleware));
```
npm package: @luckychip/luckychip-sdk
Description: An SDK for building applications on top of LuckyChip.
Latest version: 1.1.8

# LuckyChip SDK

Forked from the [Uniswap SDK](https://github.com/Uniswap/uniswap-v2-sdk/commit/a88048e9c4198a5bdaea00883ca00c8c8e582605).

You can refer to the Uniswap SDK documentation [uniswap.org](https://uniswap.org/docs/v2/SDK/getting-started/).

## 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/luckychip-io/luckychip-sdk.git
```

Move into the luckychip-sdk working directory

```sh
cd luckychip-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.
```
npm package: @luckychip/uikit
Description: Set of UI components for luckychip projects
Latest version: 0.2.6

# Luckychip UIkit

Luckychip UIkit is a set of React components and hooks used to build pages on Luckychip's apps. It also contains a theme file for dark and light mode.

## Install

`yarn add @luckychip/uikit`

## Setup

### Theme

Before using Luckychip UIkit, you need to provide the theme file to styled-component.

```
import { ThemeProvider } from 'styled-components'
import { light, dark } from '@luckychip/uikit'
...
<ThemeProvider theme={isDark}>...</ThemeProvider>
```

### Reset

A reset CSS is available as a global styled component.

```
import { ResetCSS } from '@luckychip/uikit'
...
<ResetCSS />
```

### Types

This project is built with Typescript and export all the relevant types.

## How to use the UIkit

If you want to use components from the UIkit, check the [Storybook documentation](https://pancakeswap.github.io/pancake-uikit/)