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

ckn.core

v3.1.36

Published

CKN Framework

Downloads

248

Readme

CKN Core

CKN Framework is framework for Javascript to support both of backend and frontend. It helps us to develop microservice model easier. And it helps to manage 3rd parties library. CKN Core is foundation library of CKN Framework. Including override method for primitive data type, api function that support both of frontend and backend and logging tools.

Installation

CKN Core is public npm package on NPM registry. Before install package, need to install Node.js version 18.0 or higher.

npm install ckn.core

Numeric tools - round

CKN Core provide round function for all numeric variable to round the decimal.

import {ckn} from 'ckn.core'

let n = 10.3;

console.log(n.round()); // output is 10.0

Numeric tools - ceil

CKN Core provide ceil function for all numeric variable to round up the decimal.

import {ckn} from 'ckn.core'

let n = 10.3;

console.log(n.ceil());
// output is 11.0

Numeric tools - floor

CKN Core provide floor function for all numeric variable to round down the decimal.

import {ckn} from 'ckn.core'

let n = 10.3;

console.log(n.floor());
// output is 11.0

Numeric tools - printFormat

CKN Core provide printFormat function for all numeric variable to convert to string with normal number format ex. 1500 will be print as "1,500.00".

import {ckn} from 'ckn.core'

let n = 1500.5;
let decemal_number = 2;
let separate_thousands = ',';

console.log(n.printFormat(decemal_number, separate_thousands));
// output is 1,500.50

console.log(n.printFormat(decemal_number));
// output is 1,500.50

console.log(n.printFormat());
// output is 1500.50

Options

  • targetLength [OPTIONAL] is number of decimal that is show in printed string such as 2 for .50 in 1,500.50
  • separate_thousands [OPTIONAL, DEFAULT = ','] is character that is used for separate thousands such as , for 1,5000.00

Numeric tools - padStart

CKN Core provide padStart function for all numeric variable to convert to string and pad string before original data.

import {ckn} from 'ckn.core'

let n = 15;
let targetLength = 5;
let padString = '0';

console.log(n.padStart(targetLength, padString));
// output is 00015

Options

  • targetLength is length for padding string
  • padString is character that is used for padding

Numeric tools - padEnd

CKN Core provide padEnd function for all numeric variable to convert to string pad string after original data.

import {ckn} from 'ckn.core'

let n = 15;
let targetLength = 5;
let padString = 'A';

console.log(n.padEnd(targetLength, padString));
// output is 15AAA

Options

  • targetLength is length for padding string
  • padString is character that is used for padding

String tools - edit

CKN Core provide edit function for all string variable to edit string by processing for each character.

import {ckn} from 'ckn.core'

let str = "Hello world";
let editFunction = c => {
    if (c == 'e') {
        return 'a';
    }
    return c;
};

let newStr = str.edit(editFunction);
console.log(newStr)
// output is Hallo world

Options

  • editFunction is function to process edit condition

String tools - each

CKN Core provide each function for all string variable to process for each character in string

import {ckn} from 'ckn.core'

let str = "Hello world";
let eachFunction = c => {
    if (c == 'e') {
        console.log("Hi", c);
    }
};

str.each(eachFunction);
// output is 'Hi e'

Options

  • eachFunction is function to process each condition

Date tools - date

CKN Core provide date function for all Date variable to get date value

import {ckn} from 'ckn.core'

let date = new Date(2023, 4, 31); // 31 May 2023

console.log(date.date());
// output is 31

Date tools - month

CKN Core provide month function for all Date variable to get month value

import {ckn} from 'ckn.core'

let date = new Date(2023, 4, 31); // 31 May 2023

console.log(date.month());
// output is 05

Date tools - year

CKN Core provide year function for all Date variable to get year value

import {ckn} from 'ckn.core'

let date = new Date(2023, 4, 31); // 31 May 2023

console.log(date.year());
// output is 2023

License

MIT