Protected
currentProtected
currentProtected
executedProtected
indexProtected
logProtected
nextProtected
totalStatic
LOGNAMEthe name of the custom logger for this component for independent logging control
per the iterator protocol, retrieves the next element. Also returns null
if done as the specification for
the protocol says the value property is optional when 'done'
You don't typically call this function yourself - libraries like ImmutableJS do.
Static
fromCreates a lazy search from an existing NS search.
Optional
pageSize: numberimport {Seq} from './NFT-X.Y.Z/immutable'
import * as search from 'N/search
import {governanceRemains, LazySearch, nsSearchResult2obj} from './NFT-X.Y.Z/search'
Seq(LazySearch.from(search.create({
filters: [['internalid', 'anyof', [1,2]),
columns:['item', 'description'],
type: search.Type.ITEM,
})))
.takeWhile(governanceRemains()) // process until we drop below default governance threshold
.map(nsSearchResult2obj()) // convert search results to plain objects with properties
.forEach( r => log.debug(r))
Static
loadLoads an existing NS search by id and prepares it for lazy evaluation
internal id of the search to load
Optional
pageSize: numberhow many records to retrieve per page (paging is automatic) Maximum value: 1000
import {Seq} from './NFT-X.Y.Z/immutable'
import {governanceRemains, LazySearch, nsSearchResult2obj} from './NFT-X.Y.Z/search'
Seq(LazySearch.load('1234'))
.takeWhile(governanceRemains()) // process until we drop below default governance threshold
.map(nsSearchResult2obj()) // convert search results to plain objects with properties
.forEach( r => log.debug(r))
Makes a NetSuite search an ES2015 style Iterator. That is, it follows the Iterator Protocol for iterating over search results in a forward-only fashion. The result can be passed to any library that accepts Iterators (such as ImmutableJS) to provide easy chainable logic on arbitrary length search result sets.
Started with this as a class due to other library requirements and left it as a class just as an easy way to contain state about currentpage and index into that page.
This is exposed as an iterator so that it could be used with other libraries. For example I've heard Ramda may support iterators so if we choose to go a more pure FP route down the road this class would be useful - i.e. it remains untied to any particular library.
Example: take the first result of a search as a plain object (ImmutableJS)