(direction, name)
| 17839 | |
| 17840 | // TODO: remove 'name' arg after deprecation is removed |
| 17841 | function createAdder(direction, name) { |
| 17842 | return function (val, period) { |
| 17843 | var dur, tmp; |
| 17844 | //invert the arguments, but complain about it |
| 17845 | if (period !== null && !isNaN(+period)) { |
| 17846 | deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + |
| 17847 | 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); |
| 17848 | tmp = val; val = period; period = tmp; |
| 17849 | } |
| 17850 | |
| 17851 | val = typeof val === 'string' ? +val : val; |
| 17852 | dur = createDuration(val, period); |
| 17853 | addSubtract(this, dur, direction); |
| 17854 | return this; |
| 17855 | }; |
| 17856 | } |
| 17857 | |
| 17858 | function addSubtract (mom, duration, isAdding, updateOffset) { |
| 17859 | var milliseconds = duration._milliseconds, |
no test coverage detected