Sha256: f02c867615d805c1922f88c40904e2b5e0afdd41d22aac0668bbccb58bf997ec

Contents?: true

Size: 712 Bytes

Versions: 110

Compression:

Stored size: 712 Bytes

Contents

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]
  } else {
    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

Version data entries

110 entries across 26 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.62 node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.61 node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.60 node_modules/@babel/plugin-transform-classes/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.60 node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.60 node_modules/core-js-compat/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.60 node_modules/@babel/helper-define-polyfill-provider/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.60 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.60 node_modules/@babel/plugin-transform-object-rest-spread/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.59 node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.59 node_modules/@babel/helper-define-polyfill-provider/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.59 node_modules/core-js-compat/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.59 node_modules/@babel/plugin-transform-classes/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.59 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.59 node_modules/@babel/plugin-transform-object-rest-spread/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.58 node_modules/@babel/helper-define-polyfill-provider/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.58 node_modules/core-js-compat/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.58 node_modules/@babel/plugin-transform-classes/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.58 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.58 node_modules/update-browserslist-db/utils.js
immosquare-cleaner-0.1.58 node_modules/@babel/plugin-transform-object-rest-spread/node_modules/@babel/helper-compilation-targets/node_modules/browserslist/node_modules/update-browserslist-db/utils.js