• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript querystring.escape函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CURRENT_TIMESTAMP

 eta.db.query(sql, [req.session["userid"]], (err: eta.DBError, rows: any[]) => {
     if (err) {
         eta.logger.dbError(err);
         res.redirect("/apply?error=" + querystring.escape("We were unable to process your application due to an internal error."));
         return;
     }
     let valueSql: string = "(?, ?, 1),".repeat(positions.length);
     let sql: string = `
         INSERT INTO ApplicantPosition
         (id, position, count)
         VALUES ${valueSql.substring(0, valueSql.length - 1)}
         ON DUPLICATE KEY UPDATE
             lastApplied = CURRENT_TIMESTAMP(),
             count = count + 1`;
     let params: string[] = [];
     for (let i: number = 0; i < positions.length; i++) {
         params.push(req.session["userid"]);
         params.push(positions[i]);
     }
     eta.db.query(sql, params, (err: eta.DBError, rows: any[]) => {
         if (err) {
             eta.logger.dbError(err);
             res.redirect("/apply?error=" + querystring.escape("We were unable to process your application due to an internal error."));
             return;
         }
         res.redirect("/apply?success=true");
     });
 });
开发者ID:crossroads-education,项目名称:eta-front,代码行数:28,代码来源:apply.ts


示例2:

 }, (err: Error, info: nodemailer.SentMessageInfo) => {
     if (err) {
         eta.logger.warn("Could not send mail from " + req.body.email + ": " + err.message);
         res.redirect("/contact?error=" + querystring.escape("failed-to-send-email"));
         return;
     }
     res.redirect("/contact?success=true");
 });
开发者ID:crossroads-education,项目名称:eta-front,代码行数:8,代码来源:contact.ts


示例3:

 eta.db.query(sql, params, (err: eta.DBError, rows: any[]) => {
     if (err) {
         eta.logger.dbError(err);
         res.redirect("/apply?error=" + querystring.escape("We were unable to process your application due to an internal error."));
         return;
     }
     res.redirect("/apply?success=true");
 });
开发者ID:crossroads-education,项目名称:eta-front,代码行数:8,代码来源:apply.ts


示例4:

 eta.setting.set(req.body.page, req.body.name, req.body.value, req.body.type, (success: boolean) => {
     eta.logger.trace("Setting set: " + success);
     eta.setting.init();
     if (req.body.shouldRedirect) {
         res.redirect("../edit/settings?lastPage=" + querystring.escape(req.body.page));
     } else {
         res.send(success.toString());
     }
 });
开发者ID:crossroads-education,项目名称:eta-sys,代码行数:9,代码来源:settings.ts


示例5: requireAuthCookieOrRedirect

export function requireAuthCookieOrRedirect(req, res, next) {
  if (req['authSession'].signed_in !== true) {
    var url = util.format('/login?redirect=%s', qs.escape(req.path));
    return res.redirect(url);
  }
  res.locals.user = getUser(req);
  res.locals.signOutCsrfToken = req.authSession.signOutCsrfToken;
  next();
}
开发者ID:valtech,项目名称:valtech-shortie,代码行数:9,代码来源:middleware.ts


示例6: generateDataUri

	public async generateDataUri(data: string): Promise<string> {
		let result: string = null;
		try {
			const qrSvg = imageSync(data, { size: this.$staticConfig.QR_SIZE, type: "svg" }).toString();
			result = `data:image/svg+xml;utf-8,${escape(qrSvg)}`;
		} catch (err) {
			this.$logger.trace(`Failed to generate QR code for ${data}`, err);
		}

		return result;
	}
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:11,代码来源:qr.ts


示例7: render

 public render(req: express.Request, res: express.Response, callback: (env: { [key: string]: any }) => void): void {
     // check if a position was selected
     let positions: string[] = [];
     for (let param in req.body) {
         if (param.startsWith("Position:")) {
             positions.push(param.split(":")[1]);
         }
     }
     if (positions.length == 0) {
         res.redirect("/apply?error=" + querystring.escape("Please select positions before submitting your application."));
         return;
     }
     let sql: string = `
         INSERT IGNORE INTO Applicant
         (id, notes, workStudy, phone, altEmail)
         VALUES (?, '', 0, '', '')`;
     eta.db.query(sql, [req.session["userid"]], (err: eta.DBError, rows: any[]) => {
         if (err) {
             eta.logger.dbError(err);
             res.redirect("/apply?error=" + querystring.escape("We were unable to process your application due to an internal error."));
             return;
         }
         let valueSql: string = "(?, ?, 1),".repeat(positions.length);
         let sql: string = `
             INSERT INTO ApplicantPosition
             (id, position, count)
             VALUES ${valueSql.substring(0, valueSql.length - 1)}
             ON DUPLICATE KEY UPDATE
                 lastApplied = CURRENT_TIMESTAMP(),
                 count = count + 1`;
         let params: string[] = [];
         for (let i: number = 0; i < positions.length; i++) {
             params.push(req.session["userid"]);
             params.push(positions[i]);
         }
         eta.db.query(sql, params, (err: eta.DBError, rows: any[]) => {
             if (err) {
                 eta.logger.dbError(err);
                 res.redirect("/apply?error=" + querystring.escape("We were unable to process your application due to an internal error."));
                 return;
             }
             res.redirect("/apply?success=true");
         });
     });
 }
开发者ID:crossroads-education,项目名称:eta-front,代码行数:45,代码来源:apply.ts


示例8:

        let sep: string;
        let eq: string;
        let options: querystring.ParseOptions;
        let result: SampleObject;

        result = querystring.parse<SampleObject>(str);
        result = querystring.parse<SampleObject>(str, sep);
        result = querystring.parse<SampleObject>(str, sep, eq);
        result = querystring.parse<SampleObject>(str, sep, eq, options);
    }

    {
        let str: string;
        let result: string;

        result = querystring.escape(str);
        result = querystring.unescape(str);
    }
}

////////////////////////////////////////////////////
/// path tests : http://nodejs.org/api/path.html
////////////////////////////////////////////////////

namespace path_tests {

    path.normalize('/foo/bar//baz/asdf/quux/..');

    path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
    // returns
    //'/foo/bar/baz/asdf'
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:31,代码来源:node-tests.ts


示例9: Buffer

////////////////////////////////////////////////////
/// Dgram tests : http://nodejs.org/api/dgram.html
////////////////////////////////////////////////////

var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
});
var ai: dgram.AddressInfo = ds.address();
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
});

////////////////////////////////////////////////////
///Querystring tests : https://gist.github.com/musubu/2202583
////////////////////////////////////////////////////

var original: string = 'http://example.com/product/abcde.html';
var escaped: string = querystring.escape(original);
console.log(escaped);
// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html
var unescaped: string = querystring.unescape(escaped);
console.log(unescaped);
// http://example.com/product/abcde.html

////////////////////////////////////////////////////
/// path tests : http://nodejs.org/api/path.html
////////////////////////////////////////////////////

namespace path_tests {

    path.normalize('/foo/bar//baz/asdf/quux/..');

    path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
开发者ID:demurgos,项目名称:env-node,代码行数:31,代码来源:index.ts


示例10: percentEncode

export function percentEncode(input: string): string {
  return qs.escape(input)
           .replace(/[!'()*]/g, c => `%${c.charCodeAt(0).toString(16)}`);
}
开发者ID:hashedhyphen,项目名称:twix,代码行数:4,代码来源:utils.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript querystring.parse函数代码示例发布时间:2022-05-25
下一篇:
TypeScript query-string.stringify函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap