Home Reference Source Test Repository

buildDocs/ary.js

import { ary } from 'lodash';
import { DecoratorConfig, DecoratorFactory } from './factory';
import { PreValueApplicator } from './applicators';
/**
 * Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.
 * @param {number} n The arity cap.
 * @example
 *
 * class MyClass {
 *   @Ary(1)
 *   fn(...args) {
 *     return args;
 *   }
 * }
 *
 * const myClass = new MyClass();
 *
 * myClass.fn(1, 2, 3, 4); // => [ 1 ]
 */
export const Ary = DecoratorFactory.createDecorator(new DecoratorConfig(ary, new PreValueApplicator()));
export { Ary as ary };
export default Ary;