Skip to content

Recursively trim all the strings in a collection (object or array).

Notifications You must be signed in to change notification settings

zebateira/node-deep-trim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deep-trim Build Status npm version minzipped size

Recursively trim all the strings in a collection (object or array).

Install

$ npm install deep-trim

Usage

var deepTrim = require('deep-trim');

deepTrim('   a ')
// 'a'

deepTrim(['   a ', 1, '', 'a', '             a']);
// ['a', 1, '', 'a', 'a']

deepTrim({ a: '  a', b: 'b  ', c: '   c ', d: 'd' });
// { a: 'a', b: 'b', c: 'c', d: 'd' }

deepTrim({ a: '  a', b: 'b  ', c: ['   ca', 'cb   '], d: 'd' });
// { a: 'a', b: 'b', c: ['ca', 'cb'], d: 'd' }

Tests

$ npm test

License

Released under the MIT License.

About

Recursively trim all the strings in a collection (object or array).

Resources

Stars

Watchers

Forks

Packages

No packages published