UNPKG

633 BJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 *
8 * @format
9 */
10'use strict';
11
12var createUserError = function createUserError(format) {
13 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14 args[_key - 1] = arguments[_key];
15 }
16
17 var index = 0;
18 var formatted = format.replace(/%s/g, function (match) {
19 return args[index++];
20 });
21 return new Error(formatted);
22};
23
24module.exports = {
25 createUserError: createUserError
26};
\No newline at end of file