1.4.1 • Published 1 year ago

@nait-aits/helper v1.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Installation

// with npm
npm install @nait-aits/helper

Usage Examples

1. React Hooks Helpers

import {
  usePrevious,
  useMultiStates,
  useMapStates,
  useDebounce,
  useEditDebounce,
  useOneState,
  useUndoableState,
} from "@nait-aits/helper/hooks";

const SamplePage = (props: Props) => {
  const [count, setCount] = useState(0);
  const prev = usePrevious(count);

  return <></>;
};

export default SamplePage;

2. A set of polyfill methods available to call globaly.

  • Array.avg
  • Array.compact
  • Array.chunk
  • Array.groupBy
  • Array.isEqualTo
  • Array.max
  • Array.maxOf
  • Array.min
  • Array.minOf
  • Array.orderBy
  • Array.sample
  • Array.sum
  • Array.uniq
  • Array.uniqOf
  • Array.without
  • Function.compose
  • Function.curry
  • Function.partial
  • Function.partialArg
  • Number.pad
  • Object.isEqual
  • String.isWhiteSpace
  • globalThis.isNullish
  • globalThis.reactClassNames

Please see details in each method and type definition. Simply import the file at the top in the root file like app.tsx or index.tsx, and the methods will be available globally.

import "@nait-aits/helper/polyfills";

If your project includes Storybook, please add the require statement to .storybook/preview.js file.

require("@nait-aits/helper/polyfills");

For newer version of webpack, you may need to use polyfills-es instead.

import "@nait-aits/helper/polyfills-es";

3. Cryptography hash and encryption functions

import {
  SHA1Hash,
  SHA256Hash,
  SHA512Hash,
  AESEncrypt,
  AESDecrypt,
} from "@nait-aits/helper/cryptography";
1.4.1

1 year ago

1.4.0

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago