source: trip-planner-front/node_modules/lodash/_insertWrapDetails.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 748 bytes
Line 
1/** Used to match wrap detail comments. */
2var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
3
4/**
5 * Inserts wrapper `details` in a comment at the top of the `source` body.
6 *
7 * @private
8 * @param {string} source The source to modify.
9 * @returns {Array} details The details to insert.
10 * @returns {string} Returns the modified source.
11 */
12function insertWrapDetails(source, details) {
13 var length = details.length;
14 if (!length) {
15 return source;
16 }
17 var lastIndex = length - 1;
18 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
19 details = details.join(length > 2 ? ', ' : ' ');
20 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
21}
22
23module.exports = insertWrapDetails;
Note: See TracBrowser for help on using the repository browser.