diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-02 05:24:20 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-02 05:24:20 +0900 |
| commit | b3455bf1cb30beb46859345c482e6585845ca388 (patch) | |
| tree | 2446ae980f9ee9fde3489cd5ab2632de908014a5 /src | |
| parent | fix (diff) | |
| download | sharkey-b3455bf1cb30beb46859345c482e6585845ca388.tar.gz sharkey-b3455bf1cb30beb46859345c482e6585845ca388.tar.bz2 sharkey-b3455bf1cb30beb46859345c482e6585845ca388.zip | |
Extract hasDuplicates function
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/endpoints/posts/create.js | 5 | ||||
| -rw-r--r-- | src/common/has-duplicates.ts | 1 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/api/endpoints/posts/create.js b/src/api/endpoints/posts/create.js index 151938004d..92aeb3d08e 100644 --- a/src/api/endpoints/posts/create.js +++ b/src/api/endpoints/posts/create.js @@ -4,6 +4,7 @@ * Module dependencies */ import validate from '../../validator'; +import hasDuplicates from '../../../common/has-duplicates'; import parse from '../../../common/text'; import { Post, isValidText } from '../../models/post'; import User from '../../models/user'; @@ -15,10 +16,6 @@ import notify from '../../common/notify'; import event from '../../event'; import config from '../../../conf'; -function hasDuplicates(array) { - return (new Set(array)).size !== array.length; -} - /** * Create a post * diff --git a/src/common/has-duplicates.ts b/src/common/has-duplicates.ts new file mode 100644 index 0000000000..dd5e6759f1 --- /dev/null +++ b/src/common/has-duplicates.ts @@ -0,0 +1 @@ +export default (array: any[]) => (new Set(array)).size !== array.length; |