react-text-replace
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "react-text-replace", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A package that makes replace jsx components content easier.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ # React Text Replace | ||
- Use: `require('react-text-replace')` | ||
- Install: `npm install --save react-string-to-source` | ||
- Install: `npm install --save react-text-source` | ||
@@ -21,9 +21,9 @@ ### [YARN](https://yarnpkg.com/) | ||
``` javascript | ||
import React from 'react' | ||
import { textReplace } from 'react-text-replace' | ||
import uuidv1 from 'uuid/v1' | ||
import React from "react" | ||
import { textReplace } from "react-text-replace" | ||
import uuidv1 from "uuid/v1" | ||
const App = props => | ||
textReplace({ | ||
source: '>> Hello >> world >> !!', | ||
source: ">> Hello >> world >> !!", | ||
find: />>(.*)/, | ||
@@ -54,4 +54,8 @@ call(match, $1) { | ||
call(match, $1) { | ||
return <span style={{fontSize: '2em'}} key={uuidv1()}>{$1}</span> | ||
}, | ||
return ( | ||
<span style={{ fontSize: "2em" }} key={uuidv1()}> | ||
{$1} | ||
</span> | ||
) | ||
} | ||
}, | ||
@@ -63,6 +67,7 @@ { | ||
} | ||
}, | ||
} | ||
] | ||
var App = props => textReplace(source, options) || textReplace(source, ...options) | ||
var App = props => | ||
textReplace(source, options) || textReplace(source, ...options) | ||
``` | ||
@@ -73,3 +78,3 @@ | ||
``` html | ||
<span style="font-size: 2em;"> | ||
<span style="font-size: 2em"> | ||
Hello >> world >> <i>!!</i> | ||
@@ -83,17 +88,20 @@ </span> | ||
``` javascript | ||
import React from 'react' | ||
import { TextReplace } from 'react-text-replace' | ||
import uuidv1 from 'uuid/v1' | ||
import React from "react" | ||
import { TextReplace } from "react-text-replace" | ||
import uuidv1 from "uuid/v1" | ||
// Creates a cache that lasts until close the page | ||
const App = props => | ||
const App = props => ( | ||
<TextReplace | ||
source = { ">> Hello >> world >> !!" } | ||
pipe = {[ | ||
source={">> Hello >> world >> !!"} | ||
pipe={[ | ||
{ | ||
find: />>(.*)/, | ||
call(match, $1) { | ||
return <span style={{fontSize: '2em'}} key={uuidv1()}>{$1}</span> | ||
return ( | ||
<span style={{ fontSize: "2em" }} key={uuidv1()}> | ||
{$1} | ||
</span> | ||
) | ||
}, | ||
@@ -107,5 +115,6 @@ isRecursive: true | ||
} | ||
}, | ||
} | ||
]} | ||
/> | ||
) | ||
``` | ||
@@ -116,5 +125,5 @@ | ||
``` html | ||
<span style="font-size: 2em;"> Hello | ||
<span style="font-size: 2em;"> world | ||
<span style="font-size: 2em;"> | ||
<span style="font-size: 2em"> Hello | ||
<span style="font-size: 2em"> world | ||
<span style="font-size: 2em"> | ||
<i>!!</i> | ||
@@ -121,0 +130,0 @@ </span> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7187
131