index.js 484 B

12345678910111213141516171819
  1. 'use strict';
  2. var mapObj = require('map-obj');
  3. var decamelize = require('decamelize');
  4. module.exports = function (input, separator, options) {
  5. if (typeof separator !== 'string') {
  6. options = separator;
  7. separator = null;
  8. }
  9. options = options || {};
  10. separator = separator || options.separator;
  11. var exclude = options.exclude || [];
  12. return mapObj(input, function (key, val) {
  13. key = exclude.indexOf(key) === -1 ? decamelize(key, separator) : key;
  14. return [key, val];
  15. });
  16. };