Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
nd-point
Advanced tools
Readme
Find the points objects should occupy in an n-dimensional array.
var Point = require('nd-point')
var point = Point(['division','level','style'])
point({division: 'doubles', level: 'beginner', style: 'freestyle'}) // [0,0,0]
point({division: 'doubles', level: 'intermediate', style: 'freestyle'}) // [0,1,0]
point({division: 'singles', level: 'beginner', style: 'freestyle'}) // [1,0,0]
point({division: 'doubles', level: 'advanced', style: 'compulsory'}) // [0,2,1]
Returns a new point
function that takes json objects as input and returns the
point path (an array of integers) based on the object's properties.
With a new point
function, the first time a value is seen for a property, it
is assigned the next consecutive integer for that property. Properties are added
to the point path in the order they were passed in.
var point = Point(['division','level','style'])
// for the first doc, all properties are making their first appearance.
point({division: 'doubles', level: 'beginner', style: 'freestyle'})
// [0,0,0]
// 'intermediate' is a new level
point({division: 'doubles', level: 'intermediate', style: 'freestyle'})
// [0,1,0]
// '' (empty) is a new level
point({division: 'doubles', style: 'freestyle'})
// [0,2,0]
You can use sortable-object-hash
to order objects based on their properties before assigning them an nd-point
.
For interface elements that are represented nicely as a multidimensional array,
you can find which node an element belongs in via its point path. nd-point
allows you to find an object's n-dimensional point based on an its properties.
page
└─┬ tabbed-pane [0]
├─┬ table [0,0]
│ ├─┬ row [0,0,0]
│ │ ├── column [0,0,0,0]
│ │ └── column [0,0,0,1]
│ └─┬ row [0,0,1]
│ └── column [0,0,1,0]
├ tabbed-pane [1]
└─┬ table [1,0]
├─┬ row [1,0,0]
│ └── column [1,0,0,0]
├─┬ row [1,0,1]
│ └── column [1,0,1,0]
├ table [1,1]
└─┬ row [1,1,0]
└── column [1,1,0,0]
MIT
FAQs
find the points objects should occupy in a multidimensional array
We found that nd-point 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
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).