How to use the slug.multicharmap function in slug

To help you get started, we’ve selected a few slug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github weeco / wrap-royale / src / utils / LocationHelper.ts View on Github external
slug: string;
}

/**
 * Helper class for retrieving locations by id or name
 */
export namespace LocationHelper {
  const locationById: Map = new Map();
  const locationBySlug: Map = new Map();
  const slugOptions: {} = {
    replacement: '-', // replace spaces with replacement
    symbols: true, // 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
  };

  // Add icon urls for all locations
  const cdnUrl: string = 'https://raw.githubusercontent.com/weeco/clash-royale-assets/master/images';
  // Load location object array into Map
  countriesJson.forEach((location: IApiLocation) => {
    const locationDetailed: ILocationDetails = {
      ...location,
      iconUrls: {
        large: `${cdnUrl}/clash-royale/locations/${location.countryCode}.png`
      },
      slug: slug(location.name, slugOptions)
    };

    locationById.set(location.id, locationDetailed);
    locationBySlug.set(locationDetailed.slug, locationDetailed);
github getgridea / gridea / src / helpers / slug.ts View on Github external
*/
slug.defaults.modes['rfc3986-non-unicode'] = {
  replacement: '-', // replace spaces with replacement
  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'

/**
 * Slugify 文本
 * @param textToSlugify 待 slugify 的文本
 * @param filenameMode
github GetPublii / Publii / app / back-end / helpers / slug.js View on Github external
const transliterate = require('transliteration').transliterate;
const slug = require('slug');

/*
 * Custom mode of rfc3986 without unicode symbols
 */
slug.defaults.modes['rfc3986-non-unicode'] = {
    replacement: '-',      // replace spaces with replacement
    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
github getgridea / gridea / src / helpers / slug.ts View on Github external
/* tslint:disable */
const { transliterate } = require('transliteration')
const slug = require('slug')

/*
 * Custom mode of rfc3986 without unicode symbols
 */
slug.defaults.modes['rfc3986-non-unicode'] = {
  replacement: '-', // replace spaces with replacement
  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
github GetPublii / Publii / app / back-end / helpers / slug.js View on Github external
*/
slug.defaults.modes['rfc3986-non-unicode'] = {
    replacement: '-',      // replace spaces with replacement
    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) {
github bipbop / harlan / src / plugins / lib / icheques / ban-factory.js View on Github external
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';

export class BANFactory {
    constructor(call, {values}, company) {
        this.call = call;
        this.checks = values;
        this.company = company;
github davidosomething / 16.davidosomething.com / lib / metalsmith-set-file-defaults / index.js View on Github external
*/
'use strict';

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,
github matchilling / org.programmingtalks.www / lib / intg / youtube / index.js View on Github external
function slugify(string) {
    return slug(string, {
        replacement: '-',
        symbols: true,
        lower: true,
        charmap: slug.charmap,
        multicharmap: slug.multicharmap
    });
}
github feross / studynotes.org / model / plugin.js View on Github external
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 })

  schema.pre('save', function (next) {
    this.modifyDate = new Date()
    next()
  })

  if (opts && opts.index) {
    schema.path('modifyDate').index(opts.index)

slug

slugifies even utf-8 chars!

MIT
Latest version published 1 month ago

Package Health Score

83 / 100
Full package analysis