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

@vuepress/shared-utils

Package Overview
Dependencies
Maintainers
7
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vuepress/shared-utils - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

types/deeplyParseHeaders.d 2.ts

24

lib/getPermalink.js

@@ -10,2 +10,24 @@ "use strict";

}
function toUtcTime(date) {
let year = 1970;
let month = 0;
let day = 1;
if (typeof date === 'string') {
const [yearStr, monthStr, dayStr] = date.split('-');
year = parseInt(yearStr, 10);
month = parseInt(monthStr, 10) - 1;
day = parseInt(dayStr, 10);
}
else if (date instanceof Date) {
// If `date` is an instance of Date,
// it's because it was parsed from the frontmatter
// by js-yaml, which always assumes UTC
return date.getTime();
}
return Date.UTC(year, month, day);
}
function addTzOffset(utc) {
const utcDate = new Date(utc);
return new Date(utc + utcDate.getTimezoneOffset() * 60 * 1000);
}
module.exports = function getPermalink({ pattern, slug, date, regularPath, localePath = '/' }) {

@@ -16,3 +38,3 @@ if (!pattern) {

slug = encodeURI(slug);
const d = new Date(date);
const d = addTzOffset(toUtcTime(date));
const year = d.getFullYear();

@@ -19,0 +41,0 @@ const iMonth = d.getMonth() + 1;

7

lib/slugify.js
"use strict";
// string.js slugify drops non ascii chars so we have to
// use a custom implementation here
const diacritics_1 = require("diacritics");
// eslint-disable-next-line no-control-regex
const rControl = /[\u0000-\u001f]/g;
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’–—<>,.?/]+/g;
const rCombining = /[\u0300-\u036F]/g;
module.exports = function slugify(str) {
return diacritics_1.remove(str)
// Split accented characters into components
return str.normalize('NFKD')
// Remove accents
.replace(rCombining, '')
// Remove control characters

@@ -11,0 +14,0 @@ .replace(rControl, '')

{
"name": "@vuepress/shared-utils",
"version": "1.5.3",
"version": "1.5.4",
"description": "shared-utils for vuepress",

@@ -34,3 +34,2 @@ "keywords": [

"chalk": "^2.3.2",
"diacritics": "^1.3.0",
"escape-html": "^1.0.3",

@@ -51,3 +50,3 @@ "fs-extra": "^7.0.1",

},
"gitHead": "94dfb757224173c2a2bfdeece6ca690e85036757"
"gitHead": "98086ad620d4ba51f08497acddad8ffc1fc1273c"
}
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