forked from zoltantothcom/Design-Patterns-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
59 lines (54 loc) · 1.57 KB
/
index.js
File metadata and controls
59 lines (54 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import ABSTRACT_FACTORY from './creational_abstractFactory';
import BUILDER from './creational_builder';
import FACTORY from './creational_factory';
import PROTOTYPE from './creational_prototype';
import SINGLETON from './creational_singleton';
import ADAPTER from './structural_adapter';
import BRIDGE from './structural_bridge';
import COMPOSITE from './structural_composite';
import DECORATOR from './structural_decorator';
import FACADE from './structural_facade';
import FLYWEIGHT from './structural_flyweight';
import PROXY from './structural_proxy';
import CHAIN_OF_RESPONSIBILITY from './behavioral_chainOfResponsibility';
import COMMAND from './behavioral_command';
import INTERPRETER from './behavioral_interpreter';
import ITERATOR from './behavioral_iterator';
import MEDIATOR from './behavioral_mediator';
import MEMENTO from './behavioral_memento';
import OBSERVER from './behavioral_observer';
import STATE from './behavioral_state';
import STRATEGY from './behavioral_strategy';
import TEMPLATE from './behavioral_template';
import VISITOR from './behavioral_visitor';
export const patterns = [
ABSTRACT_FACTORY,
BUILDER,
FACTORY,
PROTOTYPE,
SINGLETON,
ADAPTER,
BRIDGE,
COMPOSITE,
DECORATOR,
FACADE,
FLYWEIGHT,
PROXY,
CHAIN_OF_RESPONSIBILITY,
COMMAND,
INTERPRETER,
ITERATOR,
MEDIATOR,
MEMENTO,
OBSERVER,
STATE,
STRATEGY,
TEMPLATE,
VISITOR
];
const mixed = [...patterns];
for (let i = mixed.length - 1; i > 0; i--) {
const rand = Math.floor(Math.random() * (i + 1));
[mixed[i], mixed[rand]] = [mixed[rand], mixed[i]];
}
export default mixed;