【文件属性】:
文件名称:objektiv:JavaScript中的功能性镜头
文件大小:20KB
文件格式:ZIP
更新时间:2021-05-13 14:25:44
javascript functional lenses functional-lenses JavaScript
对象
JavaScript中的功能性镜头
Objektiv(德语)镜头,光学,物镜
基本
Objektiv.attr('field')对象属性访问器。 Objektiv.at(index)数组元素访问器。 lens.then(otherLens, ...)镜头组成可以接受很多参数。 lens.traversal([filter])返回遍历,可以选择过滤。
普通镜片
抛出TypeError除非找到元素
const data = { array : [ 1 , 2 , 3 ] } ;
const firstOfSome = Objektiv . attr ( "array" ) . at ( 0 ) ;
firstOfSome . get ( data ) ; //=> 1
firstOfSome . set ( data , 10 ) ; //=> { array: [10, 2, 3]
【文件预览】:
objektiv-master
----.gitignore(543B)
----package.json(775B)
----src()
--------objektiv.js(7KB)
----.travis.yml(54B)
----LICENSE(1KB)
----index.js(44B)
----CHANGELOG.md(806B)
----README.md(4KB)
----renovate.json(51B)
----test()
--------traversals.js(6KB)
--------tests.js(10KB)
----yarn.lock(28KB)