Skip to content

Commit 3d96ddc

Browse files
author
vvo
committed
fix(quotes): fixes #82 #81 #80
1 parent 5c0ae3e commit 3d96ddc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

index-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ describe('reactElementToJSXString(ReactElement)', () => {
7070
reactElementToJSXString(
7171
React.createElement('div', { title: "<'hello' you & you>" })
7272
)
73-
).toEqual('<div title="&lt;&#39;hello&#39; you &amp; you&gt;" />');
73+
).toEqual('<div title="<\'hello\' you & you>" />');
7474
});
7575

7676
it("reactElementToJSXString(<div obj={{ nested: <div arr={['hello', 'you']} /> }} />)", () => {
7777
expect(
7878
reactElementToJSXString(
79-
<div obj={{ nested: <div arr={['hello', 'you']} /> }} />
79+
<div obj={{ nested: <div arr={['hello', 'you']}>Hello "' you</div> }} />
8080
)
8181
).toEqual(
8282
`<div
8383
obj={{
84-
nested: <div arr={['hello', 'you']} />
84+
nested: <div arr={['hello', 'you']}>Hello "' you</div>
8585
}}
8686
/>`
8787
);

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import isPlainObject from 'is-plain-object';
55
import stringify from 'stringify-object';
66
import sortobject from 'sortobject';
77
import traverse from 'traverse';
8-
import { fill, escape } from 'lodash';
8+
import { fill } from 'lodash';
99

10+
const escape = s => s.replace(/"/g, '&quot;');
1011
const defaultFunctionValue = fn => fn;
1112

1213
export default function reactElementToJSXString(

0 commit comments

Comments
 (0)