Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds back delete() and clear() to Record #1157

Merged
merged 1 commit into from Mar 13, 2017
Merged

Adds back delete() and clear() to Record #1157

merged 1 commit into from Mar 13, 2017

Conversation

leebyron
Copy link
Collaborator

This adds back the delete() and clear() methods to Record instances that set values back to the default values, in the process improving the equals() and hashCode() implementations.

This adds back the delete() and clear() methods to Record instances that set values back to the default values, in the process improving the equals() and hashCode() implementations.
leebyron referenced this pull request Mar 13, 2017
* RFC: Refactor Record. No longer a Collection. Faster guts.

This is a breaking change refactor of Record which no longer extends a collection type and therefore does not inherit sequence methods - which was a constant source of confusion and breakage. It also refactors the internals to no longer rely on a Map, but instead a fixed size List which should result in dramatically faster performance. This is also a breaking change as `delete()` (aka `remove()`) and `clear()` are no longer available - previously these methods reverted values to their default value, now that can be done with `set(k, undefined)`.

This adds a predicate function `isRecord()` and also minorly refactors related functionality such as `Seq()` constructors.

Fixes #505
Fixes #286

* Add perf test
@leebyron leebyron merged commit f28ec3b into master Mar 13, 2017
@leebyron leebyron deleted the record-clear branch March 13, 2017 02:34
@philipp-spiess
Copy link
Contributor

Can we add Record#deleteIn as well? We use this for deeply clearing Map properties in a large State record. It's also still present in the flow and ts types :)

errendir added a commit to errendir/immutable-js that referenced this pull request Aug 24, 2017
…ings

* facebook/master: (146 commits)
  Add descriptive titles (immutable-js#1244)
  expect setting Record property to throw (immutable-js#1194)
  Change the has method of Record to be a type guard (immutable-js#1232)
  Add back deleteIn() and removeIn() to Record (immutable-js#1179)
  Fix typo: change 'hiearchy' to 'hierarchy' (immutable-js#1222)
  Fix typo in OrderedMap#toKeyedSeq (immutable-js#1177)
  Fixes missing size property in flow types. (immutable-js#1173)
  Fix size of count() after filtering or flattening (immutable-js#1171)
  Support typescript strictNullChecks (immutable-js#1168)
  added links to header in docs immutable-js#356 (immutable-js#1164)
  Replace "an Collection" with "a Collection" everywhere (immutable-js#1163)
  Fix syntax highlighting and wrong variable names (immutable-js#1159)
  4.0.0-rc.2
  Adds back delete() and clear() to Record (immutable-js#1157)
  Improve filter typescript def to leverage predicate functions (immutable-js#1155)
  Improve type for reduce() (immutable-js#1156)
  Significant improvments to concat type definitions. (immutable-js#1153)
  Update README.md (immutable-js#1150)
  Add note for using with webpack
  Readme improvement pass
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants