You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,8 +52,6 @@ var s = new MagicString( 'problems = 99' );
52
52
53
53
s.overwrite( 0, 8, 'answer' );
54
54
s.toString(); // 'answer = 99'
55
-
s.locate( 9 ); // 7 - the character originally at index 9 ('=') is now at index 7
56
-
s.locateOrigin( 7 ); // 9
57
55
58
56
s.overwrite( 11, 13, '42' ); // character indices always refer to the original string
59
57
s.toString(); // 'answer = 42'
@@ -126,11 +124,11 @@ Inserts the specified `content` at the `index` in the original string. Returns `
126
124
127
125
### s.locate( index )
128
126
129
-
Finds the location, in the generated string, of the character at `index` in the original string. Returns `null` if the character in question has been removed or overwritten.
127
+
**DEPRECATED** since 0.10 – see [#30](https://github.com/Rich-Harris/magic-string/pull/30)
130
128
131
129
### s.locateOrigin( index )
132
130
133
-
The opposite of `s.locate()`. Returns `null` if the character in question was inserted with `s.append()`, `s.prepend()` or `s.overwrite()`.
131
+
**DEPRECATED** since 0.10 – see [#30](https://github.com/Rich-Harris/magic-string/pull/30)
0 commit comments