Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
almete.maxdiff
Advanced tools
Readme
almete.MaxDiff(values)
Implementation of MaxDiff technique to support discrete ordering model.
argument | description |
---|---|
values | An iterable of the values to order. |
Returns an instance to control the process.
npm install almete.maxdiff
import MaxDiff from 'almete.maxdiff';
const MaxDiff = require('almete.maxdiff');
<script src="https://unpkg.com/almete.bronkerbosch"></script>
<script src="https://unpkg.com/almete.maxdiff"></script>
The function MaxDiff
will be available under the namespace almete
.
.complete
read-only
true
, if the process is complete, false
otherwise.
.result
read-only
An array of the values in the resulted order, if the process is complete, undefined
otherwise.
.order(...values)
Orders the given values. The values are ordered in the given argument order.
Already established order relations between values are immutable.
argument | description |
---|---|
values | The values to order. |
let instance = almete.MaxDiff('edacb');
instance.order('a', 'b', 'c');
instance.order('c', 'd', 'e');
console.log(instance.result); // => ['a', 'b', 'c', 'd', 'e']
.getCandidatesToOrder(count = 4)
Returns the values that are most significant candidates to be ordered as next.
argument | description |
---|---|
count | The maximum count of candidates to get. |
.getUnorderedPairs()
Returns pairs of the values as an array of arrays, where the order between the two values is unknown.
The values are ordered by their initial order.
let instance = almete.MaxDiff('bca');
console.log(instance.getUnorderedPairs()); // => [['b', 'c'], ['b', 'a'], ['c', 'a']]
instance.order('a', 'b');
console.log(instance.getUnorderedPairs()); // => [['b', 'c'], ['c', 'a']]
instance.order('b', 'c');
console.log(instance.getUnorderedPairs()); // => []
.getOrderedPairs()
Returns pairs of the values as an array of arrays, where the order between the two values is known.
The values are ordered by their resulted order.
let instance = almete.MaxDiff('bca');
console.log(instance.getOrderedPairs()); // => []
instance.order('a', 'b');
console.log(instance.getOrderedPairs()); // => [['a', 'b']]
instance.order('b', 'c');
console.log(instance.getOrderedPairs()); // => [['b', 'c'], ['a', 'b'], ['a', 'c']]
.getValues()
Returns the values as an array.
.orderLeftOf(value, otherValues)
Orders the value to the left of the other values.
Already established order relations between values are immutable.
argument | description |
---|---|
value | The value to order to the left of the other values. |
otherValues | An iterable of the values to order to the right of the given value. |
let instance = almete.MaxDiff('edacb');
instance.orderLeftOf('a', 'cd');
console.log(instance.getOrderedPairs()); // => [['a', 'c'], ['a', 'd']]
.orderRightOf(value, otherValues)
Orders the value to the right of the other values.
Already established order relations between values are immutable.
argument | description |
---|---|
value | The value to order to the right of the other values. |
otherValues | An iterable of the values to order to the left of the given value. |
let instance = almete.MaxDiff('edacb');
instance.orderRightOf('e', 'bc');
console.log(instance.getOrderedPairs()); // => [['c', 'e'], ['b', 'e']]
.orderLeft(value)
Orders the value to the left of all other values.
Already established order relations between values are immutable.
argument | description |
---|---|
value | The value to order to the left of all other values. |
let instance = almete.MaxDiff('bca');
instance.orderLeft('a');
console.log(instance.getOrderedPairs()); // => [['a', 'b'], ['a', 'c']]
instance.orderLeft('b');
console.log(instance.result); // => ['a', 'b', 'c']
.orderRight(value)
Orders the value to the right of all other values.
Already established order relations between values are immutable.
argument | description |
---|---|
value | The value to order to the right of all other values. |
let instance = almete.MaxDiff('bca');
instance.orderRight('c');
console.log(instance.getOrderedPairs()); // => [['b', 'c'], ['a', 'c']]
instance.orderRight('b');
console.log(instance.result); // => ['a', 'b', 'c']
.getValuesLeftOf(value)
Returns the values that are ordered to the left of the given value.
argument | description |
---|---|
value | The value to the right of the values to get. |
let instance = almete.MaxDiff('edacb');
instance.order('a', 'b', 'e');
instance.order('c', 'e');
console.log(instance.getValuesLeftOf('e')); // => ['b', 'a', 'c']
.getValuesRightOf(value)
Returns the values that are ordered to the right of the given value.
argument | description |
---|---|
value | The value to the left of the values to get. |
let instance = almete.MaxDiff('edacb');
instance.order('a', 'd', 'e');
instance.order('a', 'c');
console.log(instance.getValuesRightOf('a')); // => ['d', 'e', 'c']
.getUnorderedGroups()
Returns groups of the values as an array of arrays, where the order between each pair of values is unknown.
The groups are ordered by decreasing length. The values are ordered by their initial order.
let instance = almete.MaxDiff('cbad');
console.log(instance.getUnorderedGroups()); // => [['c', 'b', 'a', 'd']]
instance.order('a', 'd');
instance.order('c', 'd');
console.log(instance.getUnorderedPairs()); // => [['c', 'b'], ['c', 'a'], ['b', 'a'], ['b', 'd']]
console.log(instance.getUnorderedGroups()); // => [['c', 'b', 'a'], ['b', 'd']]
instance.order('a', 'b', 'c');
console.log(instance.getUnorderedGroups()); // => []
.getOrderedGroups()
Returns groups of the values as an array of arrays, where the order between each pair of values is known.
The groups are ordered by decreasing length. The values are ordered by their resulted order.
let instance = almete.MaxDiff('cbad');
console.log(instance.getOrderedGroups()); // => []
instance.order('a', 'b', 'c');
instance.order('a', 'd');
console.log(instance.getOrderedPairs()); // => [['b', 'c'], ['a', 'b'], ['a', 'c'], ['a', 'd']]
console.log(instance.getOrderedGroups()); // => [['a', 'b', 'c'], ['a', 'd']]
instance.order('c', 'd');
console.log(instance.getOrderedGroups()); // => [['a', 'b', 'c', 'd']]
.getValuesCount()
Returns the length of the array, that the function .getValues()
would return.
.getUnorderedPairsCount()
Returns the length of the array, that the function .getUnorderedPairs()
would return.
.getOrderedPairsCount()
Returns the length of the array, that the function .getOrderedPairs()
would return.
.getValuesCountRightOf(value)
Returns the length of the array, that the function .getValuesRightOf()
would return.
.getValuesCountLeftOf(value)
Returns the length of the array, that the function .getValuesLeftOf()
would return.
.clone()
Returns a clone of this instance.
FAQs
Implementation of MaxDiff technique to support discrete ordering model.
The npm package almete.maxdiff receives a total of 6 weekly downloads. As such, almete.maxdiff popularity was classified as not popular.
We found that almete.maxdiff demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.