| /* |
| * Licensed to the Apache Software Foundation (ASF |
| * or more contributor license agreements. See th |
| * distributed with this work for additional infor |
| * regarding copyright ownership. The ASF license |
| * to you under the Apache License, Version 2.0 (t |
| * "License"); you may not use this file except in |
| * with the License. You may obtain a copy of the |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to |
| * software distributed under the License is distr |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS |
| * KIND, either express or implied. See the Licen |
| * specific language governing permissions and lim |
| * under the License. |
| */ |
| |
| // Strips the license header. |
| // Basically only the first multi-line comment up to to the closing */ |
| module.exports = function stripHeader(contents, fileName) { |
| var ls = contents.split(/\r?\n/); |
| while (ls[0]) { |
| if (ls[0].match(/^\s*\/\*/) || ls[0].match(/^\s*\*/)) { |
| ls.shift(); |
| } |
| else if (ls[0].match(/^\s*\*\//)) { |
| ls.shift(); |
| break; |
| } |
| else { |
| console.log("WARNING: file name " + fileName + " is missing the license header"); |
| break; |
| } |
| } |
| return ls.join('\n'); |
| } |