PHP 7.4.33
Preview: addParamsToDefineCall.js.flow Size: 856 B
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/metro-transform-plugins/src/addParamsToDefineCall.js.flow
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict
 * @format
 * @oncall react_native
 */

'use strict';

/**
 * Simple way of adding additional parameters to the end of the define calls.
 *
 * This is used to add extra information to the generaic compiled modules (like
 * the dependencyMap object or the list of inverse dependencies).
 */
function addParamsToDefineCall(
  code: string,
  ...paramsToAdd: Array<mixed>
): string {
  const index = code.lastIndexOf(')');
  const params = paramsToAdd.map(param =>
    param !== undefined ? JSON.stringify(param) : 'undefined',
  );

  return code.slice(0, index) + ',' + params.join(',') + code.slice(index);
}

module.exports = addParamsToDefineCall;

Directory Contents

Dirs: 1 × Files: 14
Name Size Perms Modified Actions
utils DIR
- drwxr-xr-x 2025-03-28 11:04:32
Edit Download
338 B lrw-r--r-- 2025-03-28 11:04:32
Edit Download
856 B lrw-r--r-- 2025-03-28 11:04:32
Edit Download
3.48 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
5.54 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
13.30 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
17.52 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
840 B lrw-r--r-- 2025-03-28 11:04:32
Edit Download
2.24 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
3.75 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
4.89 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
10.57 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
14.37 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
2.40 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
3.65 KB lrw-r--r-- 2025-03-28 11:04:32
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).