npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@apple/cktool.core

v1.3.2

Published

Apple CKTool JS client library runtime support

Downloads

322

Readme

CKTool JS Core Package

This package is part of the CKTool JS JavaScript client library suite and is used to support other CKTool JS packages.

Don't use this package on its own. It is automatically pulled in when you include @apple/cktool.database in your package.json dependencies.

Getting Started

See Apple Developer Documentation for more details on how to get started using CKTool JS.

Strict Numeric Types

There are several branded types used to mark validated values. For example, the Int32 type is a branded numeric type that is assignaable to number but number is not directly assignable to it.

const a: number = toInt32(12); // OK
const b: Int32 = 12; // Error

Casting Functions

This client library attempts to be as type-safe as possible. There are several data types that must be validated in order to be passed to an operation. For example, where an Int32 would be expected, you must first pass your constant through the toInt32 cast function. The Int32 cast function does the following:

  • Validates that the value is a numeric type.
  • Validates that the number is an integer in Int32 range.
  • Returns an Int32 value that will pass type checking.

Do NOT use type assertions to cast a related type, such as number to a branded type. Such an approach is not guaranteed to compile in future and an invalid value may be type asserted, which can lead to errors down the line.

Int64, Float, and Double Support

Support for Int64, Float, and Double is achieved with the bignumber.js library. Whenever one of those numeric types are returned from an operation, it will be a BigNumber instance. In order to perform operations on those instances, such as addition or subtraction, you'll need to use the BigNumber methods. See the documentation for BigNumber at https://github.com/MikeMcl/bignumber.js.

The toInt64 cast function will do the following:

  • Validates that the value is a numeric type.
  • Validates that the number is an integer in Int64 range.
  • Returns a BigNumber instance of type Int64.

The toFloat cast function will do the following:

  • Validates that the value is a numeric type.
  • Validates that the number is an integer in Float range.
  • Returns a BigNumber instance of type Float.

The toDouble cast function will do the following:

  • Validates that the value is a numeric type.
  • Validates that the number is an integer in Double range.
  • Returns a BigNumber instance of type Double.

UUIDs

To pass a Uuid to a function, use the toUuid cast function. To create a Uuid object, use the createUuid function.