
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
landmark-utils
Advanced tools
A useful library of utilities for node.js used by Landmark and you!
It provides additional functionality for manipulating and converting various types of data, including converting strings between various forms, and lightweight html ← → text conversion.
npm install landmark-utils --save
... then ...
var utils = require('landmark-utils');
console.log(utils.isObject({})); // true!
If you're using Landmark, it exposes this library
as .utils
.
var landmark = require('landmark-serve'),
utils = landmark.utils;
isFunction(arg)
- determines if arg
is a functionisObject(arg)
- determines if arg
is an objectisValidObjectId(arg)
- determines if arg
looks like a valid MongoDB ObjectIdisArray(arg)
- determines if arg
is an arrayisDate(arg)
- determines if arg
is a dateisString(arg)
- determines if arg
is a stringisNumber(arg)
- determines if arg
is a numberisEmail(arg)
- make sure arg
looks like a valid email address
options(defaults, options)
- copies and merges options into the defaultsoptionsMap(arr, property, clone)
- creates a map of options
property
clone
is true (c/o underscore.clone
)bindMethods(obj, scope)
- recursively binds method properties of obj
to scope
and returns a new object containing the bound methods.randomString(len, chars)
- Generates a 'random' string of characters to the
specified length (uses Math.random).
len
can be an array of [min, max]
length to generatechars
is a string of characters to include, defaults to
0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz
number(arg)
- converts a string to a number, accepting human-friendly input
1,432
» 1432
, $1432
» 1432
, 2.5
» 2.5
escapeRegExp(str)
- escapes a string to be safely converted to a regular expressionescapeString(str)
- escapes a string to be safely used as a Javascript string literalstripDiacritics(str)
- stips accented characters from a string, replacing them with their simple equivalentstransliterate(str)
- transliterates Russian and Ukrainian words from cyrillic to latinsingular(str)
- converts a string to its singular formplural(count, singular, plural)
- displays the singular or plural of a string
based on a number or number of items in an array.
*
in the string with the numbersingular
to plural
when plural is not providedplural(1, '* thing')
» '1 thing'
plural(2, '* thing')
» '2 things'
plural([1,2], 'single', 'couple')
» 'couple'
plural('friend')
» 'friends'
upcase(str)
- converts the first letter in a string to Uppercasedowncase(str)
- converts the first letter in a string to lowercasetitlecase(str)
- converts a string to Title Casecamelcase(str, lowercase)
- converts a string to camelCase
lowercase
argument causes the first letter to be lowercase, and
default to true
.decodeHTMLEntities(str)
- decodes html entities in a stringencodeHTMLEntities(str)
- encodes html entities in a stringtextToHTML(str)
- lightweight conversion of text to HTML (line breaks to <br>
)htmlToText(str)
- lightweight conversion to HTML to text
br
, p
, div
, li
, td
, th
tags to single
line-breaks. All other tags are stripped.to-markdown
and html-to-text
packages on npm.cropString(str, length, append, preserveWords)
- crops a string to the
specified length
append
(only appended if the
original string was longer than the specified length).preserveWords
is true, the length is extended to the end of the last
word that would have been cropped.cropHTMLString(str, length, append, preserveWords)
- crops an HTML string
safely by converting it to text, cropping it, then converting it back to HTMLslug(str, separator)
- generates a slug from a string. Word breaks are hyphenated.
separator
defaults to '-'keyToLabel(str)
- converts a key to a label
keyToLabel('myKey')
» My Key
keyToPath(str, plural)
- converts a key to a path
slug(keyToLabel(str))
but will optionally converts the last word
to a plural.keyToPath('someThing', true)
» some-things
keyToProperty(str, plural)
- Converts a key to a property.
keyToPath
but converts to headlessCamelCase instead of dash-separatedcalculateDistance(point1 [lat, lng], point2 [lat, lng])
- Returns the distance between two [lat,lng]
points in radianskmBetween
- Returns the distance between two [lat,lng]
points in kilometersmilesBetween
- Returns the distance between two [lat,lng]
points in milesUses the excellent underscore library,
see http://underscorejs.org or npm info underscore
Uses the inflect library for singular / plural conversion,
see https://github.com/pksunkara/inflect or npm info i
Some utils are borrowed from / inspired by mongoose/utils.js
,
see https://github.com/LearnBoost/mongoose
HTML Entity encode / decode is based on code in node-html-to-text
,
see https://github.com/werk85/node-html-to-text
The transliteration code is based on https://www.npmjs.org/package/transliteration.cyr
FAQs
A useful library of utilities used by LandmarkJS
The npm package landmark-utils receives a total of 0 weekly downloads. As such, landmark-utils popularity was classified as not popular.
We found that landmark-utils 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.