From dd79af4f77b499c090c1bb2d28eb29a990cd0ee4 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Wed, 12 Jun 2019 11:03:05 -0400 Subject: [PATCH 1/6] New utility function stateLens --- CHANGELOG.md | 5 ++++- README.md | 4 ++++ package.json | 2 +- src/lens.js | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c47e2df..bfed47ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ -# 1.55.1 +# 1.55.2 +- New lens helper for React users: `stateLens` + +# 1.55.1 - Fix issue with autoLabelOption not accepting correctly falsy values as valid options # 1.55.0 diff --git a/README.md b/README.md index d2483cb3..0e467a2e 100644 --- a/README.md +++ b/README.md @@ -560,6 +560,10 @@ To help illustrate the potential use cases of the power of lenses, these are som #### domLens.binding `(field, getValue) -> lens -> {[field], onChange}` Even more generic utility than targetBinding which uses `getEventValue` to as the function for a setsWith which is mapped to `onChange`. +### Lens Utils + +#### stateLens +`([value, setValue]) -> lens` Given the popularity of React, we decided to include this little helper that converts a `useState` hook call to a lens. Ex: `let lens = stateLens(useState(false))`. ## Aspect Aspects provide a functional oriented implementation of Aspect Oriented Programming. diff --git a/package.json b/package.json index cec086c0..550dd42e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "futil-js", - "version": "1.55.1", + "version": "1.55.2", "description": "F(unctional) util(ities). Resistance is futile.", "main": "lib/futil-js.js", "scripts": { diff --git a/src/lens.js b/src/lens.js index 910ee82a..673f538a 100644 --- a/src/lens.js +++ b/src/lens.js @@ -91,3 +91,5 @@ export let domLens = { targetBinding, binding, } + +export let stateLens = ([value, set]) => ({ get: () => value, set }) From da012b88def0a5e8719e1913a9159f41a0a02f00 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Wed, 12 Jun 2019 12:51:30 -0400 Subject: [PATCH 2/6] Install danger peer-dep --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b7e1177..9aab0962 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,7 @@ jobs: timeout: 240 - run: name: pre-danger - command: git config user.email "decrapifier@govspend.com" && git config user.name "Decrapifier" && git config push.default upstream && git branch -u origin/$CIRCLE_BRANCH + command: git config user.email "decrapifier@govspend.com" && git config user.name "Decrapifier" && git config push.default upstream && git branch -u origin/$CIRCLE_BRANCH && npm install danger when: always - run: name: danger From d7e450664e3c626a4ecd39e6a72b749ae8bd43b0 Mon Sep 17 00:00:00 2001 From: Decrapifier Date: Wed, 12 Jun 2019 16:56:27 +0000 Subject: [PATCH 3/6] Automagically formatted by Duti! https://github.com/smartprocure/duti --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 550dd42e..0013c07c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "license": "MIT", "dependencies": { "babel-polyfill": "^6.23.0", + "danger": "^8.0.0", "lodash": "^4.17.4" }, "babel": { From b78123aa2b0c689609be4cafbfa3312ccdc2b6c7 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Wed, 12 Jun 2019 13:51:53 -0400 Subject: [PATCH 4/6] Danger as a dev dependency --- .circleci/config.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9aab0962..4b7e1177 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,7 @@ jobs: timeout: 240 - run: name: pre-danger - command: git config user.email "decrapifier@govspend.com" && git config user.name "Decrapifier" && git config push.default upstream && git branch -u origin/$CIRCLE_BRANCH && npm install danger + command: git config user.email "decrapifier@govspend.com" && git config user.name "Decrapifier" && git config push.default upstream && git branch -u origin/$CIRCLE_BRANCH when: always - run: name: danger diff --git a/package.json b/package.json index 0013c07c..da2d8427 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "license": "MIT", "dependencies": { "babel-polyfill": "^6.23.0", - "danger": "^8.0.0", "lodash": "^4.17.4" }, "babel": { @@ -56,6 +55,7 @@ "chokidar-cli": "^1.2.0", "codacy-coverage": "^3.0.0", "coveralls": "^3.0.0", + "danger": "^6.1.13", "duti": "latest", "eslint": "4.19.1", "eslint-config-smartprocure": "^1.0.2", From 4eef4713e1ebc8ffec55a9432a1d11872fe05e1d Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Wed, 12 Jun 2019 14:11:02 -0400 Subject: [PATCH 5/6] Remove deprecated platform --- karma.conf.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index 6b00184f..40059582 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -269,14 +269,6 @@ let customLaunchers = { deviceName: 'iPad Pro (9.7 inch) Simulator', deviceOrientation: 'portrait', }, - sl_android_44: { - base: 'SauceLabs', - browserName: 'android', - version: '4.4', - deviceName: 'Android Emulator', - deviceType: 'phone', - deviceOrientation: 'portrait', - }, sl_android_51: { base: 'SauceLabs', browserName: 'android', From b33737d43501506751d9e0521c8a9d9b64f06983 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Wed, 12 Jun 2019 15:54:56 -0400 Subject: [PATCH 6/6] Bump minor version --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfed47ec..0990ef21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.55.2 +# 1.56.0 - New lens helper for React users: `stateLens` # 1.55.1 diff --git a/package.json b/package.json index da2d8427..268c4cae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "futil-js", - "version": "1.55.2", + "version": "1.56.0", "description": "F(unctional) util(ities). Resistance is futile.", "main": "lib/futil-js.js", "scripts": {