Package Exports
- duplichar
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (duplichar) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
duplichar
Duplicate characters that are substrings of a string
Install
Node
npm install --save duplicharWeb
<script src="https://rawgit.com/dawsonbotsford/duplichar/master/bundle.js"></script>Alternatively, you can install the npm module and reference the bundle within node_modules
<script src="<path to node_modules>/duplichar/bundle.js"></script>Usage
// Remove this require line if you're using the web bundle (it's already bundled as "duplichar")
const duplichar = require('duplichar');
duplichar('hackathons', 0, 3);
//=> 'hhhackathons'
duplichar('hackathons', [0, 2], 3);
//=> 'hahahackathons'API
duplichar(str, index(s), multiplier)
str
Type: string
Description: String to duplicate part of
index
Type: number || array || string
Description: Index(s) of what to duplicate. Operate with slice() style indexing.
Examples:
1: duplicate character at index 1'1': duplicate character at index 1[0, 2]: duplicate substring containing characters at index 0 and 1.[-2]: duplicate substring containing characters at index -2 and -1. (read the slice documentation to understand more advanced slices like this)
multiplier
Type: number || string
Description: Amount of times you would like the selected character or substring duplicated.
returns
Type: string
License
MIT © Dawson Botsford