New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

moment-fp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-fp

Functional Moment.js

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

moment-fp

A complete functional wrapper around Moment.js.

npm install moment-fp

View the documentation

Why moment-fp?

  • All functions are curried by default.
  • No mutations of moment objects

Example

import * as _ from 'ramda';

const dates = [
    [2010, 1, 1],
    [2011, 1, 1],
    [2012, 1, 1],
    [2013, 1, 1]
];


/**
 * Using `moment-fp`
 */
import * as M from '../dist/index';

const etc = _.compose(
    _.map(M.format('YYYY-MM-DD')),
    _.reject(_.compose(_.equals(2011), M.year)),
    _.map(M.add(1, 'day')),
    _.map(M.moment)
)(dates);

// [ '2010-02-02', '2012-02-02', '2013-02-02' ]
console.log(etc);


/**
 * Using vanilla moment
 */
import moment from 'moment';

const etc2 = _.compose(
    _.map(momDate => momDate.format('YYYY-MM-DD')),
    _.reject(_.compose(_.equals(2011), momDate => momDate.year())),
    _.map(momDate => momDate.add(1, 'day')),
    _.map(arrDate => moment(arrDate))
)(dates);

// [ '2010-02-02', '2012-02-02', '2013-02-02' ]
console.log(etc2);

FAQs

Package last updated on 23 Jul 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc