Skip to content

Commit 4e914be

Browse files
authored
Remove type-detect dependency (#98)
* update simple-assert * remove type-detect in favor of function * remove component.json * simplify web test runner now that there are no commonjs deps
1 parent b8c9954 commit 4e914be

File tree

8 files changed

+32
-62
lines changed

8 files changed

+32
-62
lines changed

component.json

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

index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,23 @@
55
* MIT Licensed
66
*/
77

8-
import type from 'type-detect';
8+
function type(obj) {
9+
if (typeof obj === 'undefined') {
10+
return 'undefined';
11+
}
12+
13+
if (obj === null) {
14+
return 'null';
15+
}
16+
17+
const stringTag = obj[Symbol.toStringTag];
18+
if (typeof stringTag === 'string') {
19+
return stringTag;
20+
}
21+
const sliceStart = 8;
22+
const sliceEnd = -1;
23+
return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);
24+
}
925

1026
function FakeMap() {
1127
this._key = 'chai/deep-eql__' + Math.random() + Date.now();

package-lock.json

Lines changed: 10 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@
5151
"ecmaVersion": 2015
5252
}
5353
},
54-
"dependencies": {
55-
"type-detect": "^4.0.0"
56-
},
5754
"devDependencies": {
5855
"@js-temporal/polyfill": "^0.4.3",
5956
"@rollup/plugin-commonjs": "^24.1.0",
@@ -68,7 +65,7 @@
6865
"lcov-result-merger": "^1.0.2",
6966
"lodash.isequal": "^4.4.0",
7067
"mocha": "^9.1.1",
71-
"simple-assert": "^1.0.0"
68+
"simple-assert": "^2.0.0"
7269
},
7370
"engines": {
7471
"node": ">=6"

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import assert from 'simple-assert';
1+
import { assert } from 'simple-assert';
22
import eql, { MemoizeMap } from '../index.js';
33

44
function describeIf(condition) {

test/new-ecmascript-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-eval */
2-
import assert from 'simple-assert';
2+
import { assert } from 'simple-assert';
33
import eql from '../index.js';
44
var emptyFunction = Function.prototype;
55
var symbolExists = typeof Symbol === 'function';

test/temporal-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import assert from 'simple-assert';
1+
import { assert } from 'simple-assert';
22
import { Temporal } from '@js-temporal/polyfill';
33
import eql from '../index.js';
44

web-test-runner.config.mjs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
import { fromRollup } from '@web/dev-server-rollup';
2-
import rollupCommonjs from '@rollup/plugin-commonjs';
3-
4-
const commonjs = fromRollup(rollupCommonjs);
5-
61
export default {
7-
mimeTypes: {
8-
'**/*.cjs': '*.js',
9-
},
102
nodeResolve: true,
11-
files: [ 'test/*.{js,mjs}' ],
12-
plugins: [
13-
commonjs({
14-
include: [ './index.js', './test/*.js', './node_modules/simple-assert/**/*', './node_modules/assertion-error/**/*', './node_modules/type-detect/**/*' ],
15-
}),
16-
],
3+
files: ["test/*.{js,mjs}"]
174
};

0 commit comments

Comments
 (0)