Skip to content

Commit 8c66726

Browse files
committed
init
1 parent cef9ae8 commit 8c66726

File tree

6 files changed

+49
-12
lines changed

6 files changed

+49
-12
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
## 1.0.0
44

5-
`2021.xx.xx`
5+
`2021.05.28`
66

77
🎉 Init

README.md

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
1-
# Ts Template
1+
# Random Smiley
22

3-
xxxx
3+
Randomly get smiley emojis.
4+
5+
## Usage
6+
7+
```bash
8+
yarn add random-smiley
9+
10+
# or
11+
12+
npm i random-smiley
13+
```
14+
15+
```ts
16+
import randomSmiley from 'random-smiley';
17+
18+
randomSmiley();
19+
randomSmiley(3);
20+
```
21+
22+
```js
23+
const randomSmiley = require(random-smiley);
24+
25+
randomSmiley();
26+
randomSmiley(3);
27+
```
428

529
## Changelog
630

package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": false,
3-
"name": "xx",
3+
"name": "random-smiley",
44
"version": "0.0.1",
55
"scripts": {
66
"build": "father-build",
@@ -14,13 +14,14 @@
1414
"typings": "dist/index.d.ts",
1515
"repository": {
1616
"type": "git",
17-
"url": "https://github.com/ant-js/ts",
17+
"url": "https://github.com/ant-js/random-smiley",
1818
"branch": "main"
1919
},
2020
"author": "xrkffgg",
21-
"homepage": "https://github.com/ant-js/ts",
21+
"homepage": "https://github.com/ant-js/random-smiley",
2222
"keywords": [
23-
"ts"
23+
"ts",
24+
"emoji"
2425
],
2526
"files": [
2627
"dist",
@@ -29,9 +30,11 @@
2930
],
3031
"license": "MIT",
3132
"dependencies": {
32-
"@babel/runtime": "^7.12.5"
33+
"@babel/runtime": "^7.12.5",
34+
"lodash": "^4.17.21"
3335
},
3436
"devDependencies": {
37+
"@types/lodash": "^4.14.170",
3538
"@umijs/fabric": "^2.2.2",
3639
"eslint": "^7.15.0",
3740
"father-build": "^1.17.2",

src/emojis.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const SMILEY_EMOJIS = [
2+
'😀','😃','😄','😁','😆','😅','😂','🤣','🥲','☺️','😊','😇','🙂','🙃','😉','😌','😍','🥰','😘','😗','😙','😚','😋','😛','😝','😜','🤪','🤨','🧐','🤓','😎','🥸','🤩','🥳','😏','😒','😞','😔','😟','😕','🙁','☹️','😣','😖','😫','😩','🥺','😢','😭','😤','😠','😡','🤬','🤯','😳','🥵','🥶','😱','😨','😰','😥','😓','🤗','🤔','🤭','🤫','🤥','😶','😐','😑','😬','🙄','😯','😦','😧','😮','😲','🥱','😴','🤤','😪','😵','🤐','🥴','🤢','🤮','🤧','😷','🤒','🤕','🤑','🤠','👽','👾','🤖','🎃',
3+
];
4+
5+
export default SMILEY_EMOJIS;

src/index.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
const A: string = 'A';
1+
import sampleSize from 'lodash/sampleSize';
2+
import SMILEY_EMOJIS from './emojis';
23

3-
export default A;
4+
const randomSmiley = (c: number = 1) => {
5+
return sampleSize(SMILEY_EMOJIS, c)
6+
};
7+
8+
export default randomSmiley;

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"target": "esnext",
4-
"module": "esnext",
3+
"target": "es6",
4+
"lib": ["dom", "es2017"],
55
"moduleResolution": "node",
66
"importHelpers": true,
77
"jsx": "react",

0 commit comments

Comments
 (0)