Merge branch 'remeda-equal'

This commit is contained in:
Yanick Champoux 2023-04-10 10:38:48 -04:00
commit 106edd6637
4 changed files with 44 additions and 10 deletions

View File

@ -6,22 +6,26 @@ project:
ticket_url: ~
with_stats: true
releases:
- version: NEXT
date: ~
changes:
- desc: check for array deep equality
- version: v2.1.1
date: 2023-02-22
changes:
- desc: add map to the exports
- desc: 'code churn: 4 files changed, 134 insertions(+), 121 deletions(-)'
- desc: "code churn: 4 files changed, 134 insertions(+), 121 deletions(-)"
type: stats
- version: v2.1.0
date: 2023-00-13
changes:
- desc: add function 'matches'
- desc: 'code churn: 7 files changed, 66 insertions(+), 174 deletions(-)'
- desc: "code churn: 7 files changed, 66 insertions(+), 174 deletions(-)"
type: stats
- version: v2.0.0
date: ~
changes:
- desc: 'Fork from the [mothership](github.com/substantial/updeep), v1.2.1'
- desc: "Fork from the [mothership](github.com/substantial/updeep), v1.2.1"
change_types:
- keywords:
- feat

View File

@ -3,9 +3,12 @@
version: "3"
vars:
GREETING: Hello, World!
VERSION:
sh: cat package.json | jq -r .version
PARENT_BRANCH: main
FILE_DELTA:
sh: git diff-ls {{.PARENT_BRANCH}}
FIX: false
tasks:
changelog:
@ -16,6 +19,24 @@ tasks:
test: vitest run
prettier:
cmd: prettier {{if .FIX }}--write{{end}} {{ .FILE_DELTA | catLines | default "." }}
checkout-clean:
cmds:
- sh: git is-clean
msg: stuff not commited
integrate:
deps: [prettier, test, build]
cmds:
- echo {{ .FILE_DELTA | catLines }} | grep CHANGELOG.yml
- sh: git branch | grep '* {{.PARENT_BRANCH}}'
msg: not on target
- { task: checkout-clean }
- git checkout {{.PARENT_BRANCH}}
- git weld -
build:
sources: ["src/**"]
generates: ["esm/**"]
@ -25,7 +46,7 @@ tasks:
- tsc -p tsconfig.json
prepRelease:
deps: [changelog, build]
deps: [test, changelog, build]
preconditions:
- sh: git branch | grep '* main'
msg: not on main
@ -41,8 +62,3 @@ tasks:
- npm publish --access public
- git push
- git push --tags
default:
cmds:
- echo "{{.GREETING}}"
silent: true

View File

@ -1,5 +1,6 @@
import wrap from "./wrap.js";
import constant from "./constant.js";
import * as R from "remeda";
import { omitBy, isObject, merge } from "remeda";
@ -77,6 +78,8 @@ function update(object, updates) {
return updates(object);
}
if (Array.isArray(object) && R.equals(object, updates)) return object;
if (!isPlainObject(updates)) {
return updates;
}

View File

@ -169,3 +169,14 @@ describe("u.skip", () => {
test("has map", () => {
expect(u).toHaveProperty("map");
});
test("deep equality", () => {
const orig = [1, 2, 3];
// no change? same structure
expect(u(orig, [1, 2, 3])).toBe(orig);
const deepOrig = [1, 2, [3, 4]];
expect(u(deepOrig, [1, 2, [3, 4]])).toBe(deepOrig);
});