{"map":"{\"version\":3,\"file\":\"limit.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/select/limit.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,EAAE,MAAM,EAAmB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAErE,MAAM,UAAU,UAAU,CACxB,OAAmC,EACnC,QAAe;IAEf,2DAA2D;IAC3D,4DAA4D;IAC5D,wDAAwD;IACxD,4DAA4D;IAC5D,2DAA2D;IAC3D,oBAAoB;IACpB,0DAA0D;IAC1D,uBAAuB;IACvB,MAAM,CACJ,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,EACvB,6CAA6C,CAC9C,CAAC;IACF,IAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAW,CAAC;IACtD,OAAO,OAAO,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAlB,CAAkB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAuC,EACvC,QAAe;IAEf,IAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAW,CAAC;IACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,IAAI,CAAC;AACd,CAAC\"}","code":"import { assert, astValueToNative } from '../utils';\r\nexport function applyLimit(queries, astLimit) {\r\n    // node-sqlparser's implementation of LIMIT is a bit buggy.\r\n    // If limit and offset are passed, it returns an array where\r\n    // the first item is the limit and the second one is the\r\n    // offset, but if no offset is specified then the first item\r\n    // in the array is the number 0 and the second one contains\r\n    // the actual limit.\r\n    // Plus, it throws an error if there's a newline character\r\n    // following the limit.\r\n    assert(astLimit[0].value === 0, \"LIMIT doesn't support specifying an OFFSET.\");\r\n    var limit = astValueToNative(astLimit[1]);\r\n    return queries.map(function (query) { return query.limit(limit); });\r\n}\r\nexport function applyLimitLocally(docs, astLimit) {\r\n    var limit = astValueToNative(astLimit[1]);\r\n    docs.splice(limit);\r\n    return docs;\r\n}\r\n//# sourceMappingURL=limit.js.map","dts":{"name":"C:/www/npm-packages/fire-sql/dist/types/select/limit.d.ts","writeByteOrderMark":false,"text":"export declare function applyLimit(queries: firebase.firestore.Query[], astLimit: any[]): firebase.firestore.Query[];\r\nexport declare function applyLimitLocally(docs: firebase.firestore.DocumentData[], astLimit: any[]): firebase.firestore.DocumentData[];\r\n"}}
