New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

one-moment

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

one-moment

Node module who to import safely moment.js library

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

One moment

Import moment.js dynamically into your node project.

Quick start

Install onto your node project using yarn or npm:

yarn add one-moment
npm install one-moment

To use:

Import moment.js from https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js

'use strict'

const oneMomentLoad = require('one-moment')

oneMomentLoad(function (err, ref) {
  if (err) {
    console.log(err)
  } else {
      console.log('Moment.js as been imported', ref)
  }
})

In case you want to load the library into your build you can use the js file stored here /lib/moment.min.js then in your webpack config or equivalent add the following

new CopyWebpackPlugin([{
    {
      from: '../node_modules/one-moment/lib/moment.min.js',
      to: 'moment.min.js'
    }])

and include in your index page <script src="moment.min.js"></script>

License

This project is MIT licensed. By contributing you agree that your contributions will be licensed under its MIT license.

Keywords

momentjs

FAQs

Package last updated on 03 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts