Skip to content

Commit

Permalink
Merge branch 'release/release/0.13.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Sep 12, 2023
2 parents 3a69383 + 3b9a8f5 commit bebf38b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeed",
"type": "module",
"version": "0.13.5",
"version": "0.13.6",
"description": "🌱 Simple foundation library",
"author": {
"name": "Dirk Holtwick",
Expand Down
12 changes: 6 additions & 6 deletions src/common/log/log-filter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// (C)opyright 2021-07-15 Dirk Holtwick, holtwick.it. All rights reserved.

import { LogLevelAll, LogLevelDebug, LogLevelError, LogLevelInfo, LogLevelOff, LogLevelWarn } from './log-base'
import { getNamespaceFilterString, joinLogStrings, parseLogLevel, useLevelFilter, useNamespaceFilter } from './log-filter'
import { getNamespaceFilterString, joinLogStrings, parseLogLevel, useLevelFilter, useNamespaceFilter } from './log-filter'

describe('log-filter', () => {
test('should match', () => {
Expand Down Expand Up @@ -108,9 +108,9 @@ describe('log-filter', () => {
})

it('should join strings', () => {
expect(joinLogStrings('test')).toMatchInlineSnapshot(['test'])
expect(joinLogStrings('test', 'more', 1,2,3)).toMatchInlineSnapshot(['test more',1,2,3])
expect(joinLogStrings('test', {a:1})).toMatchInlineSnapshot(['test', {a:1}])
expect(joinLogStrings('test', 'a', 'b', true, undefined, null, {a:1})).toMatchInlineSnapshot(['test a', 'b', true, undefined, null, {a:1}])
});
expect(joinLogStrings('test')).toEqual(['test'])
expect(joinLogStrings('test', 'more', 1, 2, 3)).toEqual(['test more', 1, 2, 3])
expect(joinLogStrings('test', { a: 1 })).toEqual(['test', { a: 1 }])
expect(joinLogStrings('test', 'a', 'b', true, undefined, null, { a: 1 })).toEqual(['test a', 'b', true, undefined, null, { a: 1 }])
})
})
8 changes: 4 additions & 4 deletions src/common/log/log-filter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// (C)opyright 2021-07-15 Dirk Holtwick, holtwick.it. All rights reserved.
/* eslint-disable n/prefer-global/process */

import { isPrimitive, isString } from '../data'
import { isString } from '../data'
import type { LogLevel, LogLevelAliasType } from './log-base'
import { LogLevelAlias, LogLevelAll, LogLevelOff } from './log-base'

Expand Down Expand Up @@ -136,9 +136,9 @@ export function useLevelFilter(
}

export function joinLogStrings(...messages: any[]) {
if (!isString(messages[1]))
return messages
return [`${String(messages[0])} ${String(messages[1])}`, ...messages.slice(2)]
if (isString(messages[1]))
return [`${String(messages[0])} ${String(messages[1])}`, ...messages.slice(2)]
return messages

// let s = ''
// for (let i = 0; i < messages.length; i++) {
Expand Down

0 comments on commit bebf38b

Please sign in to comment.