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

maximefirstlibrary

v1.1.2

Published

a simple first library

Downloads

5

Readme

What is it ?

A demo to make TS library

ref: https://www.youtube.com/watch?v=Nh9xW2-ZOEU

How to install :

npm i maximefirstlibrary --save

How to use :

import { MaximeSerialize } from 'maximefirstlibrary'

MaximeSerialize.writeFileSync('./a/b/c.txt', 'test')
console.log(MaximeSerialize.readFileSync('./a/b/c.txt'));

---------------------------------------------------------

import { MaximeTime } from 'maximefirstlibrary'

console.log(MaximeTime.getActualDateTimeUTC())
console.log(MaximeTime.getActualDateTimeISO())
console.log(MaximeTime.getActualLocalDateTimeISO())
console.log(MaximeTime.getActualLocalDate())
console.log(MaximeTime.getActualLocalTime24())
console.log(MaximeTime.getActualLocalDateTimeObject())

const date1 = new Date(1900, 1, 1, 1, 1, 1)
console.log(MaximeTime.getDateTimeUTCFrom(date1))
console.log(MaximeTime.getDateTimeISOFrom(date1))
console.log(MaximeTime.getLocalDateTimeISOFrom(date1))
console.log(MaximeTime.getLocalDateFrom(date1))
console.log(MaximeTime.getLocalTime24From(date1))
console.log(MaximeTime.getLocalDateTimeObjectFrom(date1))

const date2 = new Date(1900, 1, 1, 1, 1, 2)
console.log(MaximeTime.getLocalDateTimeObjectFrom(date2))

console.log('is date1 before date2 according year ? ', MaximeTime.isDateBefore(date1, date2, "year"))
console.log('is date1 before date2 according month ? ', MaximeTime.isDateBefore(date1, date2, "month"))
console.log('is date1 before date2 according day ? ', MaximeTime.isDateBefore(date1, date2, "day"))
console.log('is date1 before date2 according hour ? ', MaximeTime.isDateBefore(date1, date2, "hour"))
console.log('is date1 before date2 according minute ? ', MaximeTime.isDateBefore(date1, date2, "minute"))
console.log('is date1 before date2 according second ? ', MaximeTime.isDateBefore(date1, date2, "second"))

console.log('is date2 after date1 according year ? ', MaximeTime.isDateAfter(date2, date1, "year"))
console.log('is date2 after date1 according month ? ', MaximeTime.isDateAfter(date2, date1, "month"))
console.log('is date2 after date1 according day ? ', MaximeTime.isDateAfter(date2, date1, "day"))
console.log('is date2 after date1 according hour ? ', MaximeTime.isDateAfter(date2, date1, "hour"))
console.log('is date2 after date1 according minute ? ', MaximeTime.isDateAfter(date2, date1, "minute"))
console.log('is date2 after date1 according second ? ', MaximeTime.isDateAfter(date2, date1, "second"))

console.log('is date2 equal date1 according year ? ', MaximeTime.isDateEqual(date2, date1, "year"))
console.log('is date2 equal date1 according month ? ', MaximeTime.isDateEqual(date2, date1, "month"))
console.log('is date2 equal date1 according day ? ', MaximeTime.isDateEqual(date2, date1, "day"))
console.log('is date2 equal date1 according hour ? ', MaximeTime.isDateEqual(date2, date1, "hour"))
console.log('is date2 equal date1 according minute ? ', MaximeTime.isDateEqual(date2, date1, "minute"))
console.log('is date2 equal date1 according second ? ', MaximeTime.isDateEqual(date2, date1, "second"))

---------------------------------------------------------

import { MaximeScreen } from 'maximefirstlibrary'

const screenSizeX = 100
const screenSizeY = 400
let posX = 50
let posY = 50
MaximeScreen.Zone = "LEFT" | "UP" | "RIGHT" | "DOWN" | "CENTER"
console.log(MaximeScreen.getPositionZone(screenSizeX, screenSizeY, posX, posY)) // => "UP"  

package.json to make a lib

{
  "name": "yourLibraryName",
  "version": "1.0.0",
  "description": "your first library",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "files": [
    "dist"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/yourGithubName/yourGithubLibrary.git"
  },
  "keywords": [
    "your-lib-keywords"
  ]
}

tsconfig.json to make a lib

{
  "compilerOptions": {
    /* Visit https://aka.ms/tsconfig to read more about this file */

    /* Language and Environment */
    "target": "es2016",                                  /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */

    /* Modules */
    "module": "commonjs",                                /* Specify what module code is generated. */
    
    /* Emit */
    "declaration": true,                                 /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
    "sourceMap": true,                                   /* Create source map files for emitted JavaScript files. */
    "outDir": "./dist",                                  /* Specify an output folder for all emitted files. */

    /* Interop Constraints */
    "esModuleInterop": true,                             /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
    "forceConsistentCasingInFileNames": true,            /* Ensure that casing is correct in imports. */

    /* Type Checking */
    "strict": true,                                      /* Enable all strict type-checking options. */
    "noImplicitAny": true,                               /* Enable error reporting for expressions and declarations with an implied 'any' type. */
    
    /* Completeness */
    "skipLibCheck": true                                 /* Skip type checking all .d.ts files. */
  },
  "exclude": ["node_modules", "dist"],
  "include": ["src/**/*"]
}