Skip to content

grindcode/snippet-cutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snippet Cutter

Build Status Dependency Status devDependency Status

Returns a subset of a string, composed by complete subsets found using delimeter between min and max length. If no complete subsets are found, returns a subset using length max and ellipsis.

Get Started

npm install snippet-cutter

API

cutter(string, [options])

Returns string processed. The options parameter is optional, but must be an Object if specified, containing zero or more of the following properties:

  • delimiter: String used to split subsets. (String; default: '.')
  • min: Min string length for valid subset match. (Number; default: 1)
  • max: Max string length for valid subset match. (Number; default: 140)
  • ellipsis: Ending string when no complete subset is found. (String; default: '...')

Usage

var cutter = require('snippet-cutter')

cutter(string, options)
// → 'result subset of string'

License

See the License file.

About

Friendly alternative to savage substring practices.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •