Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
symbols: false, // replace unicode symbols or not
remove: /[.]/g, // (optional) regex to remove characters
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.modes['rfc3986-non-unicode-with-dots'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.modes['rfc3986-non-unicode-with-dots-no-lower'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: false, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.mode = 'rfc3986-non-unicode';
function createSlug(textToSlugify, filenameMode = false, saveLowerChars = false) {
textToSlugify = transliterate(textToSlugify);
if(!filenameMode) {
if(saveLowerChars) {
slug.defaults.mode = 'rfc3986-non-unicode-with-dots-no-lower';
}
req.on("response", res => {
// Don't set up the pipe to the write stream unless the status is ok.
if (res.statusCode !== 200) {
return;
}
slug.defaults.mode = "rfc3986";
const secureFilename = `${new Date().getTime()}/${slug(objectName)}`;
// tslint:disable-next-line:no-console
const writeStream = bucket.file(secureFilename)
.createWriteStream({
// Tweak the config options as desired.
gzip: false,
public: true,
resumable: true,
metadata: {
contentType: res.headers["content-type"],
},
});
req.pipe(writeStream)
.on("finish", () => {
const bucketName = config.google.storage.bucket;
import jDataView from 'jdataview';
import { sprintf } from 'sprintf';
import { CMC7Parser } from './cmc7-parser';
import async from 'async';
import { CPF } from 'cpf_cnpj';
import { CNPJ } from 'cpf_cnpj';
import slug from 'slug';
slug.defaults.modes.pretty = {
replacement: ' ', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: false, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.mode ='pretty';
const NON_NUMERIC = /[\D]/g;
const NON_WORD = /[\W]/g;
const ROW_SIZE = 502;
const BAN_VERSION = '02.7';
const MAX_THREADS = 2;
const CRLF = '\r\n';
import Sequelize, { type Transaction } from 'sequelize';
import removeMarkdown from '@tommoor/remove-markdown';
import isUUID from 'validator/lib/isUUID';
import { Collection, User } from '../models';
import { DataTypes, sequelize } from '../sequelize';
import parseTitle from '../../shared/utils/parseTitle';
import unescape from '../../shared/utils/unescape';
import Revision from './Revision';
const Op = Sequelize.Op;
const Markdown = new MarkdownSerializer();
const URL_REGEX = /^[a-zA-Z0-9-]*-([a-zA-Z0-9]{10,15})$/;
const DEFAULT_TITLE = 'Untitled';
slug.defaults.mode = 'rfc3986';
const slugify = text =>
slug(text, {
remove: /[.]/g,
});
const createRevision = (doc, options = {}) => {
// we don't create revisions for autosaves
if (options.autosave) return;
// we don't create revisions if identical to previous
if (doc.text === doc.previous('text')) return;
return Revision.create(
{
title: doc.title,
text: doc.text,
var config = require('../config')
var mongoose = require('mongoose')
var slug = require('slug')
var util = require('../util')
var validate = require('mongoose-validator')
slug.defaults.mode = 'studynotes'
slug.defaults.modes.studynotes = {
replacement: '-',
symbols: true,
remove: /[.]/g,
lower: true,
charmap: slug.charmap,
multicharmap: slug.multicharmap
}
/**
* Mongoose plugins
*/
exports.modifyDate = function (schema, opts) {
schema.add({ modifyDate: Date })
router.get("/upload_policy", auth.mustBeLoggedIn, async (req, res) => {
try {
if (req.query && req.query.filename && req.query.type) {
slug.defaults.mode = "rfc3986";
const secureFilename = `${new Date().getTime()}/${slug(req.query.filename)}`;
const uploadUrl = await getSignedUrlForUpload(secureFilename, req.query.type);
const bucket = config.google.storage.bucket;
const publicFileUrl = `http://storage.googleapis.com/${bucket}/${secureFilename}`;
res.json({ uploadUrl, publicFileUrl });
} else {
throw new Error("No filename provided.");
}
} catch (err) {
logger.error("UploadPolicy Error: ", err);
res.sendStatus(403);
}
});
import React from 'react';
import consume from "pluginbot-react/dist/consume";
import slug from "slug";
slug.defaults.mode = "rfc3986";
let EmbeddableCard = function(props){
let {name, description, iconUrl, component, selected} = props;
return(
<div>
<img src="{iconUrl}/" alt="{`Get">
<span>{name}</span>
{/*<span>{description}</span>*/}
</div>
);
}
class Embeddables extends React.Component{
constructor(props){
super(props);
this.state = {
selected : (props.params && props.params.embedName) || "default"
constructor(...args) {
super(...args);
slug.defaults.mode = 'rfc3986';
this.opts = {
year: new Date().getFullYear()
};
}
function createSlug(textToSlugify, filenameMode = false, saveLowerChars = false) {
textToSlugify = transliterate(textToSlugify);
if(!filenameMode) {
if(saveLowerChars) {
slug.defaults.mode = 'rfc3986-non-unicode-with-dots-no-lower';
}
textToSlugify = slug(textToSlugify);
slug.defaults.mode = 'rfc3986-non-unicode';
} else {
slug.defaults.mode = 'rfc3986-non-unicode-with-dots';
textToSlugify = slug(textToSlugify);
slug.defaults.mode = 'rfc3986-non-unicode';
}
return textToSlugify;
}
const siteData = require('../site.js');
const util = require('util');
const debug = require('debug');
const defaultsDeep = require('lodash.defaultsdeep');
const slug = require('slug');
slug.defaults.modes['dkoslug'] = {
replacement: '-',
symbols: true,
remove: /[.]/g,
lower: true,
charmap: slug.charmap,
multicharmap: slug.multicharmap,
};
slug.defaults.mode = 'dkoslug';
/**
* Default widgets for each file type
* @constant
* @type {Object}
*/
const DEFAULT_WIDGETS = {
page: {
aboutMe: true,
allPosts: true,
},
post: {
sharePost: true,
aboutMe: true,
allPosts: true,