Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / exotic   js

Repository URL to install this package:

Version: 2.0.8 

/ src / types / obj / cast / fromSetToObj.ts

import toKey from '../../attributes/properties/toKey'

const fromSetToObj = <Type>(
  collection: Set<Type>,
  result = {}
): { [Key in keyof Type]: Type[Key] } => {
  let index = -1
  collection.forEach((value, key) => {
    result[toKey(++index)] = value
  })
  return result
}

export { fromSetToObj }
export default fromSetToObj