本文整理汇总了TypeScript中node-opcua-utils.lowerFirstLetter函数的典型用法代码示例。如果您正苦于以下问题:TypeScript lowerFirstLetter函数的具体用法?TypeScript lowerFirstLetter怎么用?TypeScript lowerFirstLetter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lowerFirstLetter函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: add_component
function add_component(
proxyManager: UAProxyManager,
obj: any,
reference: ReferenceDescription,
callback: (err?: Error) => void) {
const session = proxyManager.session;
const name = lowerFirstLetter(reference.browseName.name || "");
proxyManager.getObject(reference.nodeId, (err?: Error | null, childObj?: any) => {
// istanbul ignore else
if (!err) {
childObj = new ObjectExplorer({
name,
nodeId: reference.nodeId,
parent: obj,
proxyManager,
});
obj[name] = childObj;
obj.$components.push(childObj);
childObj.$resolve(callback);
} else {
callback(err);
}
});
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:29,代码来源:object_explorer.ts
示例2: lowerFirstLetter
_.zip(outputArgsDef, callResult.outputArguments).forEach((pair: any) => {
const arg = pair[0];
const variant = pair[1];
const propName = lowerFirstLetter(arg.name);
outputArgs[propName] = variant.value;
});
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:object_explorer.ts
示例3: setUInt32
function setUInt32(propName: string) {
const lowerCase = utils.lowerFirstLetter(propName);
if (!historyServerCapabilities.hasOwnProperty(lowerCase)) {
throw new Error("cannot find " + lowerCase);
}
const value = defaultProperties[lowerCase];
const prop = historyServerCapabilities.getChildByName(propName);
prop.setValueFromSource({ dataType: DataType.UInt32, value });
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:9,代码来源:aggregates.ts
示例4: callback
session.read(nodesToRead, (err2: Error | null, dataValues?: DataValue[]) => {
if (err2) {
return callback(err2);
}
if (!dataValues) {
return callback(new Error("Internal Error"));
}
for (let i = 0; i < dataValues.length; i++) {
const propName = lowerFirstLetter(properties[i]);
data[propName] = dataValues[i].value as Variant;
}
callback(null, data);
});
开发者ID:node-opcua,项目名称:node-opcua,代码行数:15,代码来源:read_history_server_capabilities.ts
示例5: add_property
function add_property(
proxyManager: UAProxyManager,
obj: any,
reference: ReferenceDescription,
callback: (err?: Error) => void
) {
const session = proxyManager.session;
const name = lowerFirstLetter(reference.browseName.name || "");
obj[name] = new ProxyVariable(proxyManager, reference.nodeId, reference);
obj.$properties[name] = obj[name];
setImmediate(callback);
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:16,代码来源:object_explorer.ts
示例6: buildField
function buildField(fieldLight: FieldInterfaceOptions): FieldType {
const category = figureOutFieldCategory(fieldLight);
const schema = figureOutSchema(fieldLight, category);
return {
name: lowerFirstLetter(fieldLight.name),
category,
defaultValue: fieldLight.defaultValue,
isArray: fieldLight.isArray,
documentation: fieldLight.documentation,
fieldType: fieldLight.fieldType,
schema
};
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:17,代码来源:factories_structuredTypeSchema.ts
示例7: installMethod
function installMethod(methodName: string, toState: string) {
let method = programStateMachine.getMethodByName(methodName);
if (!method) {
// 'method' has ModellingRule=OptionalPlaceholder and should be created from the type definition
let methodToClone = programStateMachine.typeDefinitionObj.getMethodByName(methodName);
if (!methodToClone) {
methodToClone = programStateMachine.typeDefinitionObj!.subtypeOfObj!.getMethodByName(methodName)!;
}
methodToClone.clone({
componentOf: programStateMachine
});
method = programStateMachine.getMethodByName(methodName)!;
assert(method !== null, "Method clone should cause parent object to be extended");
}
assert(method.nodeClass === NodeClass.Method);
method._getExecutableFlag = function(/* sessionContext: SessionContext */) {
// must use a function here to capture 'this'
return MygetExecutableFlag(this as UAMethod, toState, methodName);
};
method.bindMethod(
function(
this: UAMethod,
inputArguments: VariantLike[],
context: SessionContext,
callback: (err: Error | null, callMethodResult: CallMethodResultOptions) => void
) {
const stateMachineW = this.parent! as StateMachine;
// tslint:disable-next-line:no-console
console.log("Boiler System : " + methodName + " about to process");
stateMachineW.setState(toState);
callback(null, {
outputArguments: [],
statusCode: StatusCodes.Good,
});
});
assert(programStateMachine.getMethodByName(methodName) !== null,
"Method " + methodName + " should be added to parent object (checked with getMethodByName)");
const lc_name = lowerFirstLetter(methodName);
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:45,代码来源:boiler_system.ts
示例8: convertNodeIdToDataType
const inputArguments: Variant[] = inputArgsDef.map((arg: any) => {
const dataType = convertNodeIdToDataType(arg.dataType);
const arrayType = (arg.valueRank === 1) ? VariantArrayType.Array : VariantArrayType.Scalar;
// xx console.log("xxx ",arg.toString());
const propName = lowerFirstLetter(arg.name);
const value = inputArgs[propName];
if (value === undefined) {
throw new Error("expecting input argument " + propName);
}
if (arrayType === VariantArrayType.Array) {
if (!_.isArray(value)) {
throw new Error("expecting value to be an Array or a TypedArray");
}
}
return new Variant({arrayType, dataType, value});
});
开发者ID:node-opcua,项目名称:node-opcua,代码行数:20,代码来源:object_explorer.ts
示例9: addFolderElement
function addFolderElement(
proxyManager: UAProxyManager,
obj: any,
reference: ReferenceDescription,
callback: (err?: Error) => void
) {
const session = proxyManager.session;
const name = lowerFirstLetter(reference.browseName.name || "");
const childObj = new ObjectExplorer({
name,
nodeId: reference.nodeId,
parent: obj,
proxyManager,
});
obj[name] = childObj;
obj.$organizes.push(childObj);
childObj.$resolve(callback);
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:22,代码来源:object_explorer.ts
示例10: buildConstructorFromDefinition
function buildConstructorFromDefinition(
addressSpace: AddressSpace,
dataType: UADataType
) {
if (doDebug) {
debugLog("buildConstructorFromDefinition#", dataType.nodeId.toString());
}
assert(dataType.definition && _.isArray(dataType.definition));
const enumeration = addressSpace.findDataType("Enumeration");
const className = dataType.browseName.name!.replace("DataType", "");
assert(enumeration, "Enumeration Type not found: please check your nodeset file");
const structure = addressSpace.findDataType("Structure");
assert(structure, "Structure Type not found: please check your nodeset file");
const Constructor = new Function("options", "_extensionobject_construct.apply(this,arguments);");
assert(_.isFunction(Constructor));
Object.defineProperty(Constructor, "name", { value: className });
(Constructor as any).definition = dataType.definition;
(Constructor as any).dataType = dataType;
util.inherits(Constructor, ExtensionObject);
Constructor.prototype.encode = _extensionobject_encode;
Constructor.prototype.decode = _extensionobject_decode;
for (const field of dataType.definition) {
if (field.valueRank === 1) {
field.$$name$$ = lowerFirstLetter(field.name.replace("ListOf", ""));
} else {
field.$$name$$ = lowerFirstLetter(field.name);
}
const dataTypeId = resolveNodeId(field.dataType);
const fieldDataType = addressSpace.findDataType(dataTypeId) as UADataType;
if (!fieldDataType) {
throw new Error(" cannot find description for object " + dataTypeId +
". Check that this node exists in the nodeset.xml file");
}
// check if dataType is an enumeration or a structure or a basic type
field.$$dataTypeId$$ = dataTypeId;
field.$$dataType$$ = fieldDataType;
field.$$isEnum$$ = false;
field.$$isStructure$$ = false;
if (fieldDataType.isSupertypeOf(enumeration as any)) {
field.$$isEnum$$ = true;
// todo repair
// makeEnumeration(fieldDataType);
} else if (fieldDataType.isSupertypeOf(structure as any)) {
field.$$isStructure$$ = true;
const FieldConstructor = makeStructure(fieldDataType);
assert(_.isFunction(FieldConstructor));
// xx field
field.$$func_encode$$ = struct_encode;
field.$$func_decode$$ = struct_decode;
field.$$Constructor$$ = FieldConstructor;
field.$$initialize$$ = initialize_Structure.bind(null, field);
} else {
const stuff = findBuiltInType(fieldDataType.browseName.name);
field.$$func_encode$$ = stuff.encode;
field.$$func_decode$$ = stuff.decode;
assert(_.isFunction(field.$$func_encode$$));
assert(_.isFunction(field.$$func_decode$$));
field.schema = stuff;
field.$$initialize$$ = initialize_field.bind(null, field);
}
if (field.valueRank === 1) {
field.$$initialize$$ = initialize_array.bind(null, field.$$initialize$$);
field.$$func_encode$$ = encode_array.bind(null, field.$$func_encode$$);
field.$$func_decode$$ = decode_array.bind(null, field.$$func_decode$$);
}
}
// reconstruct _schema form
const fields = [];
for (const field of dataType.definition) {
const data: any = {
fieldType: field.$$dataType$$.browseName.name,
isArray: (field.valueRank === 1),
name: field.$$name$$
};
if (field.$$isEnum$$) {
data.category = FieldCategory.enumeration;
} else if (field.$$isStructure$$) {
data.category = FieldCategory.complex;
data.fieldTypeConstructor = field.$$Constructor$$;
} else {
data.category = FieldCategory.basic;
}
fields.push(data);
}
Constructor.prototype.schema = {
fields,
id: -1,
name: className
};
return Constructor;
//.........这里部分代码省略.........
开发者ID:node-opcua,项目名称:node-opcua,代码行数:101,代码来源:extension_object_array_node.ts
注:本文中的node-opcua-utils.lowerFirstLetter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论