Last change
on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
536 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | /*
|
---|
3 | Copyright 2012-2015, Yahoo Inc.
|
---|
4 | Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
---|
5 | */
|
---|
6 | const path = require('path');
|
---|
7 |
|
---|
8 | module.exports = {
|
---|
9 | create(name, cfg) {
|
---|
10 | cfg = cfg || {};
|
---|
11 | let Cons;
|
---|
12 | try {
|
---|
13 | Cons = require(path.join(__dirname, 'lib', name));
|
---|
14 | } catch (e) {
|
---|
15 | if (e.code !== 'MODULE_NOT_FOUND') {
|
---|
16 | throw e;
|
---|
17 | }
|
---|
18 |
|
---|
19 | Cons = require(name);
|
---|
20 | }
|
---|
21 |
|
---|
22 | return new Cons(cfg);
|
---|
23 | }
|
---|
24 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.