Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: chaijs/loupe
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.3.6
Choose a base ref
...
head repository: chaijs/loupe
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 8,596 additions and 13,328 deletions.
  1. +18 −0 .github/renovate.json
  2. +48 −113 .github/workflows/build.yml
  3. +0 −13 .github/workflows/commitlint.yml
  4. +27 −0 .github/workflows/publish.yml
  5. +1 −0 .gitignore
  6. +2 −2 bench/index.js
  7. +0 −3 commitlint.config.js
  8. +47 −0 eslint.config.js
  9. +0 −17 karma.conf.js
  10. +0 −7 lib/arguments.js
  11. +0 −7 lib/bigint.js
  12. +0 −10 lib/function.js
  13. +0 −27 lib/map.js
  14. +0 −16 lib/set.js
  15. +3 −0 mod.ts
  16. +8,030 −12,758 package-lock.json
  17. +28 −96 package.json
  18. +0 −46 rollup.conf.js
  19. +8 −0 src/arguments.ts
  20. +5 −4 lib/array.js → src/array.ts
  21. +8 −0 src/bigint.ts
  22. +5 −5 lib/class.js → src/class.ts
  23. +3 −2 lib/date.js → src/date.ts
  24. +11 −4 lib/error.js → src/error.ts
  25. +14 −0 src/function.ts
  26. +48 −26 lib/helpers.js → src/helpers.ts
  27. +12 −9 lib/html.js → src/html.ts
  28. +51 −74 index.js → src/index.ts
  29. +25 −0 src/map.ts
  30. +4 −3 lib/number.js → src/number.ts
  31. +8 −7 lib/object.js → src/object.ts
  32. +5 −2 lib/promise.js → src/promise.ts
  33. +3 −2 lib/regexp.js → src/regexp.ts
  34. +17 −0 src/set.ts
  35. +10 −5 lib/string.js → src/string.ts
  36. +1 −1 lib/symbol.js → src/symbol.ts
  37. +19 −7 lib/typedarray.js → src/typedarray.ts
  38. +15 −0 src/types.ts
  39. +1 −1 test/acceptance.js
  40. +1 −2 test/arguments.js
  41. +1 −1 test/arrays.js
  42. +1 −1 test/bigints.js
  43. +1 −1 test/booleans.js
  44. +1 −2 test/buffers.js
  45. +1 −1 test/class.js
  46. +1 −1 test/dates.js
  47. +15 −1 test/errors.js
  48. +31 −2 test/functions.js
  49. +2 −2 test/html.js
  50. +0 −25 test/index.js
  51. +5 −1 test/maps.js
  52. +1 −1 test/null.js
  53. +1 −1 test/numbers.js
  54. +1 −1 test/objects.js
  55. +1 −3 test/promises.js
  56. +1 −1 test/regexps.js
  57. +1 −1 test/sets.js
  58. +20 −1 test/strings.js
  59. +1 −2 test/symbols.js
  60. +1 −7 test/typed-arrays.js
  61. +1 −1 test/undefined.js
  62. +1 −1 test/weakmaps.js
  63. +1 −1 test/weaksets.js
  64. +19 −0 tsconfig.json
  65. +9 −0 web-test-runner.config.js
18 changes: 18 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"packageRules": [
{
"groupName": "dependencies",
"matchUpdateTypes": [
"minor",
"patch"
],
"schedule": [
"before 9am on monday"
]
}
]
}
161 changes: 48 additions & 113 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -4,140 +4,75 @@ on:
pull_request:
push:
branches:
- master
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm i
- name: Run lint step
run: npm run lint
- name: Checkout the project
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install dependencies
run: npm i
- name: Run lint step
run: npm run lint

test-node:
name: Test on Node.js
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 10.x # to be removed 2021-04-01
- 12.x # to be removed 2022-04-30
- x.x.x # safety net; don't remove
- 18.x # to be removed 2025-04-30
- 20.x # to be removed 2026-04-30
- 21.x # to be removed 2024-06-01
- 22.x
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:node
- name: Checkout the project
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:node

test-linux-browsers:
name: Test on Linux Firefox & Chrome
runs-on: ubuntu-latest
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm i
- name: Setup Headless Environment
run: sudo apt-get install xvfb
- name: Run Node.js Tests
run: xvfb-run --auto-servernum npm run test:browser -- --browsers Chrome,Firefox
- name: Upload coverage
if: success()
uses: codecov/codecov-action@v1
- name: Cleanup Headless Environment
run: |
xvfb_pids=`ps aux | grep tmp/xvfb-run | grep -v grep | awk '{print $2}'`
if [ "$xvfb_pids" != "" ]; then
echo "Killing the following xvfb processes: $xvfb_pids"
sudo kill $xvfb_pids
else
echo "No xvfb processes to kill"
fi
- name: Checkout the project
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser
- name: Upload coverage
if: success()
uses: codecov/codecov-action@v5

test-windows-browsers:
name: Test on Windows Firefox, Chrome & Edge
runs-on: windows-latest
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: $APP_DATA/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser -- --browsers Chrome,Firefox,IE

release:
name: Publish a Release
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: [lint, test-node, test-linux-browsers]
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm i
- name: Run Semantic Release
run: npx semantic-release
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.github_token}}
- name: Checkout the project
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser
13 changes: 0 additions & 13 deletions .github/workflows/commitlint.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/
cache: npm
- run: npm ci
- run: npm test
- run: npm version ${TAG_NAME} --git-tag-version=false
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- run: npm whoami; npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -8,3 +8,4 @@ npm-debug.log
loupe.test.js
loupe.js
.nyc_output/
lib/
4 changes: 2 additions & 2 deletions bench/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import loupe from '../index'
import loupe from '../index.js'
import { inspect as nodeInspect } from 'util'
import Benchmark from 'benchmark'
const benches = []
const mapObjRefA = {}
const mapObjRefB = {}
function getArguments() {
return arguments // eslint-disable-line prefer-rest-params
return arguments
}
class A {}
const fixtures = {
3 changes: 0 additions & 3 deletions commitlint.config.js

This file was deleted.

47 changes: 47 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import eslintjs from '@eslint/js'
import prettier from 'eslint-plugin-prettier/recommended'

const { configs: eslintConfigs } = eslintjs

export default [
{
ignores: ['lib/', 'loupe.js'],
},
eslintConfigs['recommended'],
prettier,
{
languageOptions: {
globals: {
Buffer: false,
process: false,
document: false,
window: false,
global: false,
HTMLElement: false,
},
},
rules: {
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
{
files: ['test/*', 'bench/*'],
languageOptions: {
// if we ever use more globals than this, pull in the `globals` package
globals: {
Buffer: false,
process: false,
console: false,
describe: false,
beforeEach: false,
it: false,
},
},
},
]
17 changes: 0 additions & 17 deletions karma.conf.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/arguments.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/bigint.js

This file was deleted.

10 changes: 0 additions & 10 deletions lib/function.js

This file was deleted.

27 changes: 0 additions & 27 deletions lib/map.js

This file was deleted.

Loading