Inside the new Error Message Minification service of Angular.js, MinErr, there are some interesting pieces of code. The first looks at how the unary plus operator is used and the second is a regex used in converting a function to a string.

match below is a string such as '{0}', '{1}', '{2}', etc. The slice extracts the integer within the braces.

var index = +match.slice(1, -1)

The unary plus operator does the following according to MDN:
 ...unary plus is the fastest and preferred way of converting something into a number, because it does not perform any other operations on the number. It can convert string representations of integers and floats...

So we see that the code above converts '{0}' to the number 0 to index into an array.

The code below invokes the toString method on the passed in function and strips out the body of the function leaving the function name and argument list.
if (isFunction(obj)) {
return obj.toString().replace(/ \{[\s\S]*$/, '');
Notice the use of the character class [\s\S]* instead of the simpler .* notation. A common misconception is that the . character matches everything. However, the . character does not match newline characters. So the .* regex would not strip out function bodies with newline characters.