How to use the prune function from underscore.string

Find comprehensive JavaScript underscore.string.prune code examples handpicked from public code repositorys.

22
23
24
25
26
27
28
29
30
  config
);

const body = marked(content);
const title = meta.title ? meta.title : contentProcessors.slugToTitle(slug);
const excerpt = _s.prune(
  _s.stripTags(_s.unescapeHTML(body)),
  config.excerpt_length || 400
);
fork icon449
star icon0
watch icon0

81
82
83
84
85
86
87
88
89
90
91
92
exports.truncate = function(value, options, callback){
    callback(null, str.truncate(String(value), options[0], typeof options[1] === 'string' ? options[1] : undefined));
};


exports.prune = function(value, options, callback){
    callback(null, str.prune(String(value), options[0], typeof options[1] === 'string' ? options[1] : undefined));
};


exports.dateTransform = function(value, options, callback){
    var date = moment(value, options[0], true).format(options[1]);
fork icon2
star icon2
watch icon0

+ 2 other calls in file

25
26
27
28
29
30
31
32
33
34
    config
  );

  const body = marked(content);
  const title = meta.title ? meta.title : contentProcessors.slugToTitle(slug);
  const excerpt = _s.prune(_s.stripTags(_s.unescapeHTML(body)), (config.excerpt_length || 400));

  return { slug, title, body, excerpt };

} catch (e) {
fork icon0
star icon1
watch icon0

165
166
167
168
169
170
171
172
173
174

  return {
    slug    : slug,
    title   : meta.title ? meta.title : this.slugToTitle(slug),
    body    : html,
    excerpt : _s.prune(_s.stripTags(_s.unescapeHTML(html)), (this.config.excerpt_length || 400))
  };
} catch (e) {
  if (this.config.debug) { console.log(e); }
  return null;
fork icon0
star icon0
watch icon2

+ 21 other calls in file