UNPKG

pnpm

Version:

A fast implementation of npm install

18 lines (14 loc) 423 B
'use strict'; const mapObj = require('map-obj'); const camelCase = require('camelcase'); const has = (arr, key) => arr.some(x => typeof x === 'string' ? x === key : x.test(key)); module.exports = (input, opts) => { opts = Object.assign({ exclude: [], deep: false }, opts); return mapObj(input, (key, val) => { key = has(opts.exclude, key) ? key : camelCase(key); return [key, val]; }, {deep: opts.deep}); };