Skip to content

Commit

Permalink
Remove type-detect dependency (#98)
Browse files Browse the repository at this point in the history
* update simple-assert

* remove type-detect in favor of function

* remove component.json

* simplify web test runner now that there are no commonjs deps
  • Loading branch information
koddsson authored Oct 25, 2023
1 parent b8c9954 commit 4e914be
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 62 deletions.
19 changes: 0 additions & 19 deletions component.json

This file was deleted.

18 changes: 17 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@
* MIT Licensed
*/

import type from 'type-detect';
function type(obj) {
if (typeof obj === 'undefined') {
return 'undefined';
}

if (obj === null) {
return 'null';
}

const stringTag = obj[Symbol.toStringTag];
if (typeof stringTag === 'string') {
return stringTag;
}
const sliceStart = 8;
const sliceEnd = -1;
return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);
}

function FakeMap() {
this._key = 'chai/deep-eql__' + Math.random() + Date.now();
Expand Down
31 changes: 10 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
"ecmaVersion": 2015
}
},
"dependencies": {
"type-detect": "^4.0.0"
},
"devDependencies": {
"@js-temporal/polyfill": "^0.4.3",
"@rollup/plugin-commonjs": "^24.1.0",
Expand All @@ -68,7 +65,7 @@
"lcov-result-merger": "^1.0.2",
"lodash.isequal": "^4.4.0",
"mocha": "^9.1.1",
"simple-assert": "^1.0.0"
"simple-assert": "^2.0.0"
},
"engines": {
"node": ">=6"
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'simple-assert';
import { assert } from 'simple-assert';
import eql, { MemoizeMap } from '../index.js';

function describeIf(condition) {
Expand Down
2 changes: 1 addition & 1 deletion test/new-ecmascript-types.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-eval */
import assert from 'simple-assert';
import { assert } from 'simple-assert';
import eql from '../index.js';
var emptyFunction = Function.prototype;
var symbolExists = typeof Symbol === 'function';
Expand Down
2 changes: 1 addition & 1 deletion test/temporal-types.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'simple-assert';
import { assert } from 'simple-assert';
import { Temporal } from '@js-temporal/polyfill';
import eql from '../index.js';

Expand Down
15 changes: 1 addition & 14 deletions web-test-runner.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
import { fromRollup } from '@web/dev-server-rollup';
import rollupCommonjs from '@rollup/plugin-commonjs';

const commonjs = fromRollup(rollupCommonjs);

export default {
mimeTypes: {
'**/*.cjs': '*.js',
},
nodeResolve: true,
files: [ 'test/*.{js,mjs}' ],
plugins: [
commonjs({
include: [ './index.js', './test/*.js', './node_modules/simple-assert/**/*', './node_modules/assertion-error/**/*', './node_modules/type-detect/**/*' ],
}),
],
files: ["test/*.{js,mjs}"]
};

0 comments on commit 4e914be

Please sign in to comment.