Skip to content

Commit 73b2ccb

Browse files
committed
ts: lib/config/utils.js
1 parent 8c4be5a commit 73b2ccb

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
1-
'use strict'
1+
import * as fs from "fs";
2+
import * as path from "path";
23

3-
const fs = require('fs')
4-
const path = require('path')
5-
6-
exports.toBooleanConfig = function toBooleanConfig (configValue) {
4+
export function toBooleanConfig(configValue) {
75
if (configValue && typeof configValue === 'string') {
86
return (configValue === 'true')
97
}
108
return configValue
119
}
1210

13-
exports.toArrayConfig = function toArrayConfig (configValue, separator = ',', fallback) {
11+
export function toArrayConfig(configValue, separator = ',', fallback) {
1412
if (configValue && typeof configValue === 'string') {
1513
return (configValue.split(separator).map(arrayItem => arrayItem.trim()))
1614
}
1715
return fallback
1816
}
1917

20-
exports.toIntegerConfig = function toIntegerConfig (configValue) {
18+
export function toIntegerConfig(configValue) {
2119
if (configValue && typeof configValue === 'string') {
2220
return parseInt(configValue)
2321
}
2422
return configValue
2523
}
2624

27-
exports.getGitCommit = function getGitCommit (repodir) {
25+
export function getGitCommit(repodir) {
2826
if (!fs.existsSync(repodir + '/.git/HEAD')) {
2927
return undefined
3028
}
@@ -37,7 +35,7 @@ exports.getGitCommit = function getGitCommit (repodir) {
3735
return reference
3836
}
3937

40-
exports.getGitHubURL = function getGitHubURL (repo, reference) {
38+
export function getGitHubURL(repo, reference) {
4139
// if it's not a github reference, we handle handle that anyway
4240
if (!repo.startsWith('https://github.com') && !repo.startsWith('git@github.com')) {
4341
return repo

0 commit comments

Comments
 (0)