New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@heliosgraphics/utils

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@heliosgraphics/utils - npm Package Compare versions

Comparing version 5.3.4 to 5.3.5

18

index.ts

@@ -1,9 +0,9 @@

export { getClasses } from './classnames'
export { copyValue } from './clipboard'
export { hexToRgb, rgbToHex } from './colors'
export { debounce } from './debounce'
export { getSlug } from './slug'
export { sanitizeText, removeMarkdown, middleEllipsis, removeNewlines } from './strings'
export { throttle } from './throttle'
export { isUUID, getUUID } from './uuid'
export { validateUrl, validateEmail } from './validations'
export { getClasses } from "./classnames"
export { copyValue } from "./clipboard"
export { hexToRgb, rgbToHex } from "./colors"
export { debounce } from "./debounce"
export { getSlug } from "./slug"
export { sanitizeText, removeMarkdown, middleEllipsis, removeNewlines } from "./strings"
export { throttle } from "./throttle"
export { isUUID, getUUID } from "./uuid"
export { validateUrl, validateEmail } from "./validations"
{
"name": "@heliosgraphics/utils",
"version": "5.3.4",
"version": "5.3.5",
"type": "module",

@@ -5,0 +5,0 @@ "author": "03b8 <03b8@helios.graphics>",

@@ -14,4 +14,6 @@ import { it, describe, expect } from "vitest"

it("removes a bold format", () => expect(removeMarkdown("a **bold** text")).toEqual("a bold text"))
it("removes a link but keeps the name", () => expect(removeMarkdown("a [link](https://x.com) hello")).toEqual("a link hello"))
it("removes a bold link", () => expect(removeMarkdown("a [bold **link**](https://x.com) hello")).toEqual("a bold link hello"))
it("removes a link but keeps the name", () =>
expect(removeMarkdown("a [link](https://x.com) hello")).toEqual("a link hello"))
it("removes a bold link", () =>
expect(removeMarkdown("a [bold **link**](https://x.com) hello")).toEqual("a bold link hello"))
})

@@ -22,2 +24,3 @@

it("works with longer word", () => expect(middleEllipsis("lorem ipsum dolor", 12)).toEqual("lore...olor"))
it("return too short text as is", () => expect(middleEllipsis("short", 12)).toEqual("short"))
it("fails silently for undefined", () => expect(middleEllipsis(<any>null, 12)).toEqual(""))

@@ -28,4 +31,6 @@ })

it("removes no newline", () => expect(removeNewlines("first line same line")).toEqual("first line same line"))
it("removes newline", () => expect(removeNewlines("first line\n\n\nsecond line\n")).toEqual("first line second line"))
it("removes r newline", () => expect(removeNewlines("first line\r\n\nsecond line\n")).toEqual("first line second line"))
it("removes newline", () =>
expect(removeNewlines("first line\n\n\nsecond line\n")).toEqual("first line second line"))
it("removes r newline", () =>
expect(removeNewlines("first line\r\n\nsecond line\n")).toEqual("first line second line"))
it("removes t newline", () => expect(removeNewlines("first line\tsecond line\n")).toEqual("first line second line"))

@@ -32,0 +37,0 @@ it("removes only a newline", () => expect(removeNewlines("\r")).toEqual(""))

@@ -51,5 +51,7 @@ import xss from "xss"

const diff: number = Math.floor((length - 3) / 2)
const isValid: boolean = Boolean(!!text && typeof text === "string" && text.length > length)
const isValid: boolean = Boolean(!!text && typeof text === "string")
const isTooShort: boolean = isValid && text.length > length
if (!isValid) return ""
if (!isTooShort) return text

@@ -61,3 +63,3 @@ return text.substring(0, diff) + "..." + text.substring(text.length - diff, text.length)

export const removeNewlines = (text?: string | null, limit?: number): string => {
if (!text || typeof text !== 'string') return ""
if (!text || typeof text !== "string") return ""

@@ -64,0 +66,0 @@ const limitEnd: number = limit ?? text.length ?? 0

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc