Skip to content

Commit 3d66f0c

Browse files
committed
remove CommonJS build.. update CI
1 parent 28e66ae commit 3d66f0c

7 files changed

Lines changed: 35 additions & 153 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ jobs:
2222
node-version: [12, 14, 16, 18, 20, 22, 24, 25]
2323

2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v6
2626
with:
2727
persist-credentials: false
2828
- name: Use Node.js ${{ matrix.node-version }}
29-
uses: actions/setup-node@v4
29+
uses: actions/setup-node@v6
3030
with:
3131
node-version: ${{ matrix.node-version }}
3232
cache: 'npm'
3333
- run: npm install
3434
- run: npm i -g @75lb/nature
35-
- run: npm run test:ci
35+
- run: npm run test
3636
# env:
3737
# FORCE_COLOR: 3

.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

LICENSE renamed to LICENCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The MIT License (MIT)
1+
The MIT Licence (MIT)
22

33
Copyright (c) 2015-26 Lloyd Brookes <opensource@75lb.com>
44

dist/index.cjs

Lines changed: 0 additions & 60 deletions
This file was deleted.

index.mjs

Lines changed: 0 additions & 64 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"url": "git+https://github.com/75lb/array-back.git"
99
},
1010
"license": "MIT",
11-
"exports": {
12-
"import": "./index.js",
13-
"require": "./dist/index.cjs"
14-
},
11+
"exports": "./index.js",
1512
"type": "module",
1613
"keywords": [
1714
"to",
@@ -24,15 +21,11 @@
2421
"node": ">=12.17"
2522
},
2623
"files": [
27-
"index.js",
28-
"index.mjs",
29-
"dist"
24+
"index.js"
3025
],
3126
"scripts": {
32-
"test": "npm run dist && npm run test:ci",
33-
"test:ci": "75lb-nature test-runner test.js",
34-
"docs": "75lb-nature jsdoc2md -t README.hbs index.js > README.md",
35-
"dist": "75lb-nature cjs-build index.js"
27+
"test": "75lb-nature test-runner test.js",
28+
"docs": "75lb-nature jsdoc2md -t README.hbs index.js > README.md"
3629
},
3730
"devDependencies": {}
3831
}

test.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,46 @@
1-
import arrayify from 'array-back'
1+
import arrayBack from 'array-back'
22
import { strict as a } from 'assert'
33

44
const [test, only, skip] = [new Map(), new Map(), new Map()]
55

6-
test.set('if already array, do nothing', function () {
6+
test.set('if already an array, do nothing', function () {
77
const arr = [1, 2, 3]
8-
const result = arrayify(arr)
8+
const result = arrayBack(arr)
99
a.equal(arr, result)
1010
})
1111

12-
test.set('arrayify()', function () {
13-
a.deepEqual(arrayify(undefined), [])
14-
a.deepEqual(arrayify(null), [null])
15-
a.deepEqual(arrayify(0), [0])
16-
a.deepEqual(arrayify([1, 2]), [1, 2])
17-
a.deepEqual(arrayify(new Set([1, 2])), [1, 2])
12+
test.set('if already an array-like, leave items untouched', function () {
13+
function testFn () {
14+
return arrayBack(arguments)
15+
}
16+
const result = testFn(undefined)
17+
a.deepEqual(result, [undefined])
18+
})
19+
20+
test.set('arrayBack()', function () {
21+
a.deepEqual(arrayBack(undefined), [])
22+
a.deepEqual(arrayBack(null), [null])
23+
a.deepEqual(arrayBack(0), [0])
24+
a.deepEqual(arrayBack([1, 2]), [1, 2])
25+
a.deepEqual(arrayBack(new Set([1, 2])), [1, 2])
1826

1927
function func () {
20-
a.deepEqual(arrayify(arguments), [1, 2, 3])
28+
a.deepEqual(arrayBack(arguments), [1, 2, 3])
2129
}
2230
func(1, 2, 3)
2331

24-
a.deepEqual(arrayify({ one: 1 }), [{ one: 1 }])
32+
a.deepEqual(arrayBack({ one: 1 }), [{ one: 1 }])
2533
const map = new Map()
2634
map.set('one', 1)
2735
map.set('two', 2)
28-
a.deepEqual(arrayify(map), [map])
36+
a.deepEqual(arrayBack(map), [map])
37+
})
38+
39+
test.set('empty arguments should return an empty array', async function () {
40+
function testFn () {
41+
return arrayBack(arguments)
42+
}
43+
a.deepEqual(testFn(), [])
2944
})
3045

3146
export { test, only, skip }

0 commit comments

Comments
 (0)