Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "hexo-util in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'hexo-util' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

function renameFile(art, renamed) {

      var src = art.full_source;
      var newSrc = path.join(src.substr(0, src.lastIndexOf(path.sep)), slugize(renamed, {transform: 1}));

      // first the markdown file
      return fsRename(src, newSrc + '.md').then(function doRenameMd() {
        var fldr;

        console.log(chalk.red(src) + ' renamed to ' + chalk.green(newSrc) + '.md');

        fldr = src.substr(0, src.lastIndexOf('.'));

        // then the folder if it exists
        return fsStat(fldr).then(function doCheckDir(stats) {
          if (stats.isDirectory()) {
            return fsRename(fldr, newSrc).then(function doRenameDir() {
              console.log(chalk.underline('Asset folder renamed as well.'));
            });
          } else {
Post.prototype.publish = function(data, replace, callback) {
  if (!callback && typeof replace === 'function') {
    callback = replace;
    replace = false;
  }

  if (data.layout === 'draft') data.layout = 'post';

  const ctx = this.context;
  const { config } = ctx;
  const draftDir = join(ctx.source_dir, '_drafts');
  const slug = slugize(data.slug.toString(), {transform: config.filename_case});
  data.slug = slug;
  const regex = new RegExp(`^${escapeRegExp(slug)}(?:[^\\/\\\\]+)`);
  let src = '';
  const result = {};

  data.layout = (data.layout || config.default_layout).toLowerCase();

  // Find the draft
  return fs.listDir(draftDir).then(list => {
    return list.find(item => regex.test(item));
  }).then(item => {
    if (!item) throw new Error(`Draft "${slug}" does not exist.`);

    // Read the content
    src = join(draftDir, item);
    return fs.readFile(src);
const moment = require('moment-timezone');
const minimatch = require('minimatch');
const _ = require('lodash');

const DURATION_MINUTE = 1000 * 60;

function isTmpFile(path) {
  const last = path[path.length - 1];
  return last === '%' || last === '~';
}

function isHiddenFile(path) {
  return /(^|\/)[_\.]/.test(path); // eslint-disable-line no-useless-escape
}

exports.ignoreTmpAndHiddenFile = new Pattern(path => {
  if (isTmpFile(path) || isHiddenFile(path)) return false;
  return true;
});

exports.isTmpFile = isTmpFile;
exports.isHiddenFile = isHiddenFile;

exports.toDate = date => {
  if (!date || moment.isMoment(date)) return date;

  if (!(date instanceof Date)) {
    date = new Date(date);
  }

  if (isNaN(date.getTime())) return;
if (match[3]) {
            options.caption += `<a href="${match[3]}">${match[4] ? match[4] : 'link'}</a>`;
          }
        }
      }
    }

    // PR #3765
    if (start.includes('&gt;')) {
      const depth = start.split('&gt;').length - 1;
      const regexp = new RegExp(`^([^\\S\\r\\n]*&gt;){0,${depth}}([^\\S\\r\\n]|$)`, 'mg');
      const paddingOnEnd = ' '; // complement uncaptured whitespaces at last line
      content = (content + paddingOnEnd).replace(regexp, '').replace(/\n$/, '');
    }

    content = highlight(stripIndent(content), options)
      .replace(/{/g, '{')
      .replace(/}/g, '}');

    return `${start}${content}${end}`;
  });
}
return function imgTag(args, content) {
    const classes = [];
    let src, width, height, title, alt;

    // Find image URL and class name
    while (args.length > 0) {
      const item = args.shift();
      if (rUrl.test(item) || item[0] === '/') {
        src = url_for.call(ctx, item);
        break;
      } else {
        classes.push(item);
      }
    }

    // Find image width and height
    if (args && args.length) {
      if (!/\D+/.test(args[0])) {
        width = args.shift();

        if (args.length && !/\D+/.test(args[0])) {
          height = args.shift();
        }
      }
options = options || {};

  const min = options.min_font || 10;
  const max = options.max_font || 20;
  const orderby = options.orderby || 'name';
  const order = options.order || 1;
  const unit = options.unit || 'px';
  let color = options.color;
  const { transform } = options;
  const separator = options.separator || ' ';
  const result = [];
  let startColor, endColor;

  if (color) {
    startColor = new Color(options.start_color);
    endColor = new Color(options.end_color);

    if (!startColor || !endColor) color = false;
  }

  // Sort the tags
  if (orderby === 'random' || orderby === 'rand') {
    tags = tags.random();
  } else {
    tags = tags.sort(orderby, order);
  }

  // Limit the number of tags
  if (options.amount) {
    tags = tags.limit(options.amount);
  }
if (!tags || !tags.length) return '';
  options = options || {};

  const min = options.min_font || 10;
  const max = options.max_font || 20;
  const orderby = options.orderby || 'name';
  const order = options.order || 1;
  const unit = options.unit || 'px';
  let color = options.color;
  const { transform } = options;
  const separator = options.separator || ' ';
  const result = [];
  let startColor, endColor;

  if (color) {
    startColor = new Color(options.start_color);
    endColor = new Color(options.end_color);

    if (!startColor || !endColor) color = false;
  }

  // Sort the tags
  if (orderby === 'random' || orderby === 'rand') {
    tags = tags.random();
  } else {
    tags = tags.sort(orderby, order);
  }

  // Limit the number of tags
  if (options.amount) {
    tags = tags.limit(options.amount);
  }
}

        descriptions += util.htmlTag('div', { class: 'og-title' }, escapeHTML(ogp.ogTitle))

        // Description
        if (config.description && ogp.hasOwnProperty('ogDescription')) {
          let description = ogp.ogDescription

          if (description && description.length > config.descriptionLength) {
            description = description.slice(0, config.descriptionLength) + '…'
          }

          descriptions += util.htmlTag('div', { class: 'og-description' }, escapeHTML(description))
        }

        descriptions = util.htmlTag('div', { class: 'descriptions' }, descriptions)

        const tag = util.htmlTag('div', { class: 'link-area' }, image + descriptions)

        return util.htmlTag('a', { href: url, class: config.className, target: config.target, rel: config.rel }, tag)
      })
      .catch(function (error) {
hexo.extend.tag.register('issue', function (args) {
  // {% issue 74 'not currently supported' %}

  const num = args[0]

  const attrs = {
    href: `https://github.com/cypress-io/cypress/issues/${num}`,
    target: '_blank',
  }

  const text = args[1] || `issue #${num}`

  return util.htmlTag('a', attrs, text)
})
// Description
        if (config.description && ogp.hasOwnProperty('ogDescription')) {
          let description = ogp.ogDescription

          if (description && description.length > config.descriptionLength) {
            description = description.slice(0, config.descriptionLength) + '…'
          }

          descriptions += util.htmlTag('div', { class: 'og-description' }, escapeHTML(description))
        }

        descriptions = util.htmlTag('div', { class: 'descriptions' }, descriptions)

        const tag = util.htmlTag('div', { class: 'link-area' }, image + descriptions)

        return util.htmlTag('a', { href: url, class: config.className, target: config.target, rel: config.rel }, tag)
      })
      .catch(function (error) {

Is your System Free of Underlying Vulnerabilities?
Find Out Now