diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..11ed0fa --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,11 @@ +module.exports = { + env: { + es2023: true, + node: true, + mocha: true + }, + extends: ['semistandard', 'eslint:recommended'], + rules: { + complexity: ['error', 13] // eventually get down to 10 or less + } +}; diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a0fed21 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ + +name: Node.js CI +on: push +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - name: Run tests + run: npx nyc@latest --reporter=lcov npm test + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 656402b..d8ef0ce 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /lib-cov/ /node_modules/ /npm-debug.log +.idea diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..5015c5f --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +package-lock=false +//registry.npmjs.org/:_authToken=${NPM_TOKEN} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2d26206..0000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - 0.6 diff --git a/lib/dotaccess.js b/lib/dotaccess.js index bbfcfef..72fa88b 100644 --- a/lib/dotaccess.js +++ b/lib/dotaccess.js @@ -1,44 +1,40 @@ -module.exports.set = set -module.exports.unset = unset -module.exports.get = get +module.exports.set = set; +module.exports.unset = unset; +module.exports.get = get; -function parts(key) { - if (Array.isArray(key)) return key - return key.split('.') +function parts (key) { + if (Array.isArray(key)) return key; + return key.split('.'); } -function lookup(obj, key) { - key = parts(key) - var lastKey = key.pop() - for (var i=0, l=key.length; i