New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

clutter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clutter

A tiny string generator/manipulation/mess toolkit for a javascript.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Clutter

Installation

npm install clutter

Then

import c from 'clutter';

or

var c = require('clutter');
Browser
<script src='lib/clutter.js'></script>

exposed as window.c

Usage

Available methods

  • random
  • replace
  • every
  • after
  • add
  • times
  • shuffle

random

c('{1|2|3|4|5}{1|2|3|4|5}{1|2|3|4|5}').random().val;
// => '245'

// Nesting supported
c('{1|2|3{a|b|c}}').random().val;
// => '3d'

replace

let str = c('testing').replace({
   't': '{ƭ|t}', 
   'e': '{è|É|e}',
   's': '{ƨ|§|s}',
   'i': '{ï|Ì|i|1}',
   'n': '{ñ|n}',
   'g': '{ϱ|g}'
}).val
// => '{ƭ|t}{è|É|e}{ƨ|§|s}{ƭ|t}{ï|Ì|i|1}{ñ|n}{ϱ|g}'

c(str).random().val;
// => 'ƭèstïnϱ'

every

let second = (s, i) => (i % 2 == 0) ? s : s.toUpperCase();

c('hhhhhhhhhh').every(second).val;
// => 'hHhHhHhHhH'

after

c('hhhhhhhhhh').after((s) => s.toUpperCase()).val;
// => 'HHHHHHHHH'

add

c('1').add('2').add('3').val;
// => '123'

times

c('yeah').times(5).val;
// => 'yeahyeahyeahyeahyeah'

c("aaa").add("b").times(3).val;
// => 'aaabaaabaaab'

c('1').times(1).add('2').times(2).add('3').times(3).val;
// => '122333'

shuffle

c('Lorem ipsum dolor sit amet').shuffle().val;
// => 'deotempsoo r sLiirt lmm au'

c('Lorem ipsum dolor sit amet').shuffle('words').val;
// => 'amet sit Lorem dolor ipsum'

c('Lorem ipsum dolor sit amet').shuffle('chars').val;
// => 'remLo psmiu olrod tsi tame'

Build

npm run build

npm run dev

Test

npm run test

npm run test:watch

License

MIT © Janne Rantamäki

Keywords

string

FAQs

Package last updated on 09 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts