Permalink
Cannot retrieve contributors at this time
22 lines (17 sloc)
689 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/update-browserslist-db/utils.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { EOL } = require('os') | |
const getFirstRegexpMatchOrDefault = (text, regexp, defaultValue) => { | |
regexp.lastIndex = 0 // https://stackoverflow.com/a/11477448/4536543 | |
let match = regexp.exec(text) | |
if (match !== null) return match[1] | |
return defaultValue | |
} | |
const DEFAULT_INDENT = ' ' | |
const INDENT_REGEXP = /^([ \t]+)[^\s]/m | |
module.exports.detectIndent = text => | |
getFirstRegexpMatchOrDefault(text, INDENT_REGEXP, DEFAULT_INDENT) | |
module.exports.DEFAULT_INDENT = DEFAULT_INDENT | |
const DEFAULT_EOL = EOL | |
const EOL_REGEXP = /(\r\n|\n|\r)/g | |
module.exports.detectEOL = text => | |
getFirstRegexpMatchOrDefault(text, EOL_REGEXP, DEFAULT_EOL) | |
module.exports.DEFAULT_EOL = DEFAULT_EOL |