How to use the ob1.add function in ob1

To help you get started, we’ve selected a few ob1 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / metro / packages / metro-source-map / src / Consumer / positionMath.js View on Github external
function shiftPositionByOffset<
  T: {
    +line: ?Number1,
    +column: ?Number0,
    ...
  },
>(pos: T, offset: GeneratedOffset): T {
  return {
    ...pos,
    line: pos.line != null ? add(pos.line, offset.lines) : null,
    column: pos.column != null ? add(pos.column, offset.columns) : null,
  };
}
github facebook / metro / packages / metro-source-map / src / Consumer / positionMath.js View on Github external
function shiftPositionByOffset<
  T: {
    +line: ?Number1,
    +column: ?Number0,
    ...
  },
>(pos: T, offset: GeneratedOffset): T {
  return {
    ...pos,
    line: pos.line != null ? add(pos.line, offset.lines) : null,
    column: pos.column != null ? add(pos.column, offset.columns) : null,
  };
}

ob1

A small library for working with 0- and 1-based offsets in a type-checked way.

MIT
Latest version published 2 months ago

Package Health Score

91 / 100
Full package analysis

Popular ob1 functions