sproutcore/sproutcore — pull request #842 by dcporter (2012-09-30 17:15:08+00:00)
Title: Improved String.fmt handling of missing named arguments.

Currently, if you format a string with named arguments, and don't submit all arguments, the missing named arguments will be replaced with 'undefined'. For example, the following call:

```javascript
"%{first}, %{last}%{punctuation}".fmt({ first: 'Hello', punctuation: '!');
```

will result in:

```javascript
"Hello, undefined!"
```

Along with being useless, this also prevents the use case where you have a string that you want to format over several calls, for example:

```javascript
var hiWorld = "%{first}, %{last}%{punctuation}"
...
hiWorld = hiWorld.fmt({ first: 'Hello', last: 'World');
...
hiWorld = hiWorld.fmt({ punctuation: '!' });
```

I've updated the fmt code so that if the formatter submethod returns undefined, it leaves the argument in the string. So the original example:

```javascript
"%{first}, %{last}%{punctuation}".fmt({ first: 'Hello', punctuation: '!');
```

will result in:

```javascript
"Hello, %{last}!"
```

...allowing you to a) know what's going on and b) do another round of formatting later on.