source: imaps-frontend/node_modules/lodash-es/_insertWrapDetails.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 746 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
23export default insertWrapDetails;
Note: See TracBrowser for help on using the repository browser.