(attributeString: string)
| 49 | } |
| 50 | |
| 51 | function parseGitPatternAttribute(attributeString: string) { |
| 52 | // There are three kinds of attribute settings: |
| 53 | // - a key=val pair sets an attribute to a specific value |
| 54 | // - a key without a value and a leading hyphen sets an attribute to false |
| 55 | // - a key without a value and no leading hyphen sets an attribute |
| 56 | // to true |
| 57 | if (attributeString.includes('=')) { |
| 58 | return attributeString.split('='); |
| 59 | } |
| 60 | if (attributeString.startsWith('-')) { |
| 61 | return [attributeString.slice(1), false]; |
| 62 | } |
| 63 | return [attributeString, true]; |
| 64 | } |
| 65 | |
| 66 | const parseGitPatternAttributes = flow([ |
| 67 | (attributes: string[]) => attributes.map(parseGitPatternAttribute), |
nothing calls this directly
no outgoing calls
no test coverage detected