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

monocle-ts

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monocle-ts - npm Package Compare versions

Comparing version 0.5.3-rc to 1.0.0

5

CHANGELOG.md

@@ -16,2 +16,7 @@ # Changelog

# 1.0.0
* **Breaking Change**
* upgrade to `fp-ts@1.0.0` (@gcanti)
# 0.5.2

@@ -18,0 +23,0 @@

9

package.json
{
"name": "monocle-ts",
"version": "0.5.3-rc",
"version": "1.0.0",
"description": "A porting of scala monocle library to TypeScript",

@@ -17,8 +17,5 @@ "files": ["lib"],

"prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples}/**/*.ts\"",
"flow-copy-definition-files": "cp src/*.js.flow lib",
"flow-fix-prettier":
"prettier --no-semi --single-quote --print-width 120 --parser flow --write \"{src,test,examples,exercises}/**/*.js.flow\"",
"test": "npm run prettier && npm run lint && npm run typings-checker && npm run mocha",
"clean": "rm -rf lib/*",
"build": "npm run clean && tsc && npm run flow-copy-definition-files",
"build": "npm run clean && tsc",
"docs-fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser markdown --write \"README.md\"",

@@ -38,3 +35,3 @@ "docs": "doctoc README.md && npm run docs-fix-prettier"

"dependencies": {
"fp-ts": "^1.0.0-rc"
"fp-ts": "^1.0.0"
},

@@ -41,0 +38,0 @@ "devDependencies": {

@@ -1280,2 +1280,34 @@ # Motivation

Example: reversing strings in a nested array
```ts
import { Lens, fromTraversable } from 'monocle-ts'
import { array } from 'fp-ts/lib/Array'
interface Tweet {
text: string
}
interface Tweets {
tweets: Tweet[]
}
const tweetsLens = Lens.fromProp<Tweets, 'tweets'>('tweets')
const tweetTextLens = Lens.fromProp<Tweet, 'text'>('text')
const tweetTraversal = fromTraversable(array)<Tweet>()
const composedTraversal = tweetsLens.composeTraversal(tweetTraversal).composeLens(tweetTextLens)
const tweet1: Tweet = { text: 'hello world' }
const tweet2: Tweet = { text: 'foobar' }
const model: Tweets = { tweets: [tweet1, tweet2] }
const newModel = composedTraversal.modify(text =>
text
.split('')
.reverse()
.join('')
)(model)
// { tweets: [ { text: 'dlrow olleh' }, { text: 'raboof' } ] }
```
# fromFoldable

@@ -1282,0 +1314,0 @@

Sorry, the diff of this file is not supported yet

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