Skip to content

Commit

Permalink
docs: various improvement docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Dec 6, 2024
1 parent d5d4325 commit 53fcc51
Show file tree
Hide file tree
Showing 22 changed files with 305 additions and 315 deletions.
32 changes: 16 additions & 16 deletions docs/src/en/api/array.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Shuffle the order of the given array and return.
### Examples

```javascript
_.arrShuffle([1, 2, 3, 4]); // Returns [4, 2, 3, 1]
arrShuffle([1, 2, 3, 4]); // Returns [4, 2, 3, 1]
```

## `arrWithDefault` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -39,8 +39,8 @@ Initialize an array with a default value of a specific length.
### Examples

```javascript
_.arrWithDefault('abc', 4); // Returns ['abc', 'abc', 'abc', 'abc']
_.arrWithDefault(null, 3); // Returns [null, null, null]
arrWithDefault('abc', 4); // Returns ['abc', 'abc', 'abc', 'abc']
arrWithDefault(null, 3); // Returns [null, null, null]
```

## `arrWithNumber` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -59,8 +59,8 @@ Creates and returns an Array in the order of start...end values.
### Examples

```javascript
_.arrWithNumber(1, 3); // Returns [1, 2, 3]
_.arrWithNumber(0, 3); // Returns [0, 1, 2, 3]
arrWithNumber(1, 3); // Returns [1, 2, 3]
arrWithNumber(0, 3); // Returns [0, 1, 2, 3]
```

## `arrUnique` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -78,8 +78,8 @@ Remove duplicate values from array and two-dimensional array data. In the case o
### Examples

```javascript
_.arrUnique([1, 2, 2, 3]); // Returns [1, 2, 3]
_.arrUnique([[1], [1], [2]]); // Returns [[1], [2]]
arrUnique([1, 2, 2, 3]); // Returns [1, 2, 3]
arrUnique([[1], [1], [2]]); // Returns [[1], [2]]
```

## `average` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -97,7 +97,7 @@ Returns the average of all numeric values in an array.
### Examples

```javascript
_.average([1, 5, 15, 50]); // Returns 17.75
average([1, 5, 15, 50]); // Returns 17.75
```

## `arrMove` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -117,7 +117,7 @@ Moves the position of a specific element in an array to the specified position.
### Examples

```javascript
_.arrMove([1, 2, 3, 4], 1, 0); // Returns [2, 1, 3, 4]
arrMove([1, 2, 3, 4], 1, 0); // Returns [2, 1, 3, 4]
```

## `arrTo1dArray` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -135,7 +135,7 @@ Merges all elements of a multidimensional array into a one-dimensional array.
### Examples

```javascript
_.arrTo1dArray([1, 2, [3, 4]], 5); // Returns [1, 2, 3, 4, 5]
arrTo1dArray([1, 2, [3, 4]], 5); // Returns [1, 2, 3, 4, 5]
```

## `arrRepeat` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -154,8 +154,8 @@ Repeats the data of an `Array` or `Object` a specific number of times and return
### Examples

```javascript
_.arrRepeat([1, 2, 3, 4], 3); // Returns [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
_.arrRepeat({ a: 1, b: 2 }, 2); // Returns [{ a: 1, b: 2 }, { a: 1, b: 2 }]
arrRepeat([1, 2, 3, 4], 3); // Returns [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
arrRepeat({ a: 1, b: 2 }, 2); // Returns [{ a: 1, b: 2 }, { a: 1, b: 2 }]
```

## `arrCount` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -174,7 +174,7 @@ Returns the number of duplicates for each unique value in the given array. The a
### Examples

```javascript
_.arrCount(['a', 'a', 'a', 'b', 'c', 'b', 'a', 'd']); // Returns { a: 4, b: 2, c: 1, d: 1 }
arrCount(['a', 'a', 'a', 'b', 'c', 'b', 'a', 'd']); // Returns { a: 4, b: 2, c: 1, d: 1 }
```

## `sortByObjectKey` <Badge type="tip" text="JavaScript" />
Expand Down Expand Up @@ -220,7 +220,7 @@ const obj = [
}
];

_.sortByObjectKey(obj, 'aa');
sortByObjectKey(obj, 'aa');

/*
[
Expand Down Expand Up @@ -264,7 +264,7 @@ When sorting an array consisting of strings, it sorts first by the numbers conta
### Examples

```javascript
_.sortNumeric(['a1a', 'b2a', 'aa1a', '1', 'a11a', 'a3a', 'a2a', '1a']);
sortNumeric(['a1a', 'b2a', 'aa1a', '1', 'a11a', 'a3a', 'a2a', '1a']);
// Returns ['1', '1a', 'a1a', 'a2a', 'a3a', 'a11a', 'aa1a', 'b2a']
```

Expand All @@ -284,6 +284,6 @@ Separates the data in the given array into a two-dimensional array containing on
### Examples

```javascript
_.arrGroupByMaxCount(['a', 'b', 'c', 'd', 'e'], 2);
arrGroupByMaxCount(['a', 'b', 'c', 'd', 'e'], 2);
// Returns [['a', 'b'], ['c', 'd'], ['e']]
```
22 changes: 11 additions & 11 deletions docs/src/en/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Encrypt with the algorithm of your choice (algorithm default: `aes-256-cbc`, ivS
### Examples

```javascript
_.encrypt('test', 'secret-key');
encrypt('test', 'secret-key');
```

## `decrypt` <Badge type="tip" text="JavaScript" />
Expand All @@ -43,7 +43,7 @@ Decrypt with the specified algorithm (default: `aes-256-cbc`) using a string and
### Examples

```javascript
_.decrypt('61ba43b65fc...', 'secret-key');
decrypt('61ba43b65fc...', 'secret-key');
```

## `objectId` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -61,7 +61,7 @@ No parameters required
### Examples

```javascript
_.objectId(); // Returns '651372605b49507aea707488'
objectId(); // Returns '651372605b49507aea707488'
```

## `md5Hash` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -79,7 +79,7 @@ Converts String data to md5 hash value and returns it.
### Examples

```javascript
_.md5Hash('test'); // Returns '098f6bcd4621d373cade4e832627b4f6'
md5Hash('test'); // Returns '098f6bcd4621d373cade4e832627b4f6'
```

## `sha1Hash` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -97,7 +97,7 @@ Converts String data to sha1 hash value and returns it.
### Examples

```javascript
_.sha1Hash('test'); // Returns 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3'
sha1Hash('test'); // Returns 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3'
```

## `sha256Hash` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -115,7 +115,7 @@ Converts String data to sha256 hash value and returns it.
### Examples

```javascript
_.sha256Hash('test'); // Returns '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
sha256Hash('test'); // Returns '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
```

## `encodeBase64` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -133,7 +133,7 @@ Base64-encode the given string.
### Examples

```javascript
_.encodeBase64('this is test'); // Returns 'dGhpcyBpcyB0ZXN0'
encodeBase64('this is test'); // Returns 'dGhpcyBpcyB0ZXN0'
```

## `decodeBase64` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -151,7 +151,7 @@ Decodes an encoded base64 string to a plain string.
### Examples

```javascript
_.decodeBase64('dGhpcyBpcyB0ZXN0'); // Returns 'this is test'
decodeBase64('dGhpcyBpcyB0ZXN0'); // Returns 'this is test'
```

## `strToNumberHash` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -169,7 +169,7 @@ Returns the specified string as a hash value of type number. The return value ca
### Examples

```javascript
_.strToNumberHash('abc'); // Returns 96354
_.strToNumberHash('Hello'); // Returns 69609650
_.strToNumberHash('hello'); // Returns 99162322
strToNumberHash('abc'); // Returns 96354
strToNumberHash('Hello'); // Returns 69609650
strToNumberHash('hello'); // Returns 99162322
```
16 changes: 8 additions & 8 deletions docs/src/en/api/date.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Calculates the difference between two given dates and returns the number of days
### Examples

```javascript
_.daydiff(new Date('2021-01-01'), new Date('2021-01-03')); // Returns 2
daydiff(new Date('2021-01-01'), new Date('2021-01-03')); // Returns 2
```

## `today` <Badge type="tip" text="JavaScript" />
Expand All @@ -40,9 +40,9 @@ Returns today's date.
### Examples

```javascript
_.today(); // Returns YYYY-MM-DD
_.today('/'); // Returns YYYY/MM/DD
_.today('/', false); // Returns DD/MM/YYYY
today(); // Returns YYYY-MM-DD
today('/'); // Returns YYYY/MM/DD
today('/', false); // Returns DD/MM/YYYY
```

## `isValidDate` <Badge type="tip" text="JavaScript" />
Expand All @@ -60,8 +60,8 @@ Checks if a given date actually exists. Check only in `YYYY-MM-DD` format.
### Examples

```javascript
_.isValidDate('2021-01-01'); // Returns true
_.isValidDate('2021-02-30'); // Returns false
isValidDate('2021-01-01'); // Returns true
isValidDate('2021-02-30'); // Returns false
```

## `dateToYYYYMMDD` <Badge type="tip" text="JavaScript" />
Expand All @@ -80,7 +80,7 @@ Returns the date data of a Date object in the format `YYYY-MM-DD`.
### Examples

```javascript
_.dateToYYYYMMDD(new Date(2023, 11, 31)); // Returns '2023-12-31'
dateToYYYYMMDD(new Date(2023, 11, 31)); // Returns '2023-12-31'
```

## `createDateListFromRange` <Badge type="tip" text="JavaScript" />
Expand All @@ -99,7 +99,7 @@ Create an array list of all dates from `startDate` to `endDate` in the format `Y
### Examples

```javascript
_.createDateListFromRange(new Date('2023-01-01T01:00:00Z'), new Date('2023-01-05T01:00:00Z'));
createDateListFromRange(new Date('2023-01-01T01:00:00Z'), new Date('2023-01-05T01:00:00Z'));

/*
[
Expand Down
28 changes: 14 additions & 14 deletions docs/src/en/api/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Return number format including comma symbol.
### Examples

```javascript
_.numberFormat(1234567); // Returns 1,234,567
numberFormat(1234567); // Returns 1,234,567
```

```dart
Expand All @@ -43,8 +43,8 @@ Extract the file name from the path. Include the extension if withExtension is `
### Examples

```javascript
_.fileName('C:Temphello.txt'); // Returns 'hello.txt'
_.fileName('C:Temp\file.mp3', true); // Returns 'file.mp3'
fileName('C:Temphello.txt'); // Returns 'hello.txt'
fileName('C:Temp\file.mp3', true); // Returns 'file.mp3'
```

## `fileSize` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -63,8 +63,8 @@ Converts the file size in bytes to human-readable and returns it. The return val
### Examples

```javascript
_.fileSize(2000, 3); // Returns '1.953 KB'
_.fileSize(250000000); // Returns '238.42 MB'
fileSize(2000, 3); // Returns '1.953 KB'
fileSize(250000000); // Returns '238.42 MB'
```

## `fileExt` <Badge type="tip" text="JavaScript" /><Badge type="info" text="Dart" />
Expand All @@ -82,8 +82,8 @@ Returns only the extensions in the file path. If unknown, returns 'Unknown'.
### Examples

```javascript
_.fileExt('C:Temphello.txt'); // Returns 'txt'
_.fileExt('this-is-file.mp3'); // Returns 'mp3'
fileExt('C:Temphello.txt'); // Returns 'txt'
fileExt('this-is-file.mp3'); // Returns 'mp3'
```

## `duration` <Badge type="tip" text="JavaScript" />
Expand Down Expand Up @@ -115,8 +115,8 @@ const {
### Examples

```javascript
_.duration(1234567890); // 'Returns '14 Days 6 Hours 56 Minutes 7 Seconds 890 Milliseconds'
_.duration(604800000, {
duration(1234567890); // 'Returns '14 Days 6 Hours 56 Minutes 7 Seconds 890 Milliseconds'
duration(604800000, {
useSpace: false
}); // Returns '7Days'
```
Expand All @@ -137,8 +137,8 @@ Attempts to parse without returning an error, even if the argument value is of t
### Examples

```javascript
const result1 = _.safeJSONParse('{"a":1,"b":2}');
const result2 = _.safeJSONParse(null);
const result1 = safeJSONParse('{"a":1,"b":2}');
const result2 = safeJSONParse(null);

console.log(result1); // Returns { a: 1, b: 2 }
console.log(result2); // Returns {}
Expand All @@ -161,9 +161,9 @@ Any argument value will be attempted to be parsed as a Number type without retur
### Examples

```javascript
const result1 = _.safeParseInt('00010');
const result2 = _.safeParseInt('10.1234');
const result3 = _.safeParseInt(null, -1);
const result1 = safeParseInt('00010');
const result2 = safeParseInt('10.1234');
const result3 = safeParseInt(null, -1);

console.log(result1); // Returns 10
console.log(result2); // Returns 10
Expand Down
20 changes: 10 additions & 10 deletions docs/src/en/api/math.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Returns a random number (Between min and max).
### Examples

```javascript
_.numRandom(1, 5); // Returns 1~5
_.numRandom(10, 20); // Returns 10~20
numRandom(1, 5); // Returns 1~5
numRandom(10, 20); // Returns 10~20
```

## `sum` <Badge type="tip" text="JavaScript" />
Expand All @@ -40,8 +40,8 @@ Returns after adding up all the n arguments of numbers or the values of a single
### Examples

```javascript
_.sum(1, 2, 3); // Returns 6
_.sum([1, 2, 3, 4]); // Returns 10
sum(1, 2, 3); // Returns 6
sum([1, 2, 3, 4]); // Returns 10
```

## `mul` <Badge type="tip" text="JavaScript" />
Expand All @@ -59,8 +59,8 @@ Returns after multiplying all n arguments of numbers or the values of a single a
### Examples

```javascript
_.mul(1, 2, 3); // Returns 6
_.mul([1, 2, 3, 4]); // Returns 24
mul(1, 2, 3); // Returns 6
mul([1, 2, 3, 4]); // Returns 24
```

## `sub` <Badge type="tip" text="JavaScript" />
Expand All @@ -78,8 +78,8 @@ Returns after subtracting all n arguments of numbers or the values of a single a
### Examples

```javascript
_.sub(10, 1, 5); // Returns 4
_.sub([1, 2, 3, 4]); // Returns -8
sub(10, 1, 5); // Returns 4
sub([1, 2, 3, 4]); // Returns -8
```

## `div` <Badge type="tip" text="JavaScript" />
Expand All @@ -97,6 +97,6 @@ Returns after dividing all n arguments of numbers or the values of a single arra
### Examples

```javascript
_.div(10, 5, 2); // Returns 1
_.div([100, 2, 2, 5]); // Returns 5
div(10, 5, 2); // Returns 1
div([100, 2, 2, 5]); // Returns 5
```
Loading

0 comments on commit 53fcc51

Please sign in to comment.