X-Git-Url: https://git.yukkurigames.com/?p=string-lerp.git;a=blobdiff_plain;f=README.md;h=d96fd9fd54f302fead9bf75fcd02c45947c62914;hp=8ec96704802fee6fa7bbce4b84f105d4acf84646;hb=203ddaf6c8bc3326257cfeeda9a01752fbc7ab5c;hpb=34182258ce91e32a350ce252a29cc73c06795089 diff --git a/README.md b/README.md index 8ec9670..d96fd9f 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,13 @@ Otherwise, they are passed through `fastLerp`. Lerp all the numbers in the string from their values in `a` to their values in `b`. -Numbers may have a leading `-` and a single `.` to mark the decimal -point, but something must be after the `.`. If both of the numbers in -a pair are integers, the result is clamped to an integer. +Numbers may have a leading "-" and a single "." to mark the decimal +point, but something must be after the ".". No other floating point +syntax (e.g. `1e6`) is supported. They are treated as fixed-point +values, with the point's position itself interpolating. -For example, `numericLerp("0.0", "100", 0.123) === "12.3"` because the -`.` in `0.0` is interpreted as a decimal point. +For example, `numericLerp("0.0", "100.0", 0.123) === "12.3"` because +the `.` in `0.0` is interpreted as a decimal point. But `numericLerp("0.", "100.", 0.123) === "12."` because the strings are interpreted as integers followed by a full stop. @@ -96,9 +97,19 @@ the strings are similar. ### stringLerp.diff(s, t) and stringLerp.patch(edits, s) These are the functions used to implement `diffLerp`. `diff` -calculates a series of edit operations - substitutions, insertions, +calculates an array of edit operations - substitutions, insertions, and deletions - to turn `s` into `t`. +The type of the edit operations is unspecified. What is guaranteed is: + +* There's an Array of them. +* The array can be cut up and applied in-order but piecemeal. +* They are simple objects, i.e. can be (de)serialized via JSON and fed + into the same version of `patch` later. + +Do not rely on edit operations to be exactly the same type (or same +operations) between versions / installations. + ### stringLerp.levenshteinMatrix(s, t, ins, del, sub)