本文整理汇总了TypeScript中lodash/fp.omit函数的典型用法代码示例。如果您正苦于以下问题:TypeScript omit函数的具体用法?TypeScript omit怎么用?TypeScript omit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了omit函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('should create options given all input except sorting', () => {
const argsWithoutSort: Args = omit('sortField', args);
const options = createOptions(source, argsWithoutSort, info);
const expected: RequestOptions = {
defaultIndex: ['auditbeat-*', 'filebeat-*', 'packetbeat-*', 'winlogbeat-*'],
sourceConfiguration: {
fields: {
host: 'host-1',
container: 'container-1',
message: ['message-1'],
pod: 'pod-1',
tiebreaker: 'tiebreaker',
timestamp: 'timestamp-1',
},
},
pagination: {
limit: 5,
},
filterQuery: {},
fields: [],
timerange: {
from: 10,
to: 0,
interval: '12 hours ago',
},
};
expect(options).toEqual(expected);
});
示例2: omit
).map(function(
referencedEntity: PvjsonSingleFreeNode | PvjsonGroup | PvjsonEdge
) {
if (isPvjsonNode(referencedEntity)) {
const { attachmentDisplay } = pvjsonEntity;
const [
relativeOffsetScalarX,
relativeOffsetScalarY
] = attachmentDisplay.relativeOffset;
attachmentDisplay.offset = [
relativeOffsetScalarX * referencedEntity.width,
relativeOffsetScalarY * referencedEntity.height
];
pvjsonEntity.attachmentDisplay = omit(
["relativeOffset"],
attachmentDisplay
);
}
setPvjsonEntity(pvjsonEntity);
// NOTE: burrs are not added to the property "contained".
// Rather, they are added to the property "burrs".
referencedEntity.burrs = referencedEntity.burrs || [];
insertEntityIdAndSortByZIndex(referencedEntity.burrs);
setPvjsonEntity(referencedEntity);
return processor.output;
});
示例3: omit
export const unPinTimelineEvent = ({
id,
eventId,
timelineById,
}: UnPinTimelineEventParams): TimelineById => {
const timeline = timelineById[id];
return {
...timelineById,
[id]: {
...timeline,
pinnedEventIds: omit(eventId, timeline.pinnedEventIds),
},
};
};
示例4: mergeMap
mergeMap(([result, recentTimeline]) => {
const savedTimeline = recentTimeline[get('payload.id', action)];
const response: PinnedEvent = get('data.persistPinnedEventOnTimeline', result);
return [
response != null
? updateTimeline({
id: get('payload.id', action),
timeline: {
...savedTimeline,
savedObjectId:
savedTimeline.savedObjectId == null && response.timelineId != null
? response.timelineId
: savedTimeline.savedObjectId,
version:
savedTimeline.version == null && response.timelineVersion != null
? response.timelineVersion
: savedTimeline.savedObjectId,
pinnedEventsSaveObject: {
...savedTimeline.pinnedEventsSaveObject,
[get('payload.eventId', action)]: response,
},
},
})
: updateTimeline({
id: get('payload.id', action),
timeline: {
...savedTimeline,
pinnedEventsSaveObject: omit(
get('payload.eventId', action),
savedTimeline.pinnedEventsSaveObject
),
},
}),
endTimelineSaving({
id: get('payload.id', action),
}),
];
}),
示例5: map
const groupedEntitiesFinal = groupedEntities.map(function(
groupedEntity
) {
if (isPvjsonEdge(groupedEntity)) {
groupedEntity.points = map(function(point) {
point.x -= x;
point.y -= y;
return point;
}, groupedEntity.points);
} else if (isPvjsonSingleFreeNode(groupedEntity)) {
groupedEntity.height;
groupedEntity.x -= x;
groupedEntity.y -= y;
} else {
return hl.fromError(
new Error(
`
Encountered unexpected entity
${JSON.stringify(groupedEntity, null, " ")}
in Group
${JSON.stringify(pvjsonGroup, null, " ")}
`
)
);
}
// NOTE: this is needed for GPML2013a, because GPML2013a uses both
// GroupId/GroupRef and GraphId/GraphRef. GPML2017 uses a single
// identifier per entity. That identifier can be referenced by
// GroupRef and/or GraphRef. Pvjson follows GPML2017 in this, so
// we convert from GPML2013a format:
// GroupRef="GROUP_ID_VALUE"
// to pvjson format:
// {isPartOf: "GRAPH_ID_VALUE"}
groupedEntity.isPartOf = id;
return omit(["groupRef"], groupedEntity);
});
示例6: map
//.........这里部分代码省略.........
// xOffset> \
// \
// \ dx>
// dy \
// | \
// v \
// \
//
// example above is an attachmentDisplay specifying an edge that emanates down and to the right
// at a 45 deg. angle (1, 1), offset right 5 x units and down 11 y units from the center (0.5)
// of the bottom side (1) of the node: {position: [0.75, 1], offset: [5, 11], orientation: [1, 1]}
//
//
// where x is distance from left side along width axis as a percentage of the total width
// y is distance from top side along height axis as a percentage of the total height
// offsetX, offsetY are obvious from the name. Notice they are absolute, unlike x,y.
// dx, dy are unit vector coordinates of a point that specifies how the edge emanates from the node
if (
isPvjsonSingleFreeNode(entityReferencedByEdge) ||
isPvjsonGroup(entityReferencedByEdge) ||
isPvjsonBurr(entityReferencedByEdge)
) {
const { position, relativeOffset } = attachmentDisplay;
// edge connected to a SingleFreeNode, a Group or a Burr, but NOT another edge or an anchor
try {
const {
offsetScalar: offsetScalarX,
orientationScalar: orientationScalarX
} = getOffsetAndOrientationScalarsAlongAxis(
position[0],
relativeOffset[0],
"x",
entityReferencedByEdge
);
const {
offsetScalar: offsetScalarY,
orientationScalar: orientationScalarY
} = getOffsetAndOrientationScalarsAlongAxis(
position[1],
relativeOffset[1],
"y",
entityReferencedByEdge
);
if (index === 0) {
orientation[0] = orientationScalarX;
orientation[1] = orientationScalarY;
} else {
orientation[0] = -1 * orientationScalarX;
orientation[1] = -1 * orientationScalarY;
}
// TODO is there a case where we would ever use offset for edges?
attachmentDisplay.offset[0] = offsetScalarX;
attachmentDisplay.offset[1] = offsetScalarY;
point.attachmentDisplay = omit(["relativeOffset"], attachmentDisplay);
} catch (err) {
throw new VError(
err,
`
Error for:
postprocessPVJSON(
referencedEntities=${JSON.stringify(referencedEntities, null, " ")},
pvjsonEdge=${JSON.stringify(pvjsonEdge, null, " ")}
)
`
);
/* TODO should we use this?
console.warn(`Setting offsetScalar equal to 0.`);
offsetScalar = 0;
//*/
}
} else if (isGPMLAnchor(entityReferencedByPoint)) {
// edge is connected to another edge via an anchor
point.attachmentDisplay.position =
entityReferencedByPoint.attachmentDisplay.position;
} else {
throw new Error(
`
Edge or Point attached to unexpected entity.
Point is attached to:
${JSON.stringify(entityReferencedByPoint, null, " ")}
Point is attached to:
${JSON.stringify(entityReferencedByEdge, null, " ")}
for:
postprocessPVJSON(
referencedEntities=${JSON.stringify(referencedEntities, null, " ")},
pvjsonEdge=${JSON.stringify(pvjsonEdge, null, " ")}
)
`
);
}
}
// NOTE: side effect
index += 1;
return omit(["marker"], point);
}, points);
示例7: postprocessPVJSON
//.........这里部分代码省略.........
const { position, relativeOffset } = attachmentDisplay;
// edge connected to a SingleFreeNode, a Group or a Burr, but NOT another edge or an anchor
try {
const {
offsetScalar: offsetScalarX,
orientationScalar: orientationScalarX
} = getOffsetAndOrientationScalarsAlongAxis(
position[0],
relativeOffset[0],
"x",
entityReferencedByEdge
);
const {
offsetScalar: offsetScalarY,
orientationScalar: orientationScalarY
} = getOffsetAndOrientationScalarsAlongAxis(
position[1],
relativeOffset[1],
"y",
entityReferencedByEdge
);
if (index === 0) {
orientation[0] = orientationScalarX;
orientation[1] = orientationScalarY;
} else {
orientation[0] = -1 * orientationScalarX;
orientation[1] = -1 * orientationScalarY;
}
// TODO is there a case where we would ever use offset for edges?
attachmentDisplay.offset[0] = offsetScalarX;
attachmentDisplay.offset[1] = offsetScalarY;
point.attachmentDisplay = omit(["relativeOffset"], attachmentDisplay);
} catch (err) {
throw new VError(
err,
`
Error for:
postprocessPVJSON(
referencedEntities=${JSON.stringify(referencedEntities, null, " ")},
pvjsonEdge=${JSON.stringify(pvjsonEdge, null, " ")}
)
`
);
/* TODO should we use this?
console.warn(`Setting offsetScalar equal to 0.`);
offsetScalar = 0;
//*/
}
} else if (isGPMLAnchor(entityReferencedByPoint)) {
// edge is connected to another edge via an anchor
point.attachmentDisplay.position =
entityReferencedByPoint.attachmentDisplay.position;
} else {
throw new Error(
`
Edge or Point attached to unexpected entity.
Point is attached to:
${JSON.stringify(entityReferencedByPoint, null, " ")}
Point is attached to:
${JSON.stringify(entityReferencedByEdge, null, " ")}
for:
postprocessPVJSON(
referencedEntities=${JSON.stringify(referencedEntities, null, " ")},
pvjsonEdge=${JSON.stringify(pvjsonEdge, null, " ")}
示例8: get
get(key, timeline).map((col: ColumnHeader) => omit(['width', '__typename'], col)),