Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rehype-attr

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-attr - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

2

lib/utils.d.ts
import { Comment, Literal, ElementContent, RootContent, Properties } from 'hast';
import { RehypeAttrsOptions } from './';
export declare const getURLParameters: (url: string) => Record<string, string | number | boolean>;
export declare const getURLParameters: (url?: string) => Record<string, string | number | boolean>;
export declare const prevChild: (data: Literal[] | undefined, index: number) => Comment | undefined;

@@ -5,0 +5,0 @@ export declare const nextChild: (data: RootContent[] | ElementContent[] | undefined, index: number, tagName?: string, codeBlockParames?: boolean) => ElementContent | undefined;

@@ -1,2 +0,2 @@

export const getURLParameters = (url) => (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce((a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), {});
export const getURLParameters = (url = '') => (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce((a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), {});
export const prevChild = (data = [], index) => {

@@ -32,4 +32,4 @@ let i = index;

return;
if (/^(comment|raw)$/ig.test(element?.type)) {
if (!/^rehype:/.test(element.value?.replace(/^(\s+)?<!--(.*?)-->/, '$2') || '')) {
if (element.type && /^(comment|raw)$/ig.test(element.type)) {
if (element.value && !/^rehype:/.test(element.value.replace(/^(\s+)?<!--(.*?)-->/, '$2') || '')) {
return;

@@ -36,0 +36,0 @@ }

{
"name": "rehype-attr",
"version": "2.1.2",
"version": "2.1.3",
"description": "New syntax to add attributes to Markdown.",

@@ -5,0 +5,0 @@ "homepage": "https://jaywcjlove.github.io/rehype-attr",

import { Element, Comment, Literal, ElementContent, RootContent, Properties } from 'hast';
import { RehypeAttrsOptions } from './';
export const getURLParameters = (url: string): Record<string, string | number | boolean> =>
(url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce(
(a: Record<string, string | number>, v: string) => (
(a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a
),
{},
);
export const getURLParameters = (url: string = '') =>
((url.match(/([^?=&]+)(=([^&]*))/g) || []) as string[]).reduce(
(a: Record<string, string | number | boolean>, v: string) => (
(a[v.slice(0, v.indexOf('=')) as keyof typeof a] = v.slice(v.indexOf('=') + 1)), a
),
{}
)

@@ -38,4 +38,4 @@ export const prevChild = (data: Literal[] = [], index: number): Comment | undefined => {

if (element.type === 'text' && element.value.replace(/(\n|\s)/g, '') !== '') return;
if (/^(comment|raw)$/ig.test(element?.type)) {
if (!/^rehype:/.test(element.value?.replace(/^(\s+)?<!--(.*?)-->/, '$2') || '')) {
if (element.type && /^(comment|raw)$/ig.test(element.type)) {
if (element.value && !/^rehype:/.test(element.value.replace(/^(\s+)?<!--(.*?)-->/, '$2') || '')) {
return

@@ -42,0 +42,0 @@ };

Sorry, the diff of this file is not supported yet

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