{"version":3,"sources":["reorderable-repeat-strategy-locator.js"],"names":[],"mappings":"AAGA;IAEI,gBAAkB;IAClB,kBAAoB;IAetB,+CAGC;IAED,6BAUC;CACF","file":"reorderable-repeat-strategy-locator.d.ts","sourcesContent":["import {SimpleArrayRepeatStrategy} from './simple-array-repeat-strategy';\nimport {ArrayRepeatStrategy} from 'aurelia-templating-resources';\n\nexport class ReorderableRepeatStrategyLocator {\n  constructor() {\n    this.matchers = [];\n    this.strategies = [];\n    this.addStrategy(items => {\n      if (items instanceof Array) {\n        // Simple strategy is only for array of primitive value\n        return items.length === 0 || typeof items[0] !== 'object';\n      }\n    }, new SimpleArrayRepeatStrategy());\n    this.addStrategy(items => {\n      if (items instanceof Array) {\n        // Normal strategy is only for array of non-primitive value\n        return items.length && typeof items[0] === 'object';\n      }\n    }, new ArrayRepeatStrategy());\n  }\n\n  addStrategy(matcher, strategy) {\n    this.matchers.push(matcher);\n    this.strategies.push(strategy);\n  }\n\n  getStrategy(items) {\n    let matchers = this.matchers;\n\n    for (let i = 0, ii = matchers.length; i < ii; ++i) {\n      if (matchers[i](items)) {\n        return this.strategies[i];\n      }\n    }\n\n    return null;\n  }\n}\n"],"sourceRoot":"../src/"}