deep-trim

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

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
deep-trim
1.0.0a year ago8 years agoMinified + gzip package size for deep-trim in KB

Readme

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.