
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
smart-utils
Advanced tools
Collection of util things
npm install smart-utils
Generate an tag name for HTML tags to angularjs components.
smartUtils turns to smart-utilsSmartUtils turns to smart-utilsISmartUtils turns to i-smart-utilsSmartUtilsAndEtc turns to smart-utils-and-etcvar smartUtils = require('smart-utils');
var wordOne = "smartUtils";
var wordTwo = "SmartUtils";
var wordThre = "ISmartUtils";
var wordFour = "SmartUtilsAndEtc";
console.log(smartUtils.tagrize(wordOne));
console.log(smartUtils.tagrize(wordTwo));
console.log(smartUtils.tagrize(wordThre));
console.log(smartUtils.tagrize(wordFour));
Ensure the directory exists
var smartUtils = require('smart-utils');
function ensureDirectoryExists_callback(error) {
if (error) {
console.log('Houston, We\'ve Had a Problem');
}
};
smartUtils.ensureDirectoryExists('C:/temp', ensureDirectoryExists_callback);
console.log('All ok.');
var Promise = require('promise');
var smartUtils = require('smart-utils');
var ensureDirectoryExists = Promise.denodeify(smartUtils.ensureDirectoryExists);
ensureDirectoryExists('C:/temp')
.then(() => {
console.log('All right');
}, (error) => {
console.log('Houston, We\'ve Had a Problem');
});
var Q = require('q');
var smartUtils = require('smart-utils');
var ensureDirectoryExists = Q.denodeify(smartUtils.ensureDirectoryExists);
ensureDirectoryExists('C:/temp')
.then(() => {
console.log('All right');
}, (error) => {
console.log('Houston, We\'ve Had a Problem');
});
var path = require('path');
var Promise = require('promise');
var smartUtils = require('smart-utils');
var ensureDirectoryExists = Promise.denodeify(smartUtils.ensureDirectoryExists);
ensureDirectoryExists(path.join('C:', 'temp'))
.then(() => {
return ensureDirectoryExists(path.join('C:', 'temp', 'smartUtils'));
})
.then(() => {
return ensureDirectoryExists(path.join('C:', 'temp', 'smartUtils', 'multi'));
})
.then(() => {
return ensureDirectoryExists(path.join('C:', 'temp', 'smartUtils', 'multi', 'nivel'));
})
.then(() => {
console.log('Now the path "C:\\temp\\smartUtils\\multi\\nivel" exists ;D');
console.log('All right');
}, (error) => {
console.log('Houston, We\'ve Had a Problem');
});
List directory and file inside an directory recursively
var smartUtils = require('smart-utils');
function listDirectoryContentRecursive_callback(error, result) {
if(error){
console.log('Ooops, problems!');
console.log(error);
return;
}
for (var index = 0; index < result.length; index++) {
var element = result[index];
console.log(element);
}
};
smartUtils.listDirectoryContentRecursive('C:/temp/', listDirectoryContentRecursive_callback);
List directory and files inside an directory with options or no to list recursively
var smartUtils = require('smart-utils');
function listDirectoryContent_callback(error, result) {
if(error){
console.log('Ooops, problems!');
console.log(error);
return;
}
for (var index = 0; index < result.length; index++) {
var element = result[index];
console.log(element);
}
console.log('----------------------------------------');
};
var options = {
recursive: true
};
// With options to recursive
smartUtils.listDirectoryContent('C:/temp', options, listDirectoryContent_callback);
// Without options, list just que first directory level
smartUtils.listDirectoryContent('C:/temp', listDirectoryContent_callback);
Get the value of an property deep into in a object, or not.
Do not ask me the utility of it ;D
var smartUtils = require('smart-utils');
var dataObject = {
one: {
two: {
three: {
value: "This is the final value!"
},
value: "This is not the final value! Go ahead!"
},
value: "This is the second level value."
},
value: "Yeap, first level value."
};
console.log(smartUtils.objectDeepFind(dataObject, 'value'));
console.log(smartUtils.objectDeepFind(dataObject, 'one.value'));
console.log(smartUtils.objectDeepFind(dataObject, 'one.two.value'));
console.log(smartUtils.objectDeepFind(dataObject, 'one.two.three.value'));
Replace all found values at once, without regex ;D.
var smartUtils = require('smart-utils');
var text = "object is a color, but object is a fruit to.";
console.log(smartUtils.replaceAll(text, "object", "orange"));
Thanks
FAQs
Collection of util things
We found that smart-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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.