Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/utils / src / keepOnly.ts
Size: Mime:
/**
 * @see https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-377567046
 */
import { AnyObj } from '@skava/utils'
import { keep } from './keep'

export type StringList = string[] | ReadonlyArray<string>

/**
 * @alias keepCurried
 * @todo typings for return like omit
 */
export const keepOnly = <Obj = AnyObj, List extends StringList = StringList>(
  keys: List
) => {
  return (obj: Obj) => keep(obj, keys)
}