Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

partial.lenses

Package Overview
Dependencies
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

partial.lenses - npm Package Versions

1
18

14.0.0

Diff

Changelog

Source

14.0.0

The current plan is to change Partial Lenses to support so called naked or prototypeless objects with null prototype (i.e. Object.create(null)) in a following major version. This is a breaking change although it is likely that it will not affect most users. Usefully warning for this change of behaviour by adding diagnostics to optics seems somewhat difficult.

Previously obsoleted L.iftes was removed.

The L.Constant functor was removed. It can be replaced as follows:

-L.constant
+{map: (_, x) => x}

L.get has been changed to use the now exported L.Select applicative instead of the removed L.Constant functor. The reason for this change is that it both generalizes L.get and simplifies things overall.

L.get now works exactly like L.select. L.select and L.selectAs have been consequently obsoleted. Change usages as follows:

-L.select(...)
+L.get(...)
-L.selectAs(...)
+L.getAs(...)

In the cases where L.get previously returned a valid result, the only differences are in the cases where L.zero is involved. L.zero is used by several other combinators that could be used as lenses including the conditionals,

  • L.cond, and
  • L.condOf,

and the querying combinators,

  • L.chain,
  • L.choice,
  • L.optional,
  • L.unless, and
  • L.when,

and the transform ops,

  • L.assignOp,
  • L.modifyOp,
  • L.removeOp, and
  • L.setOp.

Previously L.zero was implemented so that it did something reasonable even with a plain functor. Since no operation in this library now uses a plain functor, the special case behaviour of L.zero has been removed. When previously used with L.get, L.zero passed undefined to the inner optics and ignored what the inner optics returned. For example, previously:

L.get(['x', L.when(x => x > 0), L.valueOr(0)], {x: -1})
// 0

but now L.zero exits early:

L.get(['x', L.when(x => x > 0), L.valueOr(0)], {x: -1})
// undefined

This is clearly a breaking change. However, this is unlikely to affect a large number of use cases. To get the old behavior, use of L.zero needs to be avoided. In the example case, one could write:

L.get(['x', L.ifElse(x => x > 0, [], R.always(0))], {x: -1})
// 0
polytypic
published 14.0.0-0 •

polytypic
published 13.16.0 •

polytypic
published 13.15.0 •

polytypic
published 13.14.0 •

polytypic
published 13.13.2 •

polytypic
published 13.13.1 •

polytypic
published 13.13.0 •

polytypic
published 13.12.0 •

polytypic
published 13.11.0 •

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc