当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript jQuery.isArray函数代码示例

本文整理汇总了TypeScript中jQuery.isArray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isArray函数的具体用法?TypeScript isArray怎么用?TypeScript isArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了isArray函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: buildEventDefs

  buildEventDefs(isAllDay) {
    let rawComplexDef = this.rawComplexDef
    let rawDefs = []
    let requireDow = false
    let i
    let defs = []

    if (rawComplexDef === true) {
      rawDefs = [ {} ] // will get BUSINESS_HOUR_EVENT_DEFAULTS verbatim
    } else if ($.isPlainObject(rawComplexDef)) {
      rawDefs = [ rawComplexDef ]
    } else if ($.isArray(rawComplexDef)) {
      rawDefs = rawComplexDef
      requireDow = true // every sub-definition NEEDS a day-of-week
    }

    for (i = 0; i < rawDefs.length; i++) {
      if (!requireDow || rawDefs[i].dow) {
        defs.push(
          this.buildEventDef(isAllDay, rawDefs[i])
        )
      }
    }

    return defs
  }
开发者ID:caseyjhol,项目名称:fullcalendar,代码行数:26,代码来源:BusinessHourGenerator.ts

示例2: processOptions

  /* Options
  ------------------------------------------------------------------------------------------------------------------*/


  // Parses various options into properties of this object
  processOptions() {
    let slotDuration = this.opt('slotDuration')
    let snapDuration = this.opt('snapDuration')
    let input

    slotDuration = moment.duration(slotDuration)
    snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration

    this.slotDuration = slotDuration
    this.snapDuration = snapDuration
    this.snapsPerSlot = slotDuration / snapDuration // TODO: ensure an integer multiple?

    // might be an array value (for TimelineView).
    // if so, getting the most granular entry (the last one probably).
    input = this.opt('slotLabelFormat')
    if ($.isArray(input)) {
      input = input[input.length - 1]
    }

    this.labelFormat = input ||
      this.opt('smallTimeFormat') // the computed default

    input = this.opt('slotLabelInterval')
    this.labelInterval = input ?
      moment.duration(input) :
      this.computeLabelInterval(slotDuration)
  }
开发者ID:enhazappe,项目名称:fullcalendar,代码行数:32,代码来源:TimeGrid.ts

示例3: parse

  static parse(rawInput, calendar) {
    let rawProps

    // normalize raw input
    if ($.isArray(rawInput.events)) { // extended form
      rawProps = rawInput
    } else if ($.isArray(rawInput)) { // short form
      rawProps = { events: rawInput }
    }

    if (rawProps) {
      return EventSource.parse.call(this, rawProps, calendar)
    }

    return false
  }
开发者ID:caseyjhol,项目名称:fullcalendar,代码行数:16,代码来源:ArrayEventSource.ts

示例4: transform

    transform(value: Array<any>, args: string[] = null): any {
        let filter:any = args[0];
        if (filter && $.isArray(value)) {

            let allUndefined:boolean = true;
            Object.keys(filter).forEach((key:string) => {
                if(filter[key]) {
                    allUndefined = false;
                }
            });

            if(allUndefined) {
                return value;
            }

            return value.filter((item:any) => {
                let valid:boolean = false;
                Object.keys(filter).forEach((key:string) => {
                    if(item[key] && item[key].toLowerCase().indexOf(filter[key].toLowerCase()) !== -1) {
                        valid = true;
                    }
                });
                return valid;
            });
        } else {
            return value;
        }
    }
开发者ID:michaeldesigaud,项目名称:palmashow-app,代码行数:28,代码来源:pipes.ts

示例5: parseFieldSpecs

export function parseFieldSpecs(input) {
  let specs = []
  let tokens = []
  let i
  let token

  if (typeof input === 'string') {
    tokens = input.split(/\s*,\s*/)
  } else if (typeof input === 'function') {
    tokens = [ input ]
  } else if ($.isArray(input)) {
    tokens = input
  }

  for (i = 0; i < tokens.length; i++) {
    token = tokens[i]

    if (typeof token === 'string') {
      specs.push(
        token.charAt(0) === '-' ?
          { field: token.substring(1), order: -1 } :
          { field: token, order: 1 }
      )
    } else if (typeof token === 'function') {
      specs.push({ func: token })
    }
  }

  return specs
}
开发者ID:enhazappe,项目名称:fullcalendar,代码行数:30,代码来源:util.ts

示例6: makeMoment

// Builds an enhanced moment from args. When given an existing moment, it clones. When given a
// native Date, or called with no arguments (the current time), the resulting moment will be local.
// Anything else needs to be "parsed" (a string or an array), and will be affected by:
//    parseAsUTC - if there is no zone information, should we parse the input in UTC?
//    parseZone - if there is zone information, should we force the zone of the moment?
function makeMoment(args, parseAsUTC= false, parseZone= false) {
  let input = args[0]
  let isSingleString = args.length === 1 && typeof input === 'string'
  let isAmbigTime
  let isAmbigZone
  let ambigMatch
  let mom

  if (moment.isMoment(input) || isNativeDate(input) || input === undefined) {
    mom = moment.apply(null, args)
  } else { // "parsing" is required
    isAmbigTime = false
    isAmbigZone = false

    if (isSingleString) {
      if (ambigDateOfMonthRegex.test(input)) {
        // accept strings like '2014-05', but convert to the first of the month
        input += '-01'
        args = [ input ] // for when we pass it on to moment's constructor
        isAmbigTime = true
        isAmbigZone = true
      } else if ((ambigMatch = ambigTimeOrZoneRegex.exec(input))) {
        isAmbigTime = !ambigMatch[5] // no time part?
        isAmbigZone = true
      }
    } else if ($.isArray(input)) {
      // arrays have no timezone information, so assume ambiguous zone
      isAmbigZone = true
    }
    // otherwise, probably a string with a format

    if (parseAsUTC || isAmbigTime) {
      mom = moment.utc.apply(moment, args)
    } else {
      mom = moment.apply(null, args)
    }

    if (isAmbigTime) {
      mom._ambigTime = true
      mom._ambigZone = true // ambiguous time always means ambiguous zone
    } else if (parseZone) { // let's record the inputted zone somehow
      if (isAmbigZone) {
        mom._ambigZone = true
      } else if (isSingleString) {
        mom.utcOffset(input) // if not a valid zone, will assign UTC
      }
    }
  }

  mom._fullCalendar = true // flag for extended functionality

  return mom
}
开发者ID:caseyjhol,项目名称:fullcalendar,代码行数:58,代码来源:moment-ext.ts

示例7: multiQuerySources

  // like querySources, but accepts multple match criteria (like multiple IDs)
  multiQuerySources(matchInputs) {

    // coerce into an array
    if (!matchInputs) {
      matchInputs = []
    } else if (!$.isArray(matchInputs)) {
      matchInputs = [ matchInputs ]
    }

    let matchingSources = []
    let i

    // resolve raw inputs to real event source objects
    for (i = 0; i < matchInputs.length; i++) {
      matchingSources.push.apply( // append
        matchingSources,
        this.querySources(matchInputs[i])
      )
    }

    return matchingSources
  }
开发者ID:caseyjhol,项目名称:fullcalendar,代码行数:23,代码来源:EventManager.ts

示例8: processOptions

  /* Options
  ------------------------------------------------------------------------------------------------------------------*/


  // Parses various options into properties of this object
  processOptions() {
    let slotDuration = this.opt('slotDuration')
    let snapDuration = this.opt('snapDuration')
    let input

    slotDuration = moment.duration(slotDuration)
    snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration

    this.slotDuration = slotDuration
    this.snapDuration = snapDuration
    this.snapsPerSlot = slotDuration / snapDuration // TODO: ensure an integer multiple?

    // might be an array value (for TimelineView).
    // if so, getting the most granular entry (the last one probably).
    input = this.opt('slotLabelFormat')
    if ($.isArray(input)) {
      input = input[input.length - 1]
    }

    this.labelFormat = input ||
      this.opt('smallTimeFormat') // the computed default

    let slots = this.opt('slots')
    if (slots && Array.isArray(slots)) {
      // filter valid slots
      slots = $.grep(slots, function(sl) {
        return sl.hasOwnProperty('start') && sl.hasOwnProperty('end') &&
          typeof(sl.start) === 'string' && typeof(sl.end) === 'string' &&
          sl.start.match(/^[0-9]{1,2}:[0-9]{1,2}(:[0-9]{1,2})?$/) &&
          sl.end.match(/^[0-9]{1,2}:[0-9]{1,2}(:[0-9]{1,2})?$/) &&
          true
      })
      if (slots.length >= 1) { // require at least 1 slot to display properly
        // sort slots by start time
        slots.sort(function(sl1, sl2) {
          let start1 = moment(sl1.start, 'HH:mm:ss')
          let start2 = moment(sl2.start, 'HH:mm:ss')
          if (start1.isBefore(start2)) {
            return -1
          } else if (start2.isBefore(start1)) {
            return 1
          } else {
            return 0
          }
        })

        // make sure each slot ends after it starts, and before the next one starts
        for (let i = 0; i < slots.length; i++) {
          let start1 = moment(slots[i].start, 'HH:mm:ss')
          let end1 = moment(slots[i].end, 'HH:mm:ss')
          if (end1.isBefore(start1)) {
            slots[i].end = slots[i].start
          }
          if (i + 1 < slots.length) {
            let start2 = moment(slots[i + 1].start, 'HH:mm:ss')
            if (start2.isBefore(end1)) {
              slots[i].end = slots[i + 1].start
            }
          }
        }
        this.slots = slots

        // options related to slots
        let showSlotEndTime = this.opt('showSlotEndTime')
        if (showSlotEndTime !== false) { // defaults to true
          this.showSlotEndTime = true
        }
        let showMinorSlotTime = this.opt('showMinorSlotTime')
        if (showMinorSlotTime !== false) { // defaults to true
          this.showMinorSlotTime = true
        }
        let snapOnSlots = this.opt('snapOnSlots')
        if (snapOnSlots && (snapOnSlots === true || // defaults to false
            snapOnSlots.hasOwnProperty('snapPolicy')
          )) {
          this.snapOnSlots = {
            snapPolicy: 'enlarge' // could also be 'closest'
          }
          if (snapOnSlots.snapPolicy === 'closest') {
            this.snapOnSlots.snapPolicy = 'closest'
          }
        }
      }
    }

    input = this.opt('slotLabelInterval')
    this.labelInterval = input ?
      moment.duration(input) :
      this.computeLabelInterval(slotDuration)
  }
开发者ID:kleisauke,项目名称:fullcalendar,代码行数:95,代码来源:TimeGrid.ts


注:本文中的jQuery.isArray函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。