0.1.7 • Published 2 years ago

helpme-js v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

helpme-js

Installing

Using npm:

$ npm install helpme-js

Using yarn:

$ yarn add helpme-js

🎈 HColors

In javascript

const { HColors } = require('helpme-js');
HColors.red[0];
HColors.red[5];
HColors.red[9];

In typescript

import { HColors } from 'helpme-js';
HColors.red[0];
HColors.red[5];
HColors.red[9];

There are the following colors and the 10 colors that change gradually.

  • transparency
  • grey
  • red
  • pink
  • grape
  • violet
  • indigo
  • blue
  • cyan
  • teal
  • green
  • lime
  • yellow
  • orange

🎈 HMath

In javascript

const { HMath } = require("helpme-js");
HMath.estimateNumber(15.24, 1, APPROXIMATE_TYPE.CEIL))
HMath.estimateNumber(15.24, 1, APPROXIMATE_TYPE.FLOOR))
HMath.estimateNumber(15.24, 1, APPROXIMATE_TYPE.ROUND))

In typescript

import { HMath } from "helpme-js";
HMath.estimateNumber(15.24, 1, APPROXIMATE_TYPE.CEIL))
HMath.estimateNumber(15.24, 1, APPROXIMATE_TYPE.FLOOR))
HMath.estimateNumber(15.24, 1, APPROXIMATE_TYPE.ROUND))

Methods

  • HMath.estimateNumber(number, approximatePlace, approximateType)

    approximateType : "올림", "내림", "반올림", (only typescript) APPROXIMATE_TYPE.CEIL, APPROXIMATE_TYPE.FLOOR, APPROXIMATE_TYPE.ROUND

🎈 HHelper

In javascript

const { HHelper } = require('helpme-js');
const {
  waitFor,
  sameArrayItem,
  sortByObjItem,
  orderBy,
  groupBy,
  deepCopy,
  SPACING_TYPE,
  deleteSpacing,
  uniqueObjArrayFor,
  oneTap,
} = HHelper;

In typescript

import { HHelper } from 'helpme-js';

Methods

waitFor(delay)

await waitFor(); // default 1000 millisecond
await waitFor(3000);

sameArrayItem(arr1, arr2): boolean

sameArrayItem([3, 2, 1], [1, 2, 3]); // true

sortByObjItem({list, key})

  • Sort by key Sort by number, then sort by character
const list = [
  { name: 'ccc_1', age: 30 },
  { name: 'bbb_2', age: 20 },
  { name: 'aaa_3', age: 10 },
];
sortByObjItem({ list, key: 'name' });
// [
//   { name: 'ccc_1', age: 30 },
//   { name: 'bbb_2', age: 20 },
//   { name: 'aaa_3', age: 10 },
// ];

orderBy( keys: string[], orders: ('asc' | 'desc')[], list: AnyObject[])

const users = [
  { name: 'c', age: 3, sex: 0 },
  { name: 'b', age: 2, sex: 0 },
  { name: 'a', age: 2, sex: 1 },
];
orderBy(['age', 'sex'], ['asc', 'asc'], users);
// [
//   { name: 'b', age: 2, sex: 0 },
//   { name: 'a', age: 2, sex: 1 },
//   { name: 'c', age: 3, sex: 0 },
// ];

groupBy(arr: any[], fn: any)

groupBy([6.1, 4.2, 6.3], Math.floor);
// {
//   keys: ['4', '6'],
//   byKey: { '4': [4.2], '6': [6.1, 6.3] },
// };

oneTap(callback, delay)

oneTap(() => console.log('execute callback'), 1000);
0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago