Skip to content

Commit

Permalink
remove
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Feb 20, 2024
1 parent 007d317 commit 523da37
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
1 change: 0 additions & 1 deletion benchmarks/cacheGetFieldValues.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { bench, group, run } from 'mitata'
import { getFieldValues } from '../lib/cache/util.js'

const values = [
'',
'foo',
'invälid',
'foo, '
Expand Down
6 changes: 0 additions & 6 deletions lib/cache/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,13 @@ function urlEquals (A, B, excludeFragment = false) {
return serializedA === serializedB
}

const emptyArray = Object.freeze([])

/**
* @see https://github.com/chromium/chromium/blob/694d20d134cb553d8d89e5500b9148012b1ba299/content/browser/cache_storage/cache_storage_cache.cc#L260-L262
* @param {string} header
*/
function getFieldValues (header) {
assert(header !== null)

if (header === '') {
return emptyArray
}

const values = []

for (let value of header.split(',')) {
Expand Down
3 changes: 1 addition & 2 deletions test/cache/get-field-values.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { deepStrictEqual, throws, strictEqual } = require('node:assert')
const { deepStrictEqual, throws } = require('node:assert')
const { test } = require('node:test')
const { getFieldValues } = require('../../lib/cache/util')

Expand All @@ -10,7 +10,6 @@ test('getFieldValues', () => {
message: 'The expression evaluated to a falsy value:\n\n assert(header !== null)\n'
})
deepStrictEqual(getFieldValues(''), [])
strictEqual(Object.isFrozen(getFieldValues('')), true)
deepStrictEqual(getFieldValues('foo'), ['foo'])
deepStrictEqual(getFieldValues('invälid'), [])
deepStrictEqual(getFieldValues('foo, bar'), ['foo', 'bar'])
Expand Down

0 comments on commit 523da37

Please sign in to comment.