* Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards. * * @param {String} namespaces * @api public
(namespaces)
| 2665 | * @api public |
| 2666 | */ |
| 2667 | function enable(namespaces) { |
| 2668 | createDebug.save(namespaces); |
| 2669 | createDebug.namespaces = namespaces; |
| 2670 | createDebug.names = []; |
| 2671 | createDebug.skips = []; |
| 2672 | var split = (typeof namespaces === 'string' ? namespaces : '').trim().replace(/\s+/g, ',').split(',').filter(Boolean); |
| 2673 | var _iterator = _createForOfIteratorHelper(split), |
| 2674 | _step; |
| 2675 | try { |
| 2676 | for (_iterator.s(); !(_step = _iterator.n()).done;) { |
| 2677 | var ns = _step.value; |
| 2678 | if (ns[0] === '-') { |
| 2679 | createDebug.skips.push(ns.slice(1)); |
| 2680 | } else { |
| 2681 | createDebug.names.push(ns); |
| 2682 | } |
| 2683 | } |
| 2684 | } catch (err) { |
| 2685 | _iterator.e(err); |
| 2686 | } finally { |
| 2687 | _iterator.f(); |
| 2688 | } |
| 2689 | } |
| 2690 | |
| 2691 | /** |
| 2692 | * Checks if the given string matches a namespace template, honoring |
nothing calls this directly
no test coverage detected