🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

utils-compare

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

utils-compare

Utility compare function that accepts two objects (a, b) and returns 1 if a >= b otherwise -1.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

utils-compare NPM version

Compare function that accepts two objects (a, b) and returns 1 if a >= b otherwise -1.

Quickstart

Open the command prompt in the root of your project and run the following command:

npm i utils-compare --save-dev

Usage

Example "globbing" utility, using the compare function to sort the result:

var compareFn = require('utils-compare');

var globFiles = function (src, compare_fn) {
  compare_fn = compareFn(compare_fn);
  src.map(function (path) {
    index += 1;
    return {
      index: index,
      path: path,
      content: grunt.file.read(path)
    };
  }).sort(compare_fn).map(function (foo) {
     // do stuff
  });
};

Author

Licensed under the MIT License Copyright (c) Jon Schlinkert, contributors.

Keywords

helper

FAQs

Package last updated on 17 Sep 2013

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