Mathias Bynens | 79e2cf0 | 2020-05-29 14:46:17 | [diff] [blame] | 1 | 'use strict'; |
| 2 | var mapObj = require('map-obj'); |
| 3 | var decamelize = require('decamelize'); |
| 4 | |
| 5 | module.exports = function (input, separator, options) { |
| 6 | if (typeof separator !== 'string') { |
| 7 | options = separator; |
| 8 | separator = null; |
| 9 | } |
| 10 | |
| 11 | options = options || {}; |
| 12 | separator = separator || options.separator; |
| 13 | var exclude = options.exclude || []; |
| 14 | |
| 15 | return mapObj(input, function (key, val) { |
| 16 | key = exclude.indexOf(key) === -1 ? decamelize(key, separator) : key; |
| 17 | return [key, val]; |
| 18 | }); |
| 19 | }; |