Socket
Socket
Sign inDemoInstall

@unction/attach

Package Overview
Dependencies
18
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @unction/attach

A polymorphic way to attach a value to the key on a keyed iterable


Version published
Weekly downloads
76
increased by153.33%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@unction/attach

Tests Stability Dependencies

A => B => EnumerableType<B, A> => EnumerableType<B, A> ObjectKeyType => ValueType => ObjectType => ObjectType MapKeyType => ValueType => MapType => MapType ArrayKeyType => ValueType => ArrayType => ArrayType null => ValueType => SetType => SetType null => ValueType => StreamType => StreamType

A polymorphic way to attach a value to the key on a keyed enumerator. When dealing with a sorted list type and the key is larger than the list, it will append to the list. When the key is an index that already exists it will place the value at that index and shift remaining values to the right.

attach("hello")("world")({}) // => {hello: "world"}
attach(3)("x")([1, 2, 3]) // => [1, 2, 3, "x"]
attach(1)("x")([1, 2, 3]) // => [1, "x", 2, 3]
attach(null)("x")(new Set([1, 2, 3])) // => {1 2 3 "x"}
attach(10)("x")([]) // => ["x"]
attach(0)("a")("bc") // => "abc"
attach(null)("a")(xstream.of("b")) // => a---b--=>

Keywords

FAQs

Last updated on 06 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc