mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-13 14:18:26 +09:00
Extract hasDuplicates function
This commit is contained in:
parent
17c8969fd2
commit
b3455bf1cb
@ -4,6 +4,7 @@
|
|||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import validate from '../../validator';
|
import validate from '../../validator';
|
||||||
|
import hasDuplicates from '../../../common/has-duplicates';
|
||||||
import parse from '../../../common/text';
|
import parse from '../../../common/text';
|
||||||
import { Post, isValidText } from '../../models/post';
|
import { Post, isValidText } from '../../models/post';
|
||||||
import User from '../../models/user';
|
import User from '../../models/user';
|
||||||
@ -15,10 +16,6 @@ import notify from '../../common/notify';
|
|||||||
import event from '../../event';
|
import event from '../../event';
|
||||||
import config from '../../../conf';
|
import config from '../../../conf';
|
||||||
|
|
||||||
function hasDuplicates(array) {
|
|
||||||
return (new Set(array)).size !== array.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a post
|
* Create a post
|
||||||
*
|
*
|
||||||
|
1
src/common/has-duplicates.ts
Normal file
1
src/common/has-duplicates.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default (array: any[]) => (new Set(array)).size !== array.length;
|
Loading…
Reference in New Issue
Block a user