本文整理汇总了TypeScript中@sqs/jsonc-parser/lib/edit.setProperty函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setProperty函数的具体用法?TypeScript setProperty怎么用?TypeScript setProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setProperty函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: applyEdits
storageItems => {
let clientSettings = storageItems.clientSettings
const format = { tabSize: 2, insertSpaces: true, eol: '\n' }
if ('edit' in args && args.edit) {
clientSettings = applyEdits(
clientSettings,
// TODO(chris): remove `.slice()` (which guards against
// mutation) once
// https://github.com/Microsoft/node-jsonc-parser/pull/12
// is merged in.
setProperty(clientSettings, args.edit.path.slice(), args.edit.value, format)
)
} else if ('extensionID' in args) {
clientSettings = applyEdits(
clientSettings,
typeof args.enabled === 'boolean'
? setProperty(clientSettings, ['extensions', args.extensionID], args.enabled, format)
: removeProperty(clientSettings, ['extensions', args.extensionID], format)
)
}
return new Promise<undefined>(resolve =>
storage.setSync({ clientSettings }, () => {
resolve(undefined)
})
)
}
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:28,代码来源:settings.ts
示例2: setProperty
const addSlackWebhook: ConfigInsertionFunction = config => {
const value: SlackNotificationsConfig = {
webhookURL: 'get webhook URL at https://YOUR-WORKSPACE-NAME.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks',
}
const edits = setProperty(config, ['notifications.slack'], value, defaultFormattingOptions)
return { edits, selectText: '""', cursorOffset: 1 }
}
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:7,代码来源:configHelpers.ts
示例3:
const addSAMLAuthProvider: ConfigInsertionFunction = config => {
const value: SAMLAuthProvider = {
type: 'saml',
identityProviderMetadataURL: '<see https://docs.sourcegraph.com/admin/auth/#saml>',
}
return {
edits: [...setProperty(config, ['auth.providers'], [value], defaultFormattingOptions)],
}
}
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:9,代码来源:configHelpers.ts
示例4: Sourcegraph
const addOtherRepository: ConfigInsertionFunction = config => {
const urlPlaceholder = '<git clone URL>'
const value: Repository = {
url: urlPlaceholder,
path: '<desired name of repository on Sourcegraph (example: my/repo)>',
}
const edits = setProperty(config, ['repos.list', -1], value, defaultFormattingOptions)
return { edits, selectText: urlPlaceholder }
}
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:9,代码来源:configHelpers.ts
示例5: scope
const addGitHubDotCom: ConfigInsertionFunction = config => {
const tokenPlaceholder = '<personal access token with repo scope (https://github.com/settings/tokens/new)>'
const value: GitHubConnection = {
token: tokenPlaceholder,
url: 'https://github.com',
}
const edits = setProperty(config, ['github', -1], value, defaultFormattingOptions)
return { edits, selectText: tokenPlaceholder }
}
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:9,代码来源:configHelpers.ts
注:本文中的@sqs/jsonc-parser/lib/edit.setProperty函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论