main
Last change
on this file since d565449 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
|
Rev | Line | |
---|
[d565449] | 1 | /** Used to match wrap detail comments. */
|
---|
| 2 | var 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 | */
|
---|
| 12 | function 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 |
|
---|
| 23 | export default insertWrapDetails;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.