Make factory function from getter.
@param {function(value)|string} fn Base for getter.
@return {function(value)} Factory function.
189433
function factory(fn){
    if (typeof fn != 'function')
      fn = getter(fn);

    var result = function(value){
      return fn(value);
    };
    /** @cut */ result = devInfoResolver.patchFactory(result);
    result.factory = FACTORY;

    return result;
  }
927917
function factory(key, options) {
  var settings = options || {}

  function one(value) {
    var fn = one.invalid
    var handlers = one.handlers

    if (value && own.call(value, key)) {
      fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
    }

    return (fn || noop).apply(this, arguments)
  }

  one.handlers = settings.handlers || {}
  one.invalid = settings.invalid
  one.unknown = settings.unknown

  return one
}
52271
function construct (constructor, args) {
  function Factory () {
    return constructor.apply(this, args);
  }

  Factory.prototype = constructor.prototype;

  return new Factory();
}
205330
function factory(type) {
  point.displayName = type

  return point

  /* Get a point in `node.position` at a bound `type`. */
  function point(node) {
    var point = (node && node.position && node.position[type]) || {}

    return {
      line: point.line || null,
      column: point.column || null,
      offset: isNaN(point.offset) ? null : point.offset
    }
  }
}
1237386
function factory(name, schema = {}, options = {}) {
  class TangModel extends Model {
    constructor(data) {
      super(data, schema, options)
    }
  }

  TangModel.options = options
  TangModel.schema = schema

  Object.defineProperty(TangModel, 'name', { value: name })

  for (let name in schema.statics) {
    TangModel[name] = function() {
      return schema.statics[name].apply(TangModel, arguments)
    }
  }

  return TangModel
}
466411
function factory(tree, options) {
  var settings = options || {}
  var dangerous = settings.allowDangerousHTML

  h.dangerous = dangerous
  h.definition = definitions(tree, settings)
  h.footnotes = []
  h.augment = augment
  h.handlers = xtend(handlers, settings.handlers || {})

  visit(tree, 'footnoteDefinition', visitor)

  return h

  // Finalise the created `right`, a hast node, from `left`, an mdast node.
  function augment(left, right) {
    var data
    var ctx

    // Handle `data.hName`, `data.hProperties, `hChildren`.
    if (left && 'data' in left) {
      data = left.data

      if (right.type === 'element' && data.hName) {
        right.tagName = data.hName
      }

      if (right.type === 'element' && data.hProperties) {
        right.properties = xtend(right.properties, data.hProperties)
      }

      if (right.children && data.hChildren) {
        right.children = data.hChildren
      }
    }

    ctx = left && left.position ? left : {position: left}

    if (!generated(ctx)) {
      right.position = {
        start: position.start(ctx),
        end: position.end(ctx)
      }
    }

    return right
  }

  // Create an element for a `node`.
  function h(node, tagName, props, children) {
    if (
      (children === undefined || children === null) &&
      typeof props === 'object' &&
      'length' in props
    ) {
      children = props
      props = {}
    }

    return augment(node, {
      type: 'element',
      tagName: tagName,
      properties: props || {},
      children: children || []
    })
  }

  function visitor(definition) {
    h.footnotes.push(definition)
  }
}
761984
function(name, factory, object) {

                        var that = this;
                        var objects = this._resolveObjects(name, factory, object);

                        _.each(objects, function(factoryObjects, factory) {
                            _.each(factoryObjects, function(object, name) {
                                that._setObjectCreator([name], that._createObjectCreator(factory, object));
                            });
                        });

                        return this;
                    }
81531
public static <T0, R> FuncN<R> fromFunc(final Func1<? super T0, ? extends R> f) {
        return new FuncN<R>() {

            @SuppressWarnings("unchecked")
            @Override
            public R call(Object... args) {
                if (args.length != 1) {
                    throw new RuntimeException("Func1 expecting 1 argument.");
                }
                return f.call((T0) args[0]);
            }

        };
    }
1302384
function(fn){
      var token = new Token();
      var setter = function(value){
        this.set(fn.call(this, value));
      };

      if (typeof fn != 'function')
        fn = getter(fn);

      setter.call(token, this.get());

      this.attach(setter, token, token.destroy);
      token.attach($undef, this, function(){
        this.detach(setter, token);
      });

      /** @cut */ devInfoResolver.setInfo(token, 'sourceInfo', {
      /** @cut */   type: 'Token#as',
      /** @cut */   source: this,
      /** @cut */   transform: fn
      /** @cut */ });

      return token;
    }
547641
function createLoader(options, fn) {
  var loader = new utils.Loader(options);
  return function() {
    if (!this.isApp) loader.cache = this.views;
    loader.options.loaderFn = fn.bind(this);
    loader.load.apply(loader, arguments);
    return loader.cache;
  };
}
253322
function( fn ){
    var req;
    var fnName;

    if( $$.is.object(fn) && fn.fn ){ // manual fn
      req = fnAs( fn.fn, fn.name );
      fnName = fn.name;
      fn = fn.fn;
    } else if( $$.is.fn(fn) ){ // auto fn
      req = fn.toString();
      fnName = fn.name;
    } else if( $$.is.string(fn) ){ // stringified fn
      req = fn;
    } else if( $$.is.object(fn) ){ // plain object
      if( fn.proto ){
        req = '';
      } else {
        req = fn.name + ' = {};';
      }

      fnName = fn.name;
      fn = fn.obj;
    }

    req += '\n';

    var protoreq = function( val, subname ){
      if( val.prototype ){
        var protoNonempty = false;
        for( var prop in val.prototype ){ protoNonempty = true; break; };

        if( protoNonempty ){
          req += fnAsRequire( {
            name: subname,
            obj: val,
            proto: true
          }, val );
        }
      }
    };

    // pull in prototype
    if( fn.prototype && fnName != null ){

      for( var name in fn.prototype ){
        var protoStr = '';

        var val = fn.prototype[ name ];
        var valStr = stringifyFieldVal( val );
        var subname = fnName + '.prototype.' + name;

        protoStr += subname + ' = ' + valStr + ';\n';

        if( protoStr ){
          req += protoStr;
        }

        protoreq( val, subname ); // subobject with prototype
      }
  
    }

    // pull in properties for obj/fns
    if( !$$.is.string(fn) ){ for( var name in fn ){
      var propsStr = '';

      if( fn.hasOwnProperty(name) ){
        var val = fn[ name ];
        var valStr = stringifyFieldVal( val );
        var subname = fnName + '["' + name + '"]';

        propsStr += subname + ' = ' + valStr + ';\n';
      }

      if( propsStr ){
        req += propsStr;
      }

      protoreq( val, subname ); // subobject with prototype
    } }

    return req;
  }
1015779
function factory(options) {
  options = _.extend({}, options);

  return tartan.parse([
    tartan.parse.stripe(),
    tartan.parse.literal('('),
    tartan.parse.literal(')'),
    tartan.parse.literal('['),
    tartan.parse.literal(']'),
    tartan.parse.color({
      allowLongNames: true,
      colorPrefix: /[#]/,
      colorSuffix: null,
      colorFormat: 'long',
      allowComment: false
    })
  ], {
    errorHandler: options.errorHandler,
    processTokens: tartan.filter([
      options.processTokens,
      tartan.filter.removeTokens(tartan.defaults.insignificantTokens)
    ]),
    buildSyntaxTree: syntax({
      errorHandler: options.errorHandler,
      processTokens: tartan.filter.classify({
        // Disable some token classes
        isWarpAndWeftSeparator: null,
        isPivot: null,
        isBlockStart: null,
        isBlockEnd: null,

        // Add new token classes
        isWarpStart: function(token) {
          return tartan.utils.token.isLiteral(token) && (token.value == '[');
        },
        isWeftStart: function(token) {
          return tartan.utils.token.isLiteral(token) && (token.value == ']');
        },
        isBlockBodyStart: function(token) {
          return tartan.utils.token.isLiteral(token) && (token.value == '(');
        },
        isBlockBodyEnd: function(token) {
          return tartan.utils.token.isLiteral(token) && (token.value == ')');
        }
      }),
      transformSyntaxTree: options.transformSyntaxTree
    })
  });
}
205303
function (fn) {
        return function () {
            var tokens = arguments;
            var i;

            for (i = 0; i < tokens.length; i += 1) {
                fn.call(this, tokens[i]);
            }
        };
    }
910538
function(name) {
			var args = [].slice.call(arguments, 1);
			var factory = this.get(name);
			return factory ? factory.apply(this, args) : null;
		}
416814
function numberFactory (name, value) {
  const dependencies = ['config', 'BigNumber']

  return factory(name, dependencies, ({ config, BigNumber }) => {
    return config.number === 'BigNumber'
      ? new BigNumber(value)
      : value
  })
}
245555
def decorator(caller, _func=None):
    """"""
    if _func is not None:  # return a decorated function
        # this is obsolete behavior; you should use decorate instead
        return decorate(_func, caller)
    # else return a decorator function
    if inspect.isclass(caller):
        name = caller.__name__.lower()
        callerfunc = get_init(caller)
        doc = 'decorator(%s) converts functions/generators into ' \
            'factories of %s objects' % (caller.__name__, caller.__name__)
        fun = getfullargspec(callerfunc).args[1]  # second arg
    elif inspect.isfunction(caller):
        if caller.__name__ == '<lambda>':
            name = '_lambda_'
        else:
            name = caller.__name__
        callerfunc = caller
        doc = caller.__doc__
        fun = getfullargspec(callerfunc).args[0]  # first arg
    else:  # assume caller is an object with a __call__ method
        name = caller.__class__.__name__.lower()
        callerfunc = caller.__call__.__func__
        doc = caller.__call__.__doc__
        fun = getfullargspec(callerfunc).args[1]  # second arg
    evaldict = callerfunc.__globals__.copy()
    evaldict['_call_'] = caller
    evaldict['_decorate_'] = decorate
    return FunctionMaker.create(
        '%s(%s)' % (name, fun),
        'return _decorate_(%s, _call_)' % fun,
        evaldict, call=caller, doc=doc, module=caller.__module__,
        __wrapped__=caller)
262395
function(fn){
      // obsolete in 1.4
      /** @cut */ if (arguments.length > 1)
      /** @cut */   basis.dev.warn('basis.data.Value#as() doesn\'t accept deferred flag as second parameter anymore. Use value.as(fn).deferred() instead.');

      if (!fn || fn === $self)
        return this;

      if (typeof fn == 'string')
        fn = basis.getter(fn);

      if (this.links_)
      {
        // try to find value with the same function
        var cursor = this;
        var fnId = fn[GETTER_ID] || String(fn);

        while (cursor = cursor.links_)
        {
          var context = cursor.context;
          if (context instanceof ReadOnlyValue &&
              context.proxy &&
              (context.proxy[GETTER_ID] || String(context.proxy)) == fnId) // compare functions by id
          {
            /** @cut */ context = devWrap(context);

            return context;
          }
        }
      }

      // create transform value
      var result = new ReadOnlyValue({
        proxy: fn,
        value: this.value
      });

      /** @cut */ basis.dev.setInfo(result, 'sourceInfo', {
      /** @cut */   type: 'Value#as',
      /** @cut */   source: this,
      /** @cut */   sourceTarget: this.value,
      /** @cut */   transform: fn
      /** @cut */ });

      /** @cut */ if (fn.retarget)
      /** @cut */ {
      /** @cut */   result.proxy = function(value){
      /** @cut */     value = fn(value);
      /** @cut */     basis.dev.patchInfo(result, 'sourceInfo', {
      /** @cut */       sourceTarget: value
      /** @cut */     });
      /** @cut */     return value;
      /** @cut */   };
      /** @cut */   result.proxy[GETTER_ID] = fn[GETTER_ID]; // set the same GETTER_ID for correct search in links_
      /** @cut */ }

      this.link(result, valueSyncAs, true, result.destroy);

      return result;
    }