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


TypeScript lodash.kebabCase函数代码示例

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


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

示例1: _getSuperType

 private _getSuperType(cls: IClass, superName: string) {
     var superClass = projectTypeMap[_.kebabCase(superName)] && projectTypeMap[_.kebabCase(superName)][this.name] || getMappedType(cls, superName);
     if (_.startsWith(superClass, this._project.displayName + '.')) {
         superClass = superClass.split('.')[1];
     }
     return superClass;
 }
开发者ID:david-driscoll,项目名称:atom-typescript-generator,代码行数:7,代码来源:Class.ts

示例2: build

function build(name: string) {
  var arr = name.split('/')
  var filename = _.kebabCase(name.split('/')[0]) + '.js'
  if (arr.length === 3) {
    filename = _.kebabCase(name.split('/')[1]) + '.js'
  }
  var options: any = {
    errorDetails: true,
    debug: false,
    output: {
      filename: filename.toLowerCase()
    },
    resolve: {
      extensions: ['', '.webpack.js', '.web.js', '.js']
    },
    module: {
      loaders: [
        { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
        { test: /\.less$/, exclude: /node_modules/, loader: 'style!css!less' }
      ]
    },
    plugins: [
      new webpack.optimize.UglifyJsPlugin({minimize: true})
    ]
  }
  return gulp.src('./' + name + '.js')
    .pipe(webpackStream(options))
    .pipe(gulp.dest('./public/assets/js'))
}
开发者ID:starlying,项目名称:projs,代码行数:29,代码来源:pack.ts

示例3: dev

function dev(name: string, callback: () => void) {
  //var filename = name.split('/')[1].substr(0, 3) + '-' + name.split('/')[1].substr(3) + '.js'
  var filename = _.kebabCase(name.split('/')[1]) + '.js'
  var options: any = {
    entry: './' + name + '.js',
    output: {
      path: path.join(__dirname, '../../../public/assets/js'),
      publicPath: "/assets/",
      filename: "bundle.js"
    },
    resolve: {
      extensions: ['', '.webpack.js', '.web.js', '.js']
    },
    module: {
      loaders: [
        { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
        { test: /\.less$/, exclude: /node_modules/, loader: 'style!css!less' }
      ]
    },
    devtool: "sourcemap",
    debug: true
  }
  var port = 7070

  var compiler = webpack(options)
  return new WebpackDevServer(compiler, {
    stats: {
      colors: true
    },
    historyApiFallback: true
  }).listen(port, "localhost", function(err) {
    if (err) throw err
    callback()
  })
}
开发者ID:starlying,项目名称:projs,代码行数:35,代码来源:pack.ts

示例4: createComponent

function* createComponent(req: express.Request, res: express.Response) {
  const { name } = yield getPostData(req);

  const state: ApplicationState = yield select();
  const componentId = kebabCase(name);

  const content = `` +
  `<component id="${componentId}">\n` + 
  `  <style>\n` + 
  `  </style>\n` +
  `  <template>\n` + 
  `    Content here\n` +
  `  </template>\n` +
  `  <preview name="main" width="600" height="400">\n` +
  `    <${componentId} />\n` +
  `  </preview>\n` +
  `</component>\n\n`;

  const filePath = path.join(getModuleSourceDirectory(state), componentId + "." + PAPERCLIP_FILE_EXTENSION);

  if (fs.existsSync(filePath)) {
    res.statusCode = 500;
    return res.send({
      message: "Component exists"
    });
  }

  fs.writeFileSync(
    filePath,
    content
  );

  const publicPath = getPublicSrcPath(filePath, state);

  yield put(moduleCreated(filePath, publicPath, content));

  res.send({ componentId: componentId });

  // TODO - create global style if it doesn"t already exist
  // check if component name is already taken (must be unique)
  // create style based on component name
  // create component based on WPC spec (or something like that), basically this:
  /*
  <template name="test">
    
    <style scoped>
      .container {

      }
    </style>
    <div className="container">
    </div>
  </template>

  <preview>
    
    <test />
  </preview>
  */
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:60,代码来源:api.ts

示例5: fixturePath

function fixturePath(name: string) {
  return path.join(
    __dirname,
    "__tests__/fixtures/serializedState/v1/",
    `${kebabCase(name)}.json`
  );
}
开发者ID:captbaritone,项目名称:winamp2-js,代码行数:7,代码来源:serialization.test.ts

示例6: codeFrameError

 attributes: attributes.reduce((obj, attr) => {
   if (t.isJSXSpreadAttribute(attr)) {
     throw codeFrameError(attr.loc, 'JSX 参数暂不支持 ...spread 表达式')
   }
   const name = attr.name.name === 'className' ? 'class' : attr.name.name
   let value: string | boolean = true
   let attrValue = attr.value
   if (typeof name === 'string') {
     if (t.isStringLiteral(attrValue)) {
       value = attrValue.value
     } else if (t.isJSXExpressionContainer(attrValue)) {
       const isBindEvent =
         name.startsWith('bind') || name.startsWith('catch')
       let { code } = generate(attrValue.expression)
       code = code
         .replace(/(this\.props\.)|(this\.state\.)/, '')
         .replace(/this\./, '')
       value = isBindEvent ? code : `{{${code}}}`
       if (t.isStringLiteral(attrValue.expression)) {
         value = attrValue.expression.value
       }
     }
     if (
       componentSpecialProps &&
       componentSpecialProps.has(name)
     ) {
       obj[name] = value
     } else {
       obj[isDefaultComponent && !name.includes('-') && !name.includes(':') ? kebabCase(name) : name] = value
     }
   }
   return obj
 }, {}),
开发者ID:teachat8,项目名称:taro,代码行数:33,代码来源:jsx.ts

示例7: moduleArchive

export function moduleArchive(
  moduleCode: ModuleCode,
  year: string,
  moduleTitle: ModuleTitle = '',
): string {
  return `/archive/${moduleCode}/${year.replace('/', '-')}/${kebabCase(moduleTitle)}`;
}
开发者ID:nusmodifications,项目名称:nusmods,代码行数:7,代码来源:paths.ts

示例8: getInjectableName

export function queryByDirective<T extends Function>( host: ng.IAugmentedJQuery, Type: T ) {
  const ctrlName = getInjectableName( Type );
  const selector = kebabCase( ctrlName );
  const debugElement = host.find( selector );
  const componentInstance = debugElement.controller( ctrlName ) as T;

  return { debugElement, componentInstance };
}
开发者ID:7Kronos,项目名称:Angular1-scaffold,代码行数:8,代码来源:app.component.spec.ts

示例9:

 return this.servicesCategoryDao.getNewInstance().then(function(category: ServicesCategory) {
     category._isNew = false;
     category.id = _.kebabCase(name);
     category.name = name;
     category.services = services;
     category.types = _.map(selectedIds, x => 'service-' + x);
     return category;
 });
开发者ID:mactanxin,项目名称:gui,代码行数:8,代码来源:service-repository.ts

示例10: findInFileAndReplace

export function findInFileAndReplace(filePath: string, patternReplacePair: any) {
    if (existsSync(filePath)) {
        return Log.error(`File not found: ${filePath}`);
    }
    let code = readFileSync(filePath, "utf8");
    for (let patterns = Object.keys(patternReplacePair), i = patterns.length; i--;) {
        const pattern = patterns[i];
        const replace = patternReplacePair[pattern];
        const allPatterns = [pattern, pascalCase(pattern), kebabCase(pattern), camelCase(pattern)];
        const allReplaces = [replace, pascalCase(replace), kebabCase(replace), camelCase(replace)];
        for (let j = 0, jl = allPatterns.length; j < jl; ++j) {
            const regex = new RegExp(allPatterns[j], "g");
            code = code.replace(regex, allReplaces[j]);
        }
    }
    writeFileSync(filePath, code);
}
开发者ID:VestaRayanAfzar,项目名称:vesta,代码行数:17,代码来源:Util.ts


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