deep-trim
v1.0.0
Published
Recursively trim all the strings in a collection (object or array).
Downloads
3,574
Maintainers
Readme
deep-trim
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.