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


TypeScript query-string.parse函数代码示例

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


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

示例1: getFileServerRelativeUrl

function getFileServerRelativeUrl(): JQueryPromise<any> {
    let deferred: JQueryDeferred<any> = $.Deferred();

    let parsed: any = parse(location.search);

    return deferred.promise();
}
开发者ID:Frederick-S,项目名称:SharePoint-Add-in-Move-File,代码行数:7,代码来源:index.ts

示例2: Prompt

 Prompt('Save Serverspec', "filename").then((fname) => {
   const s = new Serverspec();
   const infra_id_str: string = qs.parse(location.search).infrastructure_id;
   const infra_id: number     = infra_id_str ? parseInt(infra_id_str) : null;
   const code = 'require "serverspec_helper"\n\n' + app.rubyCode;
   return s.create(fname, code, infra_id);
 }).then(
开发者ID:pocke,项目名称:skyhopper,代码行数:7,代码来源:serverspec-gen.ts

示例3: gotoQueryParams

	// I navigate to the current URL with the given name-value pairs in the query-string.
	// This method is designed to leave all other query-string parameters in place.
	public gotoQueryParams( delta: { [key: string]: any } ) : void {

		var parts = this.router.path().split( "?" );
		var pathString = parts.shift();
		var queryString = parts.shift();
		var updatedQueryParams = parse( queryString );

		for ( var key in delta ) {

			if ( delta[ key ] === null ) {

				delete( updatedQueryParams[ key ] );

			} else {

				updatedQueryParams[ key ] = delta[ key ];

			}

		}


		this.router.go( pathString, updatedQueryParams );

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:27,代码来源:router-utils.ts

示例4: defaultGroups

export function defaultGroups(facultyMap: FacultyDepartments, query: string = ''): FilterGroups {
  const params = qs.parse(query);

  const faculties = Object.keys(facultyMap);
  const departments = flatten(values(facultyMap));

  const groups: FilterGroups = {
    [SEMESTER]: new FilterGroup(
      SEMESTER,
      'Available In',
      map(config.semesterNames, (name, semesterStr) => {
        const semester = parseInt(semesterStr, 10);
        return new Filter(
          semesterStr,
          name,
          (module) => !!module.semesterData.find((semData) => semData.semester === semester),
        );
      }),
    ),

    [LEVELS]: new FilterGroup(
      LEVELS,
      'Levels',
      moduleLevels.map((level) => new LevelFilter(level)),
    ),

    [MODULE_CREDITS]: new FilterGroup(MODULE_CREDITS, 'Module Credit', [
      new Filter('0', '0-3 MC', (module) => parseFloat(module.moduleCredit) <= 3),
      new Filter('4', '4 MC', (module) => module.moduleCredit === '4'),
      new Filter('5', '5-8 MC', (module) => {
        const credits = parseFloat(module.moduleCredit);
        return credits > 4 && credits <= 8;
      }),
      new Filter('8', 'More than 8 MC', (module) => parseInt(module.moduleCredit, 10) > 8),
    ]),

    [DEPARTMENT]: makeDepartmentFilterGroup(departments),

    [FACULTY]: makeFacultyFilterGroup(faculties),

    [EXAMS]: makeExamFilter(),

    [ATTRIBUTES]: new FilterGroup(ATTRIBUTES, 'Others', [
      makeAttributeFilter('su'),
      makeAttributeFilter('grsu'),
      makeAttributeFilter('ssgf'),
      makeAttributeFilter('sfs'),
      makeAttributeFilter('lab'),
      makeAttributeFilter('ism'),
    ]),
  };

  // Search query group
  if (params[SEARCH_QUERY_KEY]) {
    groups[SEARCH_QUERY_KEY] = createSearchFilter(params[SEARCH_QUERY_KEY]);
  }

  return updateGroups(groups, query);
}
开发者ID:nusmodifications,项目名称:nusmods,代码行数:59,代码来源:moduleFilters.ts

示例5: parseQueryString

 .map<NextInstruction>(set => {
   return {
     locationChange: change,
     routeConfigs: set.routes,
     queryParams: parseQueryString(queryString),
     routeParams: set.params
   };
 });
开发者ID:nathasm,项目名称:router,代码行数:8,代码来源:router-instruction.ts

示例6: parseQueryString

 .map<NextRoute>(set => {
   return {
     url: location$.path(),
     routes: set.routes,
     query: parseQueryString(queryString),
     params: set.params
   };
 });
开发者ID:fxck,项目名称:router,代码行数:8,代码来源:route-set.ts

示例7: isDebugMode

export function isDebugMode() {
	if (typeof window !== 'undefined') {
		const queryObject = parse(window.location.search)
		return queryObject.debug !== undefined
	} else {
		return false
	}
}
开发者ID:gaearon,项目名称:react-dnd,代码行数:8,代码来源:isDebugMode.ts

示例8: isExperimentalApiMode

export function isExperimentalApiMode() {
	if (typeof window !== 'undefined') {
		const queryObject = parse(window.location.search)
		return queryObject.experimental !== undefined
	} else {
		return false
	}
}
开发者ID:gaearon,项目名称:react-dnd,代码行数:8,代码来源:renderHtmlAst.ts

示例9: getPolls

const mapState = (state: RootState, ownProps: Props): MapStateProps => {
  const queryParams: QueryParams = queryString.parse(ownProps.location.search)
  return {
    type: ownProps.type || queryParams.type || 'all',
    status: ownProps.status || queryParams.status || 'all',
    page: +queryParams.page || 1,
    polls: getPolls(state),
    totalRows: getTotal(state)
  }
}
开发者ID:decentraland,项目名称:agora,代码行数:10,代码来源:PollsTable.container.ts

示例10: authCallback

export function authCallback(urlString: string): types.AuthenticateResponse {
    const paramsString = urlString.slice(urlString.indexOf('?') + 1);
    const params = querystring.parse(paramsString);

    return {
        code: params['code'],
        state: params['state'],
        error: params['error']
    };
}
开发者ID:emonkak,项目名称:feedpon,代码行数:10,代码来源:api.ts

示例11: updateGroups

export function updateGroups(groups: FilterGroups, query: string): FilterGroups {
  const params = qs.parse(query);

  return produce(groups, (draft) => {
    each(draft, (group) => {
      const currentQuery = group.toQueryString();
      if (currentQuery === params[group.id] || (!params[group.id] && !currentQuery)) return;
      draft[group.id] = group.fromQueryString(params[group.id]);
    });
  });
}
开发者ID:nusmodifications,项目名称:nusmods,代码行数:11,代码来源:moduleFilters.ts

示例12: Error

 return TMAuth.httpClient.get<string>(accessTokenUri, header).then(rt => {         
     let response: TMAuthRequestTokenResponse = {};
     let qsParts = qs.parse(rt.Response);
     response.oauth_token = qsParts["oauth_token"];
     response.oauth_token_secret = qsParts["oauth_token_secret"];
     if (qsParts.oauth_token === undefined || 
         qsParts.oauth_token_secret === undefined) {
         throw new Error(rt.Response);
     }
     return response;
 });
开发者ID:wizact,项目名称:tmj-cli,代码行数:11,代码来源:TMAuth.ts

示例13: each

export const parseQueryString = (
  location: LocationState
): { [key: string]: string } => {
  const query = {
    ...parseQs(location.search.substr(1))
  };
  each(query, (value, key) => {
    if (Array.isArray(value)) {
      query[key] = value[0];
    }
  });
  return query as { [key: string]: string };
};
开发者ID:p2p-ms,项目名称:front,代码行数:13,代码来源:utils.ts

示例14: parse

  parse(url: string) {
    const queryParams: any = queryString.parse(parseUri(url).query);
    const queryFromUrl = new Query(queryParams[this.urlConfig.queryParam] || '')
      .withConfiguration(this.config, CONFIGURATION_MASK);

    if (queryParams.refinements) {
      const refinements = JSON.parse(queryParams.refinements);
      if (refinements.length > 0) {
        queryFromUrl.withSelectedRefinements(...refinements);
      }
    }

    return queryFromUrl;
  }
开发者ID:groupby,项目名称:searchandiser-ui,代码行数:14,代码来源:simple-beautifier.ts

示例15: dispatch

const mapDispatch = (dispatch: any, ownProps: any): MapDispatchProps => {
  const queryParams: QueryParams = queryString.parse(ownProps.location.search)
  const type = ownProps.type || queryParams.type || 'all'
  const status = ownProps.status || queryParams.status || 'all'
  return {
    onPageChange: (page: number) =>
      dispatch(navigateTo(locations.pollsTable(page, type, status))),
    onStatusChange: (status: FilterStatus) =>
      dispatch(navigateTo(locations.pollsTable(1, type, status))),
    onFetchPolls: (pagination: PollsRequestFilters) =>
      dispatch(fetchPollsRequest(pagination)),
    onNavigate: (location: string) => dispatch(navigateTo(location))
  }
}
开发者ID:decentraland,项目名称:agora,代码行数:14,代码来源:PollsTable.container.ts


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