Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ditojs/utils

Package Overview
Dependencies
Maintainers
2
Versions
424
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ditojs/utils - npm Package Compare versions

Comparing version
2.74.0
to
2.75.0
+2
-2
package.json
{
"name": "@ditojs/utils",
"version": "2.74.0",
"version": "2.75.0",
"type": "module",

@@ -42,3 +42,3 @@ "description": "Dito.js Utility Functions – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",

},
"gitHead": "26c5b4bd33d1bc469c8b621a214ae3c8f0927c11"
"gitHead": "cfc4ee21dc3f5808b5a78a3b1fab83500c05907a"
}

@@ -7,4 +7,6 @@ import { deprecate } from '../function/deprecate.js'

.toString()
.replace(/<br\/?>/gi, '\n')
.replace(/<br\s*\/?>/gi, '\n')
.replace(/<\/p>/gi, '\n')
.replace(/<[^>]+>/g, '')
.trim()
: ''

@@ -11,0 +13,0 @@ }

@@ -23,3 +23,16 @@ import { stripHtml } from './stripHtml.js'

expect(stripHtml('hello<br/>world')).toBe('hello\nworld')
expect(stripHtml('hello<br />world')).toBe('hello\nworld')
})
it('should convert <p> tags to line-breaks', () => {
expect(stripHtml('<p>First paragraph</p><p>Second paragraph</p>'))
.toBe('First paragraph\nSecond paragraph')
expect(stripHtml('<p>Only paragraph</p>'))
.toBe('Only paragraph')
})
it('should trim leading and trailing whitespace', () => {
expect(stripHtml(' <p>text</p> ')).toBe('text')
expect(stripHtml('<p> text </p>')).toBe('text')
})
})