methods method

  1. @override
Map<String, Function> methods()
override

Implementation

@override
Map<String, Function> methods() {
  return {
    'init': () => {},
    'assign': (dynamic target, [dynamic source, dynamic source2]) {
      if (target is! Map) return target;
      for (final sourceValue in [source, source2]) {
        if (sourceValue is Map) {
          for (final key
              in InvokableController.ownEnumerableKeys(sourceValue)) {
            InvokableController.setProperty(target, key,
                InvokableController.getProperty(sourceValue, key));
          }
        }
      }
      return target;
    },
    'create': (dynamic proto) {
      final Map<String, dynamic> obj = {};
      if (proto != null) {
        InvokableController.setPrototype(obj, proto);
      }
      return obj;
    },
  };
}