force lodash v4 on some iterators so they do not run multiple times

This commit is contained in:
spalger
2016-05-19 07:30:26 -07:00
parent 21e96b7080
commit d1e5940f73
3 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,7 @@ module.exports = function (branch, done) {
* @type {[type]}
*/
var _ = require('../../src/lib/utils');
var _v4 = require('lodash-migrate/lodash');
var utils = require('../../grunt/utils');
var fs = require('fs');
var async = require('async');
@ -174,8 +175,8 @@ module.exports = function (branch, done) {
var actions = [];
// itterate all of the specs within the file, should only be one
_.each(spec, function (def, name) {
//camelcase the name
_v4.each(spec, function (def, name) {
// camelcase the name
name = _.map(name.split('.'), _.camelCase).join('.');
if (name === 'cat.aliases') {
@ -218,7 +219,7 @@ module.exports = function (branch, done) {
var urls = _.difference(def.url.paths, overrides.aliases[name]);
var urlSignatures = [];
urls = _.map(urls, function (url) {
urls = _v4.map(urls, function (url) {
var optionalVars = {};
var requiredVars = {};
var param;
@ -239,7 +240,7 @@ module.exports = function (branch, done) {
urlSignatures.push(_.union(_.keys(optionalVars), _.keys(requiredVars)).sort().join(':'));
return _.omit({
return _v4.omitBy({
fmt: url.replace(urlParamRE, function (full, match) {
return '<%=' + _.camelCase(match) + '%>';
}),

View File

@ -8,7 +8,7 @@ NOTE: At this time, you must opt into the <%= branch %> API by setting the `apiV
<% }
actions = _.sortBy(actions, 'namespace');
_.each(actions, function (action) {
_v4.each(actions, function (action) {
action.index = 'api-' + action.name.toLowerCase().replace(/[^\w]+/g, '-') + branchSuffix;
%>
@ -31,12 +31,12 @@ The default method is `<%= action.spec.method || 'GET' %>` and the usual <<api-c
*Params*
[horizontal]<%
_.each(action.allParams, function (param, paramName) { %>
_v4.each(action.allParams, function (param, paramName) { %>
`<%= paramWithDefault(paramName, param.default) %>`::
`<%= paramType(param.type) %>` -- <%= joinParagraphs(param.description || '', 4) %><%
if (param.type === 'enum') {%>
Options:::<%
_.each(param.options, function (opt) {%>
_v4.each(param.options, function (opt) {%>
* `"<%= opt %>"`<%
});%>
<%

View File

@ -1,5 +1,6 @@
var _ = require('../../../src/lib/utils');
var _v4 = require('lodash-migrate/lodash');
var utils = require('../../../grunt/utils');
var fs = require('fs');
var path = require('path');
@ -42,6 +43,7 @@ var templateGlobals = {
stringify: stringify,
_: _,
_v4: _v4,
indent: function (block, spaces) {
var indent = _.repeat(' ', spaces);