f="/tonglan/adminSystem/issues"> Issues 0 Pull Requests 0 Commits 3 Releases 0

No Description

index.js 2.7KB

    /*! * range-parser * Copyright(c) 2012-2014 TJ Holowaychuk * Copyright(c) 2015-2016 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module exports. * @public */ module.exports = rangeParser /** * Parse "Range" header `str` relative to the given file `size`. * * @param {Number} size * @param {String} str * @param {Object} [options] * @return {Array} * @public */ function rangeParser (size, str, options) { var index = str.indexOf('=') if (index === -1) { return -2 } // split the range string var arr = str.slice(index + 1).split(',') var ranges = [] // add ranges type ranges.type = str.slice(0, index) // parse all ranges for (var i = 0; i < arr.length; i++) { var range = arr[i].split('-') var start = parseInt(range[0], 10) var end = parseInt(range[1], 10) // -nnn if (isNaN(start)) { start = size - end end = size - 1 // nnn- } else if (isNaN(end)) { end = size - 1 } // limit last-byte-pos to current length if (end > size - 1) { end = size - 1 } // invalid or unsatisifiable if (isNaN(start) || isNaN(end) || start > end || start < 0) { continue } // add range ranges.push({ start: start, end: end }) } if (ranges.length < 1) { // unsatisifiable return -1 } return options && options.combine ? combineRanges(ranges) : ranges } /** * Combine overlapping & adjacent ranges. * @private */ function combineRanges (ranges) { var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart) for (var j = 0, i = 1; i < ordered.length; i++) { var range = ordered[i] var current = ordered[j] if (range.start > current.end + 1) { // next range ordered[++j] = range } else if (range.end > current.end) { // extend range current.end = range.end current.index = Math.min(current.index, range.index) } } // trim ordered array ordered.length = j + 1 // generate combined range var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex) // copy ranges type combined.type = ranges.type return combined } /** * Map function to add index value to ranges. * @private */ function mapWithIndex (range, index) { return { start: range.start, end: range.end, index: index } } /** * Map function to remove index value from ranges. * @private */ function mapWithoutIndex (range) { return { start: range.start, end: range.end } } /** * Sort function to sort ranges by index. * @private */ function sortByRangeIndex (a, b) { return a.index - b.index } /** * Sort function to sort ranges by start position. * @private */ function sortByRangeStart (a, b) { return a.start - b.start }
Kodo/kodo - Gogs: Go Git Service

565 Commits (2a288e9241138153dd11decd7247955c188e897e)

Autor SHA1 Mensagem Data
  Brightcells 2a288e9241 Create Database 8 anos atrás
  Brightcells 13816e8774 Fix Bug: REQUEST 8 anos atrás
  Brightcells 1ddb115c57 list_display 8 anos atrás
  Brightcells e04f95dc5e long => lon 8 anos atrás
  Brightcells a77c4993f8 FloatField 8 anos atrás
  Brightcells 340b18cdf2 FloatField 8 anos atrás
  Brightcells eacab44ee6 consumer_info 8 anos atrás
  Brightcells 1b1f0192f8 ConsumeInfoSubmitLogInfo 8 anos atrás
  Brightcells 1df0e3b9a1 optor_id => operator_id 8 anos atrás
  Brightcells a221274ff0 Update login/info 8 anos atrás
  Brightcells bb022c8722 Add api/infos 8 anos atrás
  Brightcells 5ab6542f69 Make account relative ReadOnly or ChangeOnly 8 anos atrás
  Brightcells 7d17a82ab8 Make group relative ReadOnly 8 anos atrás
  Brightcells c73d195d23 Make some message ReadOnly 8 anos atrás
  Brightcells d8dc3bb714 Make FeedbackInfo ReadOnly 8 anos atrás
  Brightcells 3a0f7169bb Make LatestAppInfo Only Exists One for Mch 8 anos atrás
  Brightcells 3d30d80acf Make LatestAppInfo Only Exists One by src 8 anos atrás
  Brightcells e1103a388e # DISABLE_ACTION = False 8 anos atrás
  Brightcells bc27d41f09 Change OrderInfo ReadOnly 8 anos atrás
  Brightcells b1de39086a Update Operator encryption only when password exists 8 anos atrás
  Brightcells 89108cc8cd Update list_filter 8 anos atrás
  Brightcells 49634dc097 Add api operator login 8 anos atrás
  Brightcells 917f2df489 Add api api/upgrade 8 anos atrás
  Brightcells d105aa6305 Update Django==1.11.9 8 anos atrás
  Brightcells 7919ab761d Change to use djagno-redis-connector 8 anos atrás
  Brightcells 208fc20a24 Change to use django-response 8 anos atrás
  Brightcells 9ec76d526a TextField => CharField 8 anos atrás
  Brightcells f3a6f01d94 Kodo update admin 8 anos atrás
  Brightcells 2181a06f23 Kodo update 8 anos atrás
  Brightcells 92e36486fe site_header 8 anos atrás
  Brightcells a7cbbf15a7 Update max_length for CharField 8 anos atrás
  Brightcells 7bb638568e Add sysctl.sh script 8 anos atrás
  Brightcells 9bb56c50cc Makemigrations 8 anos atrás
  Brightcells 135c21b40c from models_ext import BaseModelMixin, upload_file_url, upload_path 8 anos atrás
  Brightcells d28dca92ff CreateUpdateMixin => BaseModelMixin 8 anos atrás
  Brightcells bd794a93f4 logit for encrypt/decrypt 8 anos atrás
  Brightcells 78a87fa9b9 api/ 8 anos atrás
  Brightcells 0f648cced6 rsa==3.4.2 8 anos atrás
  Brightcells be7a80534a B64 only 8 anos atrás
  Brightcells c6a14e1496 django-models-ext==1.0.5 8 anos atrás
  Brightcells aa31a5f59a Add kodo 8 anos atrás
  Brightcells 95b4fd3782 Quote/UnQuote 8 anos atrás
  Brightcells 096e3811f4 New django-we with oauth_settings.py 8 anos atrás
  Brightcells 1d7cc7e786 V.wxChooseImageSuccess 8 anos atrás
  Brightcells 01d880bd8b V.wxChooseImageSuccess 8 anos atrás
  Brightcells d88a601cf7 LensmanInfoAdmin save_model not save 8 anos atrás
  Brightcells 8665f2ebd4 Fix Bug: ValueError: invalid literal for int() with base 10: '' 8 anos atrás
  Brightcells f3cf68f957 Add PAI2_HOME_WX_API for request.weixin 8 anos atrás
  Brightcells 511533855d Change oauth to use http 8 anos atrás
  Brightcells 3aba0380d6 OUTTAKE lensman not have watermark 8 anos atrás