-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add options.escape #11
Add options.escape #11
Conversation
verb decided it wanted to modify some other stuff in the readme, so I let it.
thanks! reviewing now
ha, well if verb makes bad choices, please let me know lol. I'd love feedback |
@@ -21,6 +21,8 @@ module.exports = function(str, options) { | |||
|
|||
var newline = options.newline || '\n' + indent; | |||
|
|||
var escape = options.escape || function(str){return str;}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you mind changing this to:
function identity(str) {
return str;
};
var escape = typeof options.escape === 'function'
? options.escape
: identity;
so we can explicitly ensure that escape
will always be a function (and not true
or something)
looks great, and it's a great idea. would you mind making the proposed changes? If not, that's okay I can merge as-is and make the changes - I'm grateful for the pr. |
It's not that verb made bad choices, no. I just thought I'd explain why the diff of Readme.md had some unrelated changes in it. |
@jonschlinkert Have you had a chance to look at the changes I made? |
thanks for the reminder! |
I needed this because I was word-wrapping some text that would be embedded in an SVG document. If I escaped it before embedding (a) the lengths would have been wrong, and (b) an entity could be broken across two lines.
verb decided it wanted to modify some other stuff in the readme, so I let it.