0.0.4 • Published 5 years ago

trg v0.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Template Range Generators

ES6 Template String - based generators for a range of numbers or letters.

Build Status Coverage Status

NOTE: Currently supporting only integers, and only for Node.js 4.0 and later.

Install

$npm install trg

Usage

const IR = require('trg').int; // Integer Range generator
  • Simple {1, 7} range:
IR`${1}${7}`;
//=> 1234567
  • Range {1, 7}, with prefix $ and , separator:
IR`$${1}, ${7}`;
//=> $1, $2, $3, $4, $5, $6, $7
  • Reversed range {7, 1}, with step 2 and , separator:
IR`${7}, ${1}${2}`;
//=> 7, 5, 3, 1
  • Range {-3, 7}, with prefix #, suffix :-), separator , and step 2:
IR`#${-3}, ${7}:-)${2}`;
//=> #-3:-), #-1:-), #1:-), #3:-), #5:-), #7:-)

Template format supported by the integer range generator:

  1. Optional prefix string
  2. Starting value integer (required)
  3. Optional separator string
  4. Ending value integer (required)
  5. Optional suffix string
  6. Optional step integer
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago