Add _.chain tests and ensure they pass.

Former-commit-id: e365b65da8a740383c975c7b904ad2156d1cc8ab
This commit is contained in:
John-David Dalton
2013-05-14 22:48:34 -07:00
parent fdc9d5f1fd
commit ee1933389a
9 changed files with 51 additions and 24 deletions

View File

@@ -367,14 +367,13 @@
].join('\n' + indent));
});
// replace `lodash.chain` assignment
// replace `chain` assignments
source = source.replace(getMethodAssignments(source), function(match) {
return match.replace(/^( *lodash\.chain *= *).+/m, '$1chain;');
return match
.replace(/^( *lodash\.chain *= *)[\s\S]+?(?=;\n)/m, '$1chain')
.replace(/^( *lodash\.prototype\.chain *= *)[\s\S]+?(?=;\n)/m, '$1wrapperChain');
});
// add `lodash.prototype.chain` assignment
source = source.replace(/^( *)lodash\.prototype\.value *=.+\n/m, '$1lodash.prototype.chain = wrapperChain;\n$&');
// remove `lodash.prototype.toString` and `lodash.prototype.valueOf` assignments
source = source.replace(/^ *lodash\.prototype\.(?:toString|valueOf) *=.+\n/gm, '');