Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @mathigon/core with all npm packages installed. Try it out:

var core = require("@mathigon/core")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@mathigon/core v0.3.4

TypeScript utilities library containing function wrappers, string and array helper functions, event classes and color utilities.

Core.js

Core.js is a library of JavaScript utility function and classes, including array and string helper functions, type checking and event classes. It was developed for Mathigon.org, an award-winning mathematics education project.

npm npm

Features

  • Function wrappers for caching and throttling (cache(), throttle())
  • Object handling (shallowCopy(), deepCopy(), extend(), some(), …)
  • Array generation (tabulate(), list())
  • Array utilities (total(), flatten(), chunk(), intersect(), …)
  • String utilities (toCamelCase(), isPalindrome(), autocorrect(), …)
  • Functions for type checking (typeOf(), isString(), isInteger(), …)
  • Evented class, supporting .on(), .off() and .trigger() methods
  • Misc utilities (uid(), isOneOf(), clamp(), …)

Usage

First, install core.js from NPM using

npm install @mathigon/core --save

Core.js uses ES6 imports. While some browsers and platforms now support this feature, we recommend using a transpiler such as Babel or Rollup. Make sure that you configure your compiler to correctly resolve these imports. For Rollup, we recommend using the rollup-plugin-node-resolve plugin.

Now, simply import all functions and classes you need, using

import { tabulate, toCamelCase, Evented } from '@mathigon/core'

Contributing

We welcome community contributions: please file any bugs you find or send us pull requests with improvements. You can find out more on Mathigon.io.

Before submitting a pull request, you will need to sign the Mathigon Individual Contributor License Agreement.

Copyright and License

Copyright © Mathigon (dev@mathigon.org)
Released under the MIT license

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free