Comparing version 0.1.7 to 0.1.8
@@ -0,1 +1,9 @@ | ||
# CONTRIBUTING | ||
All sorts of contributions are welcome. Please help me add more helpful filters for VueJs. | ||
## Features | ||
For *Enhancement* or *New feature*. | ||
Make sure to follow the coding pattern. The contributor is also responsible for creating the docs in the README.md |
@@ -0,1 +1,13 @@ | ||
const corpus = { | ||
'<': '>', | ||
'>': '<', | ||
'[': ']', | ||
']': '[', | ||
'(': ')', | ||
')': '(', | ||
'{': '}', | ||
'}': '{', | ||
}; | ||
const corpusRegex = /(<|>|\[|\]|\(|\)|\{|\})/g; | ||
export default (Vue) => { | ||
@@ -10,5 +22,16 @@ Vue.filter('morph-sandwich', (value, start, end) => { | ||
function flip (str) { | ||
return str.replace(corpusRegex, match => corpus[match]) | ||
.split('') | ||
.reverse() | ||
.join(''); | ||
} | ||
function sandwich(value, start, end) { | ||
start = start || ''; | ||
end = end || flip(start); | ||
return `${ start }${ value }${ end }`; | ||
} | ||
}; | ||
}; | ||
@@ -6,3 +6,3 @@ { | ||
"name": "morphling", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "A collection of VueJs filters.", | ||
@@ -9,0 +9,0 @@ "main": "index.js", |
@@ -305,2 +305,5 @@ # Mophling | ||
If only a single argument is given, it is used to surround the sandwiched | ||
content by matching open brackets for closed brackets, and so on. | ||
*Syntax* | ||
@@ -313,7 +316,13 @@ | ||
<!-- In the end! --> | ||
<p>{{{ 'Numb' | morph-sandwich('<<< ') }}}</p> | ||
<!-- <<< Numb >>> --> | ||
``` | ||
```javascript | ||
const msg = this.$morphSandwich('the', 'In ', ' end!'); | ||
console.log(msg); // In the end! | ||
const msg1 = this.$morphSandwich('the', 'In ', ' end!'); | ||
console.log(msg1); // In the end! | ||
const msg2 = this.$morphSandwich('Numb', '<<< '); | ||
console.log(msg2); // <<< Numb >>> | ||
``` | ||
@@ -361,7 +370,8 @@ | ||
- Updated [morph-sandwich](#morph-sandwich) filter. | ||
- Added [morph-replace](#morph-replace) filter. | ||
- Added [morph-truncate](#morph-truncate) filter. | ||
- Added [morph-placeholder](#morph-placeholder) filter. | ||
- Added [morph-curreny](#morph-curreny) filter. | ||
- Added [morph-placeholder](#morph-placeholder) filter. | ||
- Added [morph-replace](#morph-replace) filter. | ||
- Added [morph-sandwich](#morph-sandwich) filter. | ||
- Added [morph-truncate](#morph-truncate) filter. | ||
@@ -368,0 +378,0 @@ *"When my time comes, |
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
47881
1605
420