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


TypeScript strip-bom.default函数代码示例

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


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

示例1: function

 files: function () {
   if (this._files) { return this._files; }
   this.isDummy = this.options.dummy;
   let sitemapFile = path.join(this.options.metadataDir, "application", "sitemap.json");
   let sitemap: metadata.Sitemap = JSON.parse(stripBom(fs.readFileSync(sitemapFile, "utf8")));
   if (this.project.isEmberCLIAddon() && !this.options.dummy) {
     if (sitemap.mobile) {
       this._files = CommonUtils.getFilesForGeneration(this, function (v) { return v === "__root__/locales/en/translations.js" || v === "__root__/locales/ru/translations.js"; });
     } else {
       this._files = CommonUtils.getFilesForGeneration(this, function (v) { return v === "__root__/templates/mobile/application.hbs" || v === "__root__/locales/en/translations.js" || v === "__root__/locales/ru/translations.js"; });
     }
   } else {
     if (sitemap.mobile) {
         this._files = CommonUtils.getFilesForGeneration(this, function (v) { return v === "addon/locales/en/translations.js" || v === "addon/locales/ru/translations.js"; });
     } else {
         this._files = CommonUtils.getFilesForGeneration(this, function (v) { return v === "__root__/templates/mobile/application.hbs" || v === "addon/locales/en/translations.js" || v === "addon/locales/ru/translations.js"; });
     }
   }
   if (this.project.isEmberCLIAddon() || this.options.dummy) {
       lodash.remove(this._files, function (v) { return v === "public/assets/images/cat.gif" || v === "public/assets/images/favicon.ico" || v === "public/assets/images/flexberry-logo.png"; });
   } else {
       lodash.remove(this._files, function (v) { return v === "test/dummy/public/assets/images/cat.gif" || v === "test/dummy/public/assets/images/favicon.ico" || v === "test/dummy/public/assets/images/flexberry-logo.png"; });
   }
   this._excludeIfExists();
   return this._files;
 },
开发者ID:Flexberry,项目名称:ember-flexberry,代码行数:26,代码来源:index.ts

示例2: _loadModule

  private _loadModule(
    localModule: InitialModule,
    from: Config.Path,
    moduleName: string | undefined,
    modulePath: Config.Path,
    options: InternalModuleOptions | undefined,
    moduleRegistry: ModuleRegistry,
  ) {
    if (path.extname(modulePath) === '.json') {
      const text = stripBOM(fs.readFileSync(modulePath, 'utf8'));

      const transformedFile = this._scriptTransformer.transformJson(
        modulePath,
        this._getFullTransformationOptions(options),
        text,
      );

      localModule.exports = this._environment.global.JSON.parse(
        transformedFile,
      );
    } else if (path.extname(modulePath) === '.node') {
      localModule.exports = require(modulePath);
    } else {
      // Only include the fromPath if a moduleName is given. Else treat as root.
      const fromPath = moduleName ? from : null;
      this._execModule(localModule, options, moduleRegistry, fromPath);
    }
    localModule.loaded = true;
  }
开发者ID:facebook,项目名称:jest,代码行数:29,代码来源:index.ts

示例3: parseContent

export function parseContent(contents: string, filename: string): TSConfig {
    const data = stripComments(stripBom(contents));

    // A tsconfig.json file is permitted to be completely empty.
    if (/^\s*$/.test(data)) {
        return {};
    }

    return parseJson(data, null, filename);
}
开发者ID:DevinNorgarb,项目名称:chat-app-electron,代码行数:10,代码来源:tsconfig-utils.ts

示例4: prepareData

export function prepareData(chunk: Buffer, runtime: ParseRuntime): string {
  const workChunk = concatLeftChunk(chunk, runtime);
  runtime.csvLineBuffer = undefined;
  const cleanCSVString = cleanUtf8Split(workChunk, runtime).toString("utf8");
  if (runtime.started === false) {
    return stripBom(cleanCSVString);
  } else {
    return cleanCSVString;
  }
}
开发者ID:Keyang,项目名称:node-csvtojson,代码行数:10,代码来源:dataClean.ts

示例5: constructor

 constructor(blueprint, options) {
   let listFormsDir = path.join(options.metadataDir, "list-forms");
   if (!options.file) {
     options.file = options.entity.name + ".json";
   }
   let localePathTemplate: lodash.TemplateExecutor = this.getLocalePathTemplate(options, blueprint.isDummy, path.join("forms", options.entity.name + ".js"));
   this.locales = new Locales(options.entity.name, "ru", localePathTemplate);
   let listFormFile = path.join(listFormsDir, options.file);
   let content = stripBom(fs.readFileSync(listFormFile, "utf8"));
   this.listForm = JSON.parse(content);
   this.locales.setupForm(this.listForm);
 }
开发者ID:Flexberry,项目名称:ember-flexberry,代码行数:12,代码来源:index.ts

示例6: stripBom

export async function ReadUri(uri: string): Promise<string> {
  try {
    const readable = await getUriAsync(uri);

    const readAll = new Promise<string>(function (resolve, reject) {
      let result = "";
      readable.on("data", data => result += data.toString());
      readable.on("end", () => resolve(result));
      readable.on("error", err => reject(err));
    });

    return stripBom(await readAll);
  } catch (e) {
    throw new Error(`Failed to load '${uri}' (${e})`);
  }
}
开发者ID:jianghaolu,项目名称:AutoRest,代码行数:16,代码来源:uri.ts

示例7: callback

        fs.readFile(filename, encoding, function (err2, content) {
            if (err2) {
                return callback(err2);
            }

            content = stripBom(content);

            // \uFFFD is used to replace an incoming character
            // whose value is unknown or unrepresentable
            if (/\uFFFD/.test(content)) {
                const err3: NodeJS.ErrnoException = new Error("ECHARSET: unsupported encoding in file: " + filename);
                err3.code = "ECHARSET";
                return callback(err3);
            }

            callback(null, content);
        });
开发者ID:zaggino,项目名称:brackets-electron,代码行数:17,代码来源:fs-additions.ts

示例8: stripBom

export async function ReadUri(uri: string, headers: { [key: string]: string } = {}): Promise<string> {
  try {
    const readable = await getUriAsync(uri, { headers: headers });

    const readAll = new Promise<string>(function (resolve, reject) {
      let result = "";
      readable.on("data", data => result += data.toString());
      readable.on("end", () => resolve(result));
      readable.on("error", err => reject(err));
    });

    let result = await readAll;
    // fix up UTF16le files
    if (result.charCodeAt(0) === 65533 && result.charCodeAt(1) === 65533) {
      result = Buffer.from(result.slice(2)).toString("utf16le");
    }
    return stripBom(result);
  } catch (e) {
    throw new Error(`Failed to load '${uri}' (${e})`);
  }
}
开发者ID:indrajithbandara,项目名称:autorest,代码行数:21,代码来源:uri.ts


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