Skip to content

Commit 421a58d

Browse files
committed
feat(obj):remove mutating funcs in favor of using js-interop
BREAKING CHANGE: `set_prop`, `set_props` have been removed, use `@fink/js-interop`
1 parent ff0849e commit 421a58d

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

src/obj.fnk

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ obj_key_values = Object.entries
88
key_values_to_obj = Object.fromEntries
99

1010
# TODO: should use in-operator instead
11+
# TODO: use Reflect.has
1112
obj_has = fn obj, key:
1213
Object.prototype.hasOwnProperty.call obj, key
13-
14-
15-
# TODO: move to mutable ?
16-
set_props = Object.assign
17-
18-
# TODO: move to mutable ?
19-
set_prop = Reflect.set
20-

src/obj.test.fnk

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{describe, it, expect, to_equal} = import '@fink/jest'
22

33
{
4-
obj_keys, obj_values, obj_key_values, key_values_to_obj
5-
set_props, set_prop, obj_has
4+
obj_keys, obj_values, obj_key_values, key_values_to_obj, obj_has
65
} = import './obj'
76

87

@@ -47,23 +46,3 @@ describe 'objects', fn:
4746
['bar spam', 2]
4847
to_equal
4948
{foo: 1, 'bar spam': 2}
50-
51-
52-
it 'mutates object with single prop', fn:
53-
foo = {foo: 1}
54-
55-
set_prop foo, 'bar', 2
56-
57-
expect
58-
foo
59-
to_equal {foo: 1, bar: 2}
60-
61-
62-
it 'mutates object with new props', fn:
63-
foo = {foo: 1}
64-
65-
set_props foo, {bar: 2, spam: 3}
66-
67-
expect
68-
foo
69-
to_equal {foo: 1, bar: 2, spam: 3}

0 commit comments

Comments
 (0)