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: ~ ticket_url: ~
with_stats: true with_stats: true
releases: releases:
- version: NEXT
date: ~
changes:
- desc: check for array deep equality
- version: v2.1.1 - version: v2.1.1
date: 2023-02-22 date: 2023-02-22
changes: changes:
- desc: add map to the exports - 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 type: stats
- version: v2.1.0 - version: v2.1.0
date: 2023-00-13 date: 2023-00-13
changes: changes:
- desc: add function 'matches' - 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 type: stats
- version: v2.0.0 - version: v2.0.0
date: ~ date: ~
changes: 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: change_types:
- keywords: - keywords:
- feat - feat

View File

@ -3,9 +3,12 @@
version: "3" version: "3"
vars: vars:
GREETING: Hello, World!
VERSION: VERSION:
sh: cat package.json | jq -r .version sh: cat package.json | jq -r .version
PARENT_BRANCH: main
FILE_DELTA:
sh: git diff-ls {{.PARENT_BRANCH}}
FIX: false
tasks: tasks:
changelog: changelog:
@ -16,6 +19,24 @@ tasks:
test: vitest run 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: build:
sources: ["src/**"] sources: ["src/**"]
generates: ["esm/**"] generates: ["esm/**"]
@ -25,7 +46,7 @@ tasks:
- tsc -p tsconfig.json - tsc -p tsconfig.json
prepRelease: prepRelease:
deps: [changelog, build] deps: [test, changelog, build]
preconditions: preconditions:
- sh: git branch | grep '* main' - sh: git branch | grep '* main'
msg: not on main msg: not on main
@ -41,8 +62,3 @@ tasks:
- npm publish --access public - npm publish --access public
- git push - git push
- git push --tags - git push --tags
default:
cmds:
- echo "{{.GREETING}}"
silent: true

View File

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

View File

@ -169,3 +169,14 @@ describe("u.skip", () => {
test("has map", () => { test("has map", () => {
expect(u).toHaveProperty("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);
});